diff options
| author | Joseph Richey <joerichey94@gmail.com> | 2017-10-18 03:38:57 -0700 |
|---|---|---|
| committer | Joseph Richey <joerichey94@gmail.com> | 2017-10-19 02:22:28 -0700 |
| commit | 18925df4483ccf5c48dfb4314f85c1b37a1cbe81 (patch) | |
| tree | b40566fa443054fd3f593b2b8e64bc6cdf7a3a90 /cmd/format.go | |
| parent | 7847ab8270efab472b7b6a4bf9a57f5b83cb7212 (diff) | |
Fscrypt usage is good and dos endings fixed
Diffstat (limited to 'cmd/format.go')
| -rw-r--r-- | cmd/format.go | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/cmd/format.go b/cmd/format.go index 993b955..2953529 100644 --- a/cmd/format.go +++ b/cmd/format.go @@ -66,8 +66,8 @@ func init() { } } -// MaxSubcommandLength returns the length of the longest subcommand (where the -// length of the command is Name + Title). Return 0 if there aren't subcommands. +// MaxNameLength returns the length of the longest subcommand Name. Return 0 if +// there aren't subcommands. func (c *Command) MaxNameLength() (max int) { for _, s := range c.SubCommands { max = util.MaxInt(max, len(s.Name)) @@ -75,6 +75,15 @@ func (c *Command) MaxNameLength() (max int) { return } +// MaxTitleLength returns the length of the longest subcommand Title. Return 0 +// if there aren't subcommands. +func (c *Command) MaxTitleLength() (max int) { + for _, s := range c.SubCommands { + max = util.MaxInt(max, len(s.Title)) + } + return +} + // WrapText wraps an input string so that each line begins with numTabs tabs // (except the first line) and ends with a newline (except the last line), and // each line has length less than lineLength. If the text contains a word which |