-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
62 lines (54 loc) · 1.25 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
54
55
56
57
58
59
60
61
62
package main
import (
"fmt"
"os"
"github.com/urfave/cli"
)
func main() {
app := cli.NewApp()
app.Name = "brizoctl"
app.Usage = "CLI client for Brizo"
app.Description = "brizoctl enables users to manage Brizo deployments from the command line"
app.Version = "0.1.0"
// startup
app.Before = func(c *cli.Context) error {
err := parseConfig()
if err != nil {
fmt.Println(err)
os.Exit(1)
}
return nil
}
// global flags
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "config, c",
Value: "~/.brizo.json",
Usage: "Path to brizo config file",
Destination: &ConfigPath,
},
}
// commands
app.Commands = []cli.Command{
cli.Command{
Name: "list",
UsageText: "list [TYPE]",
Usage: "retrieve list of specified resources",
Subcommands: listCommands,
},
cli.Command{
Name: "get",
UsageText: "get [TYPE] [UUID]",
Usage: "retrieve details of specified resource",
Subcommands: getCommands,
},
cli.Command{
Name: "promote",
UsageText: "promote [APP] [SOURCE ENVIRONMENT] [DESTINATION ENV]",
Usage: "promote an application from one environment to another",
Action: PromoteApplication,
},
}
// start your engines!
app.Run(os.Args)
}