-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
53 lines (45 loc) · 1.55 KB
/
main.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
package main
import (
"fmt"
"os"
"github.com/oleewere/cmctl/cmd"
"github.com/urfave/cli"
)
// Version that will be generated during the build as a constant
var Version string
// GitRevString that will be generated during the build as a constant - represents git revision value
var GitRevString string
func main() {
app := cli.NewApp()
app.Name = "cmctl"
app.Usage = "CLI tool for handle CM clusters"
app.EnableBashCompletion = true
app.UsageText = "cmctl command [command options] [arguments...]"
if len(Version) > 0 {
app.Version = Version
} else {
app.Version = "0.1.0"
}
if len(GitRevString) > 0 {
app.Version = app.Version + fmt.Sprintf(" (git short hash: %v)", GitRevString)
}
app.Commands = []cli.Command{}
app.Commands = append(app.Commands, cmd.ServersCommand())
app.Commands = append(app.Commands, cmd.ProfilesCommand())
app.Commands = append(app.Commands, cmd.ClustersCommand())
app.Commands = append(app.Commands, cmd.HostsCommand())
app.Commands = append(app.Commands, cmd.ServicesCommand())
app.Commands = append(app.Commands, cmd.RolesCommand())
app.Commands = append(app.Commands, cmd.UsersCommand())
app.Commands = append(app.Commands, cmd.AccountsCommand())
app.Commands = append(app.Commands, cmd.ConfigsCommand())
app.Commands = append(app.Commands, cmd.InventoryCommand())
app.Commands = append(app.Commands, cmd.SaltCommand())
app.Commands = append(app.Commands, cmd.ExecCommand())
app.Commands = append(app.Commands, cmd.PlaybookCommands())
err := app.Run(os.Args)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
}