@cryptotaxi247 / kubo / commits / c827573e3

commands/cli: Helptext spacing fix for root command output

Matt Bell committed Nov 8, 2014 at 03:17 UTC c827573e322fe6d7a049a040a0adac0a05d8b390
1 file changed +4 -1
commands/cli/helptext.go
+4 -1
@@ -120,12 +120,15 @@ func optionText(cmd ...*cmds.Command) []string {
120
121 func subcommandText(cmd *cmds.Command, rootName string, path []string) []string {
122 prefix := fmt.Sprintf("%v %v", rootName, strings.Join(path, " "))
123 + if len(path) > 0 {
124 + prefix += " "
125 + }
126 lines := make([]string, len(cmd.Subcommands))
127
128 i := 0
129 for name, sub := range cmd.Subcommands {
130 usage := usageText(sub)
128 - lines[i] = fmt.Sprintf("%v %v %v", prefix, name, usage)
131 + lines[i] = fmt.Sprintf("%v%v %v", prefix, name, usage)
132 lines[i] += fmt.Sprintf("\n%v", sub.Description)
133 lines[i] = indentString(lines[i], " ") + "\n"
134 i++