mirror of
https://github.com/ipfs/kubo.git
synced 2026-03-06 00:38:08 +08:00
cmds2: aligned subcmd text
This commit is contained in:
parent
2a2ec747d5
commit
81b3680908
@ -277,6 +277,7 @@ func subcommandText(cmd *cmds.Command, rootName string, path []string) []string
|
||||
if len(path) > 0 {
|
||||
prefix += " "
|
||||
}
|
||||
subcmds := make([]*cmds.Command, len(cmd.Subcommands))
|
||||
lines := make([]string, len(cmd.Subcommands))
|
||||
|
||||
i := 0
|
||||
@ -285,10 +286,16 @@ func subcommandText(cmd *cmds.Command, rootName string, path []string) []string
|
||||
if len(usage) > 0 {
|
||||
usage = " " + usage
|
||||
}
|
||||
lines[i] = fmt.Sprintf("%v%v%v - %v", prefix, name, usage, sub.Helptext.Tagline)
|
||||
lines[i] = prefix + name + usage
|
||||
subcmds[i] = sub
|
||||
i++
|
||||
}
|
||||
|
||||
lines = align(lines)
|
||||
for i, sub := range subcmds {
|
||||
lines[i] += " - " + sub.Helptext.Tagline
|
||||
}
|
||||
|
||||
return lines
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user