JMS #5: Starting support for subcommand docs

This commit is contained in:
Jeremy Saenz 2013-07-20 10:20:46 -07:00
parent 6dbfe20872
commit 0dd327f6e5

14
help.go
View File

@ -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) {