@cryptotaxi247 / kubo / commits / 589851fb4

cmds: root: fix '--help' notice for subcmds

Juan Batiz-Benet committed Nov 15, 2014 at 09:01 UTC 589851fb4e90a0f8fd8bf2279b183f54213a9332
1 file changed +5 -1
commands/cli/helptext.go
+5 -1
@@ -33,6 +33,7 @@ type helpFields struct {
33 Synopsis string
34 Subcommands string
35 Description string
36 + MoreHelp bool
37 }
38
39 // TrimNewlines removes extra newlines from fields. This makes aligning
@@ -105,7 +106,8 @@ SYNOPSIS
106 {{end}}{{if .Description}}
107 {{.Description}}
108 {{end}}
108 -Use '{{.Path}} --help' for more information about this command.
109 +{{if .MoreHelp}}Use '{{.Path}} --help' for more information about this command.
110 +{{end}}
111 `
112
113 var usageTemplate *template.Template
@@ -141,6 +143,7 @@ func LongHelp(rootName string, root *cmds.Command, path []string, out io.Writer)
143 Subcommands: cmd.Helptext.Subcommands,
144 Description: cmd.Helptext.ShortDescription,
145 Usage: cmd.Helptext.Usage,
146 + MoreHelp: (cmd != root),
147 }
148
149 if len(cmd.Helptext.LongDescription) > 0 {
@@ -192,6 +195,7 @@ func ShortHelp(rootName string, root *cmds.Command, path []string, out io.Writer
195 Synopsis: cmd.Helptext.Synopsis,
196 Description: cmd.Helptext.ShortDescription,
197 Usage: cmd.Helptext.Usage,
198 + MoreHelp: (cmd != root),
199 }
200
201 // trim the extra newlines (see TrimNewlines doc)