-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
main.go
52 lines (41 loc) · 1.42 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"fmt"
"github.com/mroth/scmpuff/commands/exec"
"github.com/mroth/scmpuff/commands/expand"
"github.com/mroth/scmpuff/commands/inits"
"github.com/mroth/scmpuff/commands/intro"
"github.com/mroth/scmpuff/commands/status"
"github.com/spf13/cobra"
)
// NAME of the program, hardcoded for consistency
var NAME = "scmpuff"
// VERSION is the default version of the program
// ...in almost all cases this should be overriden by the buildscript.
var VERSION = "0.0.0-development"
var puffCmd = &cobra.Command{
Use: "scmpuff",
Short: "scmpuff extends common git commands with numeric filename shortcuts.",
Long: `scmpuff extends common git commands with numeric filename shortcuts.
If you are just getting started, try the intro!`,
// disable default completions introduced in cobra v1.2.0, we will want to
// customize if we provide these in the future.
CompletionOptions: cobra.CompletionOptions{DisableDefaultCmd: true},
}
var versionCmd = &cobra.Command{
Use: "version",
Short: "Prints the version number",
Long: `All software has versions. This is ours.`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(NAME, VERSION)
},
}
func main() {
puffCmd.AddCommand(versionCmd)
puffCmd.AddCommand(intro.IntroCmd)
puffCmd.AddCommand(inits.CommandInit())
puffCmd.AddCommand(exec.CommandExec())
puffCmd.AddCommand(expand.CommandExpand())
puffCmd.AddCommand(status.CommandStatus())
puffCmd.Execute()
}