@@ -180,7 +180,7 @@ func LongHelp(rootName string, root *cmds.Command, path []string, out io.Writer)
180
180
fields .Options = strings .Join (optionText (width , cmd ), "\n " )
181
181
}
182
182
if len (fields .Subcommands ) == 0 {
183
- fields .Subcommands = strings .Join (subcommandText (cmd , rootName , path ), "\n " )
183
+ fields .Subcommands = strings .Join (subcommandText (width , cmd , rootName , path ), "\n " )
184
184
}
185
185
if len (fields .Synopsis ) == 0 {
186
186
fields .Synopsis = generateSynopsis (width , cmd , pathStr )
@@ -228,7 +228,7 @@ func ShortHelp(rootName string, root *cmds.Command, path []string, out io.Writer
228
228
229
229
// autogen fields that are empty
230
230
if len (fields .Subcommands ) == 0 {
231
- fields .Subcommands = strings .Join (subcommandText (cmd , rootName , path ), "\n " )
231
+ fields .Subcommands = strings .Join (subcommandText (width , cmd , rootName , path ), "\n " )
232
232
}
233
233
if len (fields .Synopsis ) == 0 {
234
234
fields .Synopsis = generateSynopsis (width , cmd , pathStr )
@@ -385,7 +385,7 @@ func optionText(width int, cmd ...*cmds.Command) []string {
385
385
return lines
386
386
}
387
387
388
- func subcommandText (cmd * cmds.Command , rootName string , path []string ) []string {
388
+ func subcommandText (width int , cmd * cmds.Command , rootName string , path []string ) []string {
389
389
prefix := fmt .Sprintf ("%v %v" , rootName , strings .Join (path , " " ))
390
390
if len (path ) > 0 {
391
391
prefix += " "
@@ -414,7 +414,8 @@ func subcommandText(cmd *cmds.Command, rootName string, path []string) []string
414
414
415
415
lines = align (lines )
416
416
for i , sub := range subcmds {
417
- lines [i ] += " - " + sub .Helptext .Tagline
417
+ lines [i ] += " - "
418
+ lines [i ] = appendWrapped (lines [i ], sub .Helptext .Tagline , width )
418
419
}
419
420
420
421
return lines
0 commit comments