JMS #5: Starting support for subcommand docs
This commit is contained in:
parent
6dbfe20872
commit
0dd327f6e5
14
help.go
14
help.go
@ -12,6 +12,16 @@ var helpCommand = Command{
|
||||
ShortName: "h",
|
||||
Usage: "Shows a list of commands or help for one command",
|
||||
Action: func(c *Context) {
|
||||
args := c.Args()
|
||||
if len(args) > 0 {
|
||||
showCommandHelp(c)
|
||||
} else {
|
||||
showAppHelp(c)
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
func showAppHelp(c *Context) {
|
||||
helpTemplate := `NAME:
|
||||
{{.Name}} - {{.Usage}}
|
||||
|
||||
@ -33,7 +43,9 @@ GLOBAL OPTIONS:
|
||||
t := template.Must(template.New("help").Parse(helpTemplate))
|
||||
t.Execute(w, c.App)
|
||||
w.Flush()
|
||||
},
|
||||
}
|
||||
|
||||
func showCommandHelp(c *Context) {
|
||||
}
|
||||
|
||||
func showVersion(c *Context) {
|
||||
|
Loading…
Reference in New Issue
Block a user