@cryptotaxi247 / kubo / commits / 81b368090

cmds2: aligned subcmd text

Juan Batiz-Benet committed Nov 13, 2014 at 00:37 UTC 81b3680908e95d7b887250feb72b19a2dd6c2ec6
1 file changed +8 -1
commands/cli/helptext.go
+8 -1
@@ -277,6 +277,7 @@ func subcommandText(cmd *cmds.Command, rootName string, path []string) []string
277 if len(path) > 0 {
278 prefix += " "
279 }
280 + subcmds := make([]*cmds.Command, len(cmd.Subcommands))
281 lines := make([]string, len(cmd.Subcommands))
282
283 i := 0
@@ -285,10 +286,16 @@ func subcommandText(cmd *cmds.Command, rootName string, path []string) []string
286 if len(usage) > 0 {
287 usage = " " + usage
288 }
288 - lines[i] = fmt.Sprintf("%v%v%v - %v", prefix, name, usage, sub.Helptext.Tagline)
289 + lines[i] = prefix + name + usage
290 + subcmds[i] = sub
291 i++
292 }
293
294 + lines = align(lines)
295 + for i, sub := range subcmds {
296 + lines[i] += " - " + sub.Helptext.Tagline
297 + }
298 +
299 return lines
300 }
301