From fcc1613bb54edd49d722d99b553b470638bb8e71 Mon Sep 17 00:00:00 2001 From: Audrius Butkevicius Date: Sat, 26 Jul 2014 21:53:05 +0100 Subject: [PATCH 1/2] Do not show empty description section --- help.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/help.go b/help.go index ccca036..85af1d9 100644 --- a/help.go +++ b/help.go @@ -34,10 +34,10 @@ var CommandHelpTemplate = `NAME: {{.Name}} - {{.Usage}} USAGE: - command {{.Name}}{{ if .Flags }} [command options]{{ end }} [arguments...] + command {{.Name}}{{ if .Flags }} [command options]{{ end }} [arguments...]{{if .Description}} DESCRIPTION: - {{.Description}}{{ if .Flags }} + {{.Description}}{{end}}{{ if .Flags }} OPTIONS: {{range .Flags}}{{.}} From 527fbe0671e86bcd611e743499cb1c26dae8ad58 Mon Sep 17 00:00:00 2001 From: Audrius Butkevicius Date: Sat, 26 Jul 2014 21:54:50 +0100 Subject: [PATCH 2/2] Unify template formatting --- help.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/help.go b/help.go index 85af1d9..89c45e7 100644 --- a/help.go +++ b/help.go @@ -14,17 +14,17 @@ var AppHelpTemplate = `NAME: {{.Name}} - {{.Usage}} USAGE: - {{.Name}} {{ if .Flags }}[global options] {{ end }}command{{ if .Flags }} [command options]{{ end }} [arguments...] + {{.Name}} {{if .Flags}}[global options] {{end}}command{{if .Flags}} [command options]{{end}} [arguments...] VERSION: {{.Version}} COMMANDS: {{range .Commands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}} - {{end}}{{ if .Flags }} + {{end}}{{if .Flags}} GLOBAL OPTIONS: {{range .Flags}}{{.}} - {{end}}{{ end }} + {{end}}{{end}} ` // The text template for the command help topic. @@ -34,10 +34,10 @@ var CommandHelpTemplate = `NAME: {{.Name}} - {{.Usage}} USAGE: - command {{.Name}}{{ if .Flags }} [command options]{{ end }} [arguments...]{{if .Description}} + command {{.Name}}{{if .Flags}} [command options]{{end}} [arguments...]{{if .Description}} DESCRIPTION: - {{.Description}}{{end}}{{ if .Flags }} + {{.Description}}{{end}}{{if .Flags}} OPTIONS: {{range .Flags}}{{.}} @@ -51,14 +51,14 @@ var SubcommandHelpTemplate = `NAME: {{.Name}} - {{.Usage}} USAGE: - {{.Name}} command{{ if .Flags }} [command options]{{ end }} [arguments...] + {{.Name}} command{{if .Flags}} [command options]{{end}} [arguments...] COMMANDS: {{range .Commands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}} - {{end}}{{ if .Flags }} + {{end}}{{if .Flags}} OPTIONS: {{range .Flags}}{{.}} - {{end}}{{ end }} + {{end}}{{end}} ` var helpCommand = Command{