forked from voidint/g
-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.go
85 lines (83 loc) · 1.79 KB
/
commands.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package cli
import "github.com/urfave/cli/v2"
var (
commands = []*cli.Command{
{
Name: "ls",
Aliases: []string{"l"},
Usage: "List installed versions",
UsageText: "g ls",
Action: list,
},
{
Name: "ls-remote",
Aliases: []string{"lr", "lsr"},
Usage: "List remote versions available for install",
UsageText: "g ls-remote [stable|archived|unstable]",
Action: listRemote,
},
{
Name: "use",
Usage: "Switch to specified version",
UsageText: "g use <version>",
Action: use,
},
{
Name: "install",
Aliases: []string{"i"},
Usage: "Download and install a version",
UsageText: "g install <version>",
Action: install,
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "nouse",
Aliases: []string{"n"},
Usage: "Only install without using",
},
},
},
{
Name: "uninstall",
Usage: "Uninstall a version",
UsageText: "g uninstall <version>",
Action: uninstall,
},
{
Name: "update",
Usage: "Download and install updates to g",
UsageText: "g update",
Action: selfUpdate,
Hidden: true,
},
{
Name: "clean",
Usage: "Remove files from the package download directory",
UsageText: "g clean",
Action: clean,
},
{
Name: "env",
Usage: "Show env variables of g",
UsageText: "g env",
Action: showEnv,
},
{
Name: "self",
Usage: "Modify g itself",
Subcommands: []*cli.Command{
{
Name: "update",
Usage: "Download and install updates to g",
UsageText: "g self update",
Action: selfUpdate,
},
{
Name: "uninstall",
Usage: "Uninstall g",
UsageText: "g self uninstall",
Action: selfUninstall,
},
},
},
}
)