@cryptotaxi247 / kubo / commits / c0b3b4377

cmds2/helptext moved indent + tagline in subcmd

Juan Batiz-Benet committed Nov 12, 2014 at 03:21 UTC c0b3b4377394c0feef2d1bb078de6f3d1b9b2f43
1 file changed +5 -4
commands/cli/helptext.go
+5 -4
@@ -242,7 +242,6 @@ func argumentText(cmd *cmds.Command) []string {
242
243 for i, arg := range cmd.Arguments {
244 lines[i] = argUsageText(arg) + " - " + arg.Description
245 - lines[i] = indentString(lines[i], " ")
245 }
246
247 return lines
@@ -296,7 +295,6 @@ func optionText(cmd ...*cmds.Command) []string {
295 // add option descriptions to output
296 for i, opt := range options {
297 lines[i] += " - " + opt.Description
299 - lines[i] = indentString(lines[i], " ")
298 }
299
300 return lines
@@ -315,8 +313,11 @@ func subcommandText(cmd *cmds.Command, rootName string, path []string) []string
313 if len(usage) > 0 {
314 usage = " " + usage
315 }
318 - lines[i] = fmt.Sprintf("%v%v%v - %v", prefix, name, usage, sub.Description)
319 - lines[i] = indentString(lines[i], " ")
316 + if len(sub.Helptext.Tagline) > 0 {
317 + lines[i] = fmt.Sprintf("%v%v%v - %v", prefix, name, usage, sub.Helptext.Tagline)
318 + } else {
319 + lines[i] = fmt.Sprintf("%v%v%v - %v", prefix, name, usage, sub.Description)
320 + }
321 i++
322 }
323