forked from cloudfoundry-attic/hm9000
/
hm9000.go
55 lines (50 loc) · 1.26 KB
/
hm9000.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
package main
import (
"github.com/cloudfoundry/hm9000/helpers/logger"
"github.com/cloudfoundry/hm9000/hm"
"github.com/codegangsta/cli"
"os"
)
func main() {
l := logger.NewRealLogger()
app := cli.NewApp()
app.Name = "HM9000"
app.Usage = "Start the various HM9000 components"
app.Version = "0.0.9000"
app.Commands = []cli.Command{
cli.Command{
Name: "fetch_desired",
Description: "Fetches desired state",
Usage: "hm fetch_desired --config=/path/to/config",
Flags: []cli.Flag{
cli.StringFlag{"config", "", "Path to config file"},
},
Action: func(c *cli.Context) {
hm.FetchDesiredState(l, c)
},
},
cli.Command{
Name: "listen",
Description: "Listens over the NATS for the actual state",
Usage: "hm listen --config=/path/to/config",
Flags: []cli.Flag{
cli.StringFlag{"config", "", "Path to config file"},
},
Action: func(c *cli.Context) {
hm.StartListeningForActual(l, c)
},
},
cli.Command{
Name: "dump",
Description: "Dumps contents of the data store",
Usage: "hm dump --config=/path/to/config",
Flags: []cli.Flag{
cli.StringFlag{"config", "", "Path to config file"},
},
Action: func(c *cli.Context) {
hm.Dump(l, c)
},
},
}
app.Run(os.Args)
}