-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
92 lines (84 loc) · 2.12 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package main
import (
"log"
"os"
"github.com/spf13/viper"
"github.com/urfave/cli/v2"
)
const version = "0.0.6"
var commands = []*cli.Command{
&cli.Command{
Name: "ami",
Usage: "Get the Amazon AMI ID of the given GitHub Enterprise Server version, based on your AWS region",
Description: "ghe ami 2.20.0",
Action: cmd_ami,
},
&cli.Command{
Name: "launch",
Usage: "Launch a GitHub Enterprise Server instance of the given version on EC2",
Description: "",
Action: cmd_launch,
},
&cli.Command{
Name: "list",
Usage: "List all GitHub Enterprise Server instance with detailed information",
Description: "",
Action: cmd_list,
},
&cli.Command{
Name: "start",
Usage: "Start GitHub Enterprise Server instances. Multiple argument can be passed",
Description: "",
Action: cmd_start,
},
&cli.Command{
Name: "stop",
Usage: "Stop GitHub Enterprise Server instances. Multiple argument, or 'all' can be passed",
Description: "",
Action: cmd_stop,
},
&cli.Command{
Name: "terminate",
Usage: "Terminate GitHub Enterprise Server instances. Multiple argument, or 'all' can be passed",
Description: "",
Action: cmd_terminate,
},
&cli.Command{
Name: "dns",
Usage: "Update your dnsmasq config file to make your domain point to specific IP address",
Description: "",
Action: cmd_dns,
},
&cli.Command{
Name: "configure",
Usage: "Initiate GitHub Enterprise Server configuration using the configuration file",
Description: "",
Action: cmd_configure,
},
}
func main() {
viper.SetConfigName("ghe")
viper.AddConfigPath("$HOME/.config/")
err := viper.ReadInConfig()
if err != nil {
log.Fatal(err)
}
r := newResolver()
err = r.check()
if err != nil {
log.Fatal(err)
}
app := cli.NewApp()
app.Name = "ghe"
app.Usage = "Launch GitHub Enterprise instances on AWS"
app.Version = version
app.Authors = []*cli.Author{{
Name: "lowply",
Email: "[email protected]",
}}
app.Commands = commands
err = app.Run(os.Args)
if err != nil {
log.Fatal(err)
}
}