-
Notifications
You must be signed in to change notification settings - Fork 45
/
command.go
34 lines (28 loc) · 878 Bytes
/
command.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
package commands
import (
"flag"
"github.com/infobloxopen/atlas-cli/atlas/commands/update"
"github.com/infobloxopen/atlas-cli/atlas/commands/bootstrap"
)
// Command generically represents a command that is runnable via the atlas
// command-line tool (e.g. init-app)
type Command interface {
GetName() string
GetFlagset() *flag.FlagSet
Run() error
}
// GetCommandSet returns a mapping between command names and commands
func GetCommandSet() map[string]Command {
cmdBootstrap := bootstrap.Bootstrap{}
cmdUpdate := update.Update{}
return map[string]Command{
cmdBootstrap.GetName(): cmdBootstrap,
cmdUpdate.GetName(): cmdUpdate,
}
}
// GetCommandNames returns a list of all the command names
func GetCommandNames() []string {
cmdBootstrap := bootstrap.Bootstrap{}
cmdUpdate := update.Update{}
return []string{cmdBootstrap.GetName(), cmdUpdate.GetName()}
}