Fix spacing on subcommand names
This commit is contained in:
parent
26bee58adc
commit
b4759d5f08
5
help.go
5
help.go
|
@ -2,6 +2,7 @@ package cmd
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"go.fifitido.net/cmd/opt"
|
||||
)
|
||||
|
@ -43,8 +44,10 @@ func (c *Command) ShowHelp() {
|
|||
fmt.Println("Available subcommands:")
|
||||
}
|
||||
|
||||
paddedWidth := c.Subcommands.MaxWidth()
|
||||
for _, s := range c.Subcommands {
|
||||
fmt.Println(" " + s.Name + " " + s.ShortDescription)
|
||||
spaceSize := 2 + paddedWidth - len(s.Name)
|
||||
fmt.Println(" " + s.Name + strings.Repeat(" ", spaceSize) + s.ShortDescription)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue