main: A slightly more compact presentation of the main help text

This just reduces the amount of space between different elements on in the
main help output from four columns to two. The main motivation here was
to give some of the longer command descriptions a little more horizontal
breathing room, but subjectively I also find the tighter column gutters
easier to scan. Others may disagree, of course.
This commit is contained in:
Martin Atkins 2020-10-23 16:59:29 -07:00
parent c94a6102df
commit 248cf7f13a
1 changed files with 5 additions and 6 deletions

11
help.go
View File

@ -55,11 +55,10 @@ Main commands:
All other commands: All other commands:
%s %s
Global options (use these before the subcommand, if any): Global options (use these before the subcommand, if any):
-chdir=DIR Switch to a different working directory before executing -chdir=DIR Switch to a different working directory before executing the
the given subcommand. given subcommand.
-help Show this help output, or the help for a specified -help Show this help output, or the help for a specified subcommand.
subcommand. -version An alias for the "version" subcommand.
-version An alias for the "version" subcommand.
`, listCommands(commands, PrimaryCommands, maxKeyLen), listCommands(commands, otherCommands, maxKeyLen)) `, listCommands(commands, PrimaryCommands, maxKeyLen), listCommands(commands, otherCommands, maxKeyLen))
return strings.TrimSpace(helpText) return strings.TrimSpace(helpText)
@ -88,7 +87,7 @@ func listCommands(allCommands map[string]cli.CommandFactory, order []string, max
} }
key = fmt.Sprintf("%s%s", key, strings.Repeat(" ", maxKeyLen-len(key))) key = fmt.Sprintf("%s%s", key, strings.Repeat(" ", maxKeyLen-len(key)))
buf.WriteString(fmt.Sprintf(" %s %s\n", key, command.Synopsis())) buf.WriteString(fmt.Sprintf(" %s %s\n", key, command.Synopsis()))
} }
return buf.String() return buf.String()