forked from hashicorp/consul-aws
-
Notifications
You must be signed in to change notification settings - Fork 0
/
commands.go
46 lines (37 loc) · 1.2 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
package main
import (
"os"
cmdSyncCatalog "github.com/awsiv/eureka-aws/subcommand/sync-catalog"
cmdVersion "github.com/awsiv/eureka-aws/subcommand/version"
"github.com/awsiv/eureka-aws/version"
"github.com/mitchellh/cli"
)
// Commands is the mapping of all available eureka-aws commands.
var Commands map[string]cli.CommandFactory
func init() {
ui := &cli.BasicUi{Writer: os.Stdout, ErrorWriter: os.Stderr}
Commands = map[string]cli.CommandFactory{
"sync-catalog": func() (cli.Command, error) {
return &cmdSyncCatalog.Command{UI: ui}, nil
},
"version": func() (cli.Command, error) {
return &cmdVersion.Command{UI: ui, Version: version.GetHumanVersion()}, nil
},
}
}
func helpFunc() cli.HelpFunc {
// This should be updated for any commands we want to hide for any reason.
// Hidden commands can still be executed if you know the command, but
// aren't shown in any help output. We use this for prerelease functionality
// or advanced features.
hidden := map[string]struct{}{
"inject-connect": {},
}
var include []string
for k := range Commands {
if _, ok := hidden[k]; !ok {
include = append(include, k)
}
}
return cli.FilteredHelpFunc(include, cli.BasicHelpFunc("eureka-aws"))
}