diff options
| author | Nath Tumlin | 2017-03-10 22:46:28 -0800 |
|---|---|---|
| committer | Nath Tumlin | 2017-03-10 22:46:28 -0800 |
| commit | d305784c37c876d31e15d3baa842f0aa80f2f35f (patch) | |
| tree | 2692ccb492520795bac0e258cc6a196666186cef /Library | |
| parent | 394f9fa0aaa5854aa52bc589708a079665dcf462 (diff) | |
| download | brew-d305784c37c876d31e15d3baa842f0aa80f2f35f.tar.bz2 | |
Added highlighting of installed casks to cask search
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/search.rb | 5 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/utils.rb | 8 |
2 files changed, 11 insertions, 2 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/search.rb b/Library/Homebrew/cask/lib/hbc/cli/search.rb index 3f73fcd2e..a054358db 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/search.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/search.rb @@ -39,7 +39,7 @@ module Hbc end if exact_match ohai "Exact match" - puts exact_match + puts highlight_installed exact_match end return if partial_matches.empty? @@ -49,7 +49,8 @@ module Hbc else ohai "Partial matches" end - puts Formatter.columns(partial_matches) + highlighted = partial_matches.map { |match| highlight_installed match } + puts Formatter.columns(highlighted) end def self.help diff --git a/Library/Homebrew/cask/lib/hbc/utils.rb b/Library/Homebrew/cask/lib/hbc/utils.rb index ef3e5eda3..ef00104f9 100644 --- a/Library/Homebrew/cask/lib/hbc/utils.rb +++ b/Library/Homebrew/cask/lib/hbc/utils.rb @@ -36,6 +36,14 @@ def odebug(title, *sput) puts sput unless sput.empty? end +def highlight_installed(token) + cask = Hbc.load(token) + if cask.installed? + token = pretty_installed token + end + token +end + module Hbc module Utils def self.gain_permissions_remove(path, command: SystemCommand) |
