forked from buildkite/agent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
60 lines (42 loc) · 1.11 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
package main
import (
"github.com/buildbox/agent/buildbox"
"github.com/codegangsta/cli"
"os"
)
var AppHelpTemplate = `Usage:
{{.Name}} <command> [arguments...]
Available comamnds are:
{{range .Commands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}}
{{end}}
Use "{{.Name}} <command> --help" for more information about a command.
`
var SubcommandHelpTemplate = `Usage:
{{.Name}} {{if .Flags}}<command>{{end}} [arguments...]
Available comamnds are:
{{range .Commands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}}
{{end}}{{if .Flags}}
Options:
{{range .Flags}}{{.}}
{{end}}{{end}}
`
var CommandHelpTemplate = `{{.Description}}
Options:
{{range .Flags}}{{.}}
{{end}}
`
func main() {
cli.AppHelpTemplate = AppHelpTemplate
cli.CommandHelpTemplate = CommandHelpTemplate
cli.SubcommandHelpTemplate = SubcommandHelpTemplate
app := cli.NewApp()
app.Name = "buildbox-agent"
app.Version = buildbox.Version()
app.Commands = Commands
// Default the default action
app.Action = func(c *cli.Context) {
cli.ShowAppHelp(c)
os.Exit(1)
}
app.Run(os.Args)
}