If no action is specified on the command or app, print the help documentation

Rather than panic'ing or displaying an opaque error message about the
signature which is more confusing to the end user.

Fixes #562
This commit is contained in:
Jesse Szwedko
2016-11-12 13:37:07 -08:00
parent d86a009f5e
commit 0113f56d10
4 changed files with 52 additions and 1 deletions

View File

@@ -13,7 +13,7 @@ import (
// cli.go uses text/template to render templates. You can
// render custom help text by setting this variable.
var AppHelpTemplate = `NAME:
{{.Name}} - {{.Usage}}
{{.Name}}{{if .Usage}} - {{.Usage}}{{end}}
USAGE:
{{if .UsageText}}{{.UsageText}}{{else}}{{.HelpName}} {{if .VisibleFlags}}[global options]{{end}}{{if .Commands}} command [command options]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}[arguments...]{{end}}{{end}}{{if .Version}}{{if not .HideVersion}}