diff options
| author | Markus Reiter | 2016-10-02 05:36:50 +0200 |
|---|---|---|
| committer | GitHub | 2016-10-02 05:36:50 +0200 |
| commit | 8b06a01e5b94fec9876a4fdfea1177496a0b7c93 (patch) | |
| tree | 90ed60f4960de7642276534e568419f7d61d7c86 /Library/Homebrew/cask/lib/hbc/cli | |
| parent | fa14c262454c2678ca9c8a1caa2f0080833ac67a (diff) | |
| parent | 1eab17235ca80c86850d1079ccb255b076d4b557 (diff) | |
| download | brew-8b06a01e5b94fec9876a4fdfea1177496a0b7c93.tar.bz2 | |
Merge pull request #823 from reitermarkus/refactoring-tty
Refactor Tty.
Diffstat (limited to 'Library/Homebrew/cask/lib/hbc/cli')
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/doctor.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/info.rb | 10 | ||||
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/style.rb | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb index 34f000b29..e36999200 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb @@ -122,11 +122,11 @@ module Hbc end def self.notfound_string - "#{Tty.red}Not Found - Unknown Error#{Tty.reset}" + Formatter.error("Not Found - Unknown Error") end def self.error_string(string = "Error") - "#{Tty.red}(#{string})#{Tty.reset}" + Formatter.error("(#{string})") end def self.render_with_none(string) diff --git a/Library/Homebrew/cask/lib/hbc/cli/info.rb b/Library/Homebrew/cask/lib/hbc/cli/info.rb index 7fbdff3eb..0957ba4fd 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/info.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/info.rb @@ -18,16 +18,16 @@ module Hbc def self.info(cask) puts "#{cask.token}: #{cask.version}" - puts formatted_url(cask.homepage) if cask.homepage + puts Formatter.url(cask.homepage) if cask.homepage installation_info(cask) - puts "From: #{formatted_url(github_info(cask))}" if github_info(cask) + puts "From: #{Formatter.url(github_info(cask))}" if github_info(cask) name_info(cask) artifact_info(cask) Installer.print_caveats(cask) end def self.formatted_url(url) - "#{Tty.em}#{url}#{Tty.reset}" + "#{Tty.underline}#{url}#{Tty.reset}" end def self.installation_info(cask) @@ -37,7 +37,7 @@ module Hbc puts versioned_staged_path.to_s .concat(" (") - .concat(versioned_staged_path.exist? ? versioned_staged_path.abv : "#{Tty.red}does not exist#{Tty.reset}") + .concat(versioned_staged_path.exist? ? versioned_staged_path.abv : Formatter.error("does not exist")) .concat(")") end else @@ -47,7 +47,7 @@ module Hbc def self.name_info(cask) ohai cask.name.size > 1 ? "Names" : "Name" - puts cask.name.empty? ? "#{Tty.red}None#{Tty.reset}" : cask.name + puts cask.name.empty? ? Formatter.error("None") : cask.name end def self.github_info(cask) diff --git a/Library/Homebrew/cask/lib/hbc/cli/style.rb b/Library/Homebrew/cask/lib/hbc/cli/style.rb index 66117da8b..bb179fb0c 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/style.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/style.rb @@ -30,7 +30,7 @@ module Hbc begin Homebrew.install_gem_setup_path! "rubocop-cask", RUBOCOP_CASK_VERSION, "rubocop" rescue SystemExit - raise CaskError, $stderr.string.chomp.sub("#{Tty.red}Error#{Tty.reset}: ", "") + raise CaskError, Tty.strip_ansi($stderr.string).chomp.sub(/\AError: /, "") end end end |
