diff options
| author | Martin Afanasjew | 2015-09-21 14:16:11 +0200 |
|---|---|---|
| committer | Mike McQuaid | 2015-10-16 09:12:30 +0100 |
| commit | e4de6907fd3c662c406fd903e2a6562da27d06cc (patch) | |
| tree | 60228516f329e5494b6ab9ded1b3e292b977fe02 /Library/Homebrew/cmd | |
| parent | 7044bf7bbfc085dc29b4d0181a59d94d7e2ffda7 (diff) | |
| download | brew-e4de6907fd3c662c406fd903e2a6562da27d06cc.tar.bz2 | |
tap-info: tweak output for two edge cases
Improve output in the (rare) cases where a tap offers both commands and
formulae or neither. Also adjust code to stay below the 80 column limit.
Closes Homebrew/homebrew#44995.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Homebrew/cmd')
| -rw-r--r-- | Library/Homebrew/cmd/tap-info.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Library/Homebrew/cmd/tap-info.rb b/Library/Homebrew/cmd/tap-info.rb index dc979af7e..80f1d4e38 100644 --- a/Library/Homebrew/cmd/tap-info.rb +++ b/Library/Homebrew/cmd/tap-info.rb @@ -42,11 +42,14 @@ module Homebrew puts unless i == 0 info = "#{tap}: " if tap.installed? - info += tap.pinned? ? "pinned, " : "unpinned, " - formula_count = tap.formula_files.size - info += "#{formula_count} formula#{plural(formula_count, "e")} " if formula_count > 0 - command_count = tap.command_files.size - info += "#{command_count} command#{plural(command_count)} " if command_count > 0 + info += tap.pinned? ? "pinned" : "unpinned" + if (formula_count = tap.formula_files.size) > 0 + info += ", #{formula_count} formula#{plural(formula_count, "e")}" + end + if (command_count = tap.command_files.size) > 0 + info += ", #{command_count} command#{plural(command_count)}" + end + info += ", no formulae/commands" if formula_count + command_count == 0 info += "\n#{tap.path} (#{tap.path.abv})" info += "\nFrom: #{tap.remote.nil? ? "N/A" : tap.remote}" else |
