From 18925df4483ccf5c48dfb4314f85c1b37a1cbe81 Mon Sep 17 00:00:00 2001 From: Joseph Richey Date: Wed, 18 Oct 2017 03:38:57 -0700 Subject: Fscrypt usage is good and dos endings fixed --- cmd/format.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'cmd/format.go') 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 -- cgit v1.2.3