-
Notifications
You must be signed in to change notification settings - Fork 0
/
cli.go
47 lines (42 loc) · 865 Bytes
/
cli.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
package cli
import (
"fmt"
"os"
"github.com/urfave/cli/v2"
)
func Run() int {
app := &cli.App{
Name: "got",
Usage: "package manager for commands written in Go",
Flags: []cli.Flag{
&cli.PathFlag{
Name: "config",
Usage: "config file",
Aliases: []string{"c"},
EnvVars: []string{"GOT_CONFIG_FILE"},
},
&cli.BoolFlag{
Name: "debug",
Usage: "debug mode",
Value: false,
EnvVars: []string{"GOT_DEBUG"},
},
},
Commands: []*cli.Command{
NewInstallCommand(),
NewUpgradeCommand(),
NewListCommand(),
NewEnableCommand(),
NewDisableCommand(),
NewShowCommand(),
NewPinCommand(),
NewUnpinCommand(),
NewRemoveCommand(),
},
}
if err := app.Run(os.Args); err != nil {
fmt.Fprintf(app.ErrWriter, "an error occurred during command running: %v\n", err)
return 1
}
return 0
}