-
Notifications
You must be signed in to change notification settings - Fork 2
/
nasefa.go
55 lines (48 loc) · 1.22 KB
/
nasefa.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
package main
import (
"context"
"os"
"flag"
"github.com/google/subcommands"
"nasefa/commands"
)
const (
kSendReceiveGroup = "sending and receiving bundles of files"
kFileAndBundleOpsGroup = "file and bundle management"
kHelpGroup = "help"
kWebGroup = "web"
)
func main() {
defer commands.ClientCleanup()
commands.RegisterTopLevelFlags()
commandsMap := map[string][]subcommands.Command{
kSendReceiveGroup: []subcommands.Command{
commands.SendCommand(),
commands.ReceiveCommand(),
commands.AutoreceiveCommand(),
},
kFileAndBundleOpsGroup: []subcommands.Command{
commands.ListCommand(),
commands.CreateBundleCommand(),
commands.DeleteBundleCommand(),
commands.AddFileCommand(),
},
kWebGroup: []subcommands.Command{
commands.WebCommand(),
},
kHelpGroup: []subcommands.Command{
subcommands.HelpCommand(),
subcommands.FlagsCommand(),
subcommands.CommandsCommand(),
},
}
for groupName, commands := range commandsMap {
for _, command := range commands {
subcommands.Register(command, groupName)
}
}
flag.Parse()
commands.InitLogger()
ctx := context.Background()
os.Exit(int(subcommands.Execute(ctx)))
}