forked from abennett/hashi-releases
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
35 lines (30 loc) · 779 Bytes
/
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
package main
import (
"log"
"os"
"github.com/gulducat/hashi-bin/types"
"github.com/gulducat/hashi-bin/vars"
"github.com/mitchellh/cli"
)
const version = "0.1.0"
// TODO: help suffix?
func main() {
log.SetFlags(0) // remove timestamp from log messages
c := cli.NewCLI("hashi-bin", version)
// c.HelpFunc = HelpyHelp(c.Name)
c.Args = os.Args[1:]
// c.GlobalFlags = ......
index, err := types.NewIndex(vars.ReleasesURL + "/index.json")
if err != nil {
log.Fatal(err)
}
c.Commands = GetCommands(c, &index)
// note: i'm not using this quite right... TopLevelHelp is actually handling this.
c.HiddenCommands = GetHiddenCommands(c)
// c.Commands["version"] = versionFactory
exitStatus, err := c.Run()
if err != nil {
log.Fatal(err)
}
os.Exit(exitStatus)
}