|
|
@ -4,14 +4,11 @@ import "os"
|
|
|
|
import "text/tabwriter"
|
|
|
|
import "text/tabwriter"
|
|
|
|
import "text/template"
|
|
|
|
import "text/template"
|
|
|
|
|
|
|
|
|
|
|
|
var HelpCommand = Command{
|
|
|
|
var helpCommand = Command{
|
|
|
|
Name: "help",
|
|
|
|
Name: "help",
|
|
|
|
ShortName: "h",
|
|
|
|
ShortName: "h",
|
|
|
|
Usage: "Shows a list of commands or help for one command",
|
|
|
|
Usage: "Shows a list of commands or help for one command",
|
|
|
|
Action: ShowHelp,
|
|
|
|
Action: func(c *Context) {
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func ShowHelp(c *Context) {
|
|
|
|
|
|
|
|
helpTemplate := `NAME:
|
|
|
|
helpTemplate := `NAME:
|
|
|
|
{{.Name}} - {{.Usage}}
|
|
|
|
{{.Name}} - {{.Usage}}
|
|
|
|
|
|
|
|
|
|
|
@ -24,7 +21,7 @@ VERSION:
|
|
|
|
COMMANDS:
|
|
|
|
COMMANDS:
|
|
|
|
{{range .Commands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}}
|
|
|
|
{{range .Commands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
GLOBAL OPTIONS
|
|
|
|
GLOBAL OPTIONS:
|
|
|
|
{{range .Flags}}{{.}}
|
|
|
|
{{range .Flags}}{{.}}
|
|
|
|
{{end}}
|
|
|
|
{{end}}
|
|
|
|
`
|
|
|
|
`
|
|
|
@ -33,4 +30,5 @@ GLOBAL OPTIONS
|
|
|
|
t := template.Must(template.New("help").Parse(helpTemplate))
|
|
|
|
t := template.Must(template.New("help").Parse(helpTemplate))
|
|
|
|
t.Execute(w, c.App)
|
|
|
|
t.Execute(w, c.App)
|
|
|
|
w.Flush()
|
|
|
|
w.Flush()
|
|
|
|
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
|
|
|