@cryptotaxi247 / kubo / commits / 8aa532fbc

commands/cli: Less line breaks in autogenerated formatting

Matt Bell committed Nov 12, 2014 at 02:10 UTC 8aa532fbc9b4a513007102cb999acad5490aa7ad
1 file changed +8 -9
commands/cli/helptext.go
+8 -9
@@ -196,9 +196,8 @@ func argumentText(cmd *cmds.Command) []string {
196 lines := make([]string, len(cmd.Arguments))
197
198 for i, arg := range cmd.Arguments {
199 - lines[i] = argUsageText(arg)
200 - lines[i] += "\n" + arg.Description
201 - lines[i] = indentString(lines[i], " ") + "\n"
199 + lines[i] = argUsageText(arg) + " - " + arg.Description
200 + lines[i] = indentString(lines[i], " ")
201 }
202
203 return lines
@@ -241,17 +240,18 @@ func optionText(cmd ...*cmds.Command) []string {
240 lines = align(lines)
241 j++
242 }
243 + lines = align(lines)
244
245 // add option types to output
246 for i, opt := range options {
247 - lines[i] += " " + fmt.Sprintf(optionType, opt.Type)
247 + lines[i] += " " + fmt.Sprintf("%v", opt.Type)
248 }
249 lines = align(lines)
250
251 // add option descriptions to output
252 for i, opt := range options {
253 - lines[i] += "\n" + opt.Description
254 - lines[i] = indentString(lines[i], " ") + "\n"
253 + lines[i] += " - " + opt.Description
254 + lines[i] = indentString(lines[i], " ")
255 }
256
257 return lines
@@ -267,9 +267,8 @@ func subcommandText(cmd *cmds.Command, rootName string, path []string) []string
267 i := 0
268 for name, sub := range cmd.Subcommands {
269 usage := usageText(sub)
270 - lines[i] = fmt.Sprintf("%v%v %v", prefix, name, usage)
271 - lines[i] += fmt.Sprintf("\n%v", sub.Description)
272 - lines[i] = indentString(lines[i], " ") + "\n"
270 + lines[i] = fmt.Sprintf("%v%v %v - %v", prefix, name, usage, sub.Description)
271 + lines[i] = indentString(lines[i], " ")
272 i++
273 }
274