aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorMarkus Reiter2016-10-02 05:36:50 +0200
committerGitHub2016-10-02 05:36:50 +0200
commit8b06a01e5b94fec9876a4fdfea1177496a0b7c93 (patch)
tree90ed60f4960de7642276534e568419f7d61d7c86 /Library/Homebrew/cmd
parentfa14c262454c2678ca9c8a1caa2f0080833ac67a (diff)
parent1eab17235ca80c86850d1079ccb255b076d4b557 (diff)
downloadbrew-8b06a01e5b94fec9876a4fdfea1177496a0b7c93.tar.bz2
Merge pull request #823 from reitermarkus/refactoring-tty
Refactor Tty.
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/doctor.rb6
-rw-r--r--Library/Homebrew/cmd/help.rb7
-rw-r--r--Library/Homebrew/cmd/info.rb4
-rw-r--r--Library/Homebrew/cmd/update-report.rb4
4 files changed, 11 insertions, 10 deletions
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb
index 89f32dc25..0fcd3a74d 100644
--- a/Library/Homebrew/cmd/doctor.rb
+++ b/Library/Homebrew/cmd/doctor.rb
@@ -42,9 +42,9 @@ module Homebrew
next if out.nil? || out.empty?
if first_warning
$stderr.puts <<-EOS.undent
- #{Tty.white}Please note that these warnings are just used to help the Homebrew maintainers
- with debugging if you file an issue. If everything you use Homebrew for is
- working fine: please don't worry and just ignore them. Thanks!#{Tty.reset}
+ #{Tty.bold}Please note that these warnings are just used to help the Homebrew maintainers
+ with debugging if you file an issue. If everything you use Homebrew for is
+ working fine: please don't worry and just ignore them. Thanks!#{Tty.reset}
EOS
end
diff --git a/Library/Homebrew/cmd/help.rb b/Library/Homebrew/cmd/help.rb
index 2a814b90b..c8845b086 100644
--- a/Library/Homebrew/cmd/help.rb
+++ b/Library/Homebrew/cmd/help.rb
@@ -79,9 +79,10 @@ module Homebrew
else
help_lines.map do |line|
line.slice(2..-1)
- .sub(/^ \* /, "#{Tty.highlight}brew#{Tty.reset} ")
- .gsub(/`(.*?)`/, "#{Tty.highlight}\\1#{Tty.reset}")
- .gsub(/<(.*?)>/, "#{Tty.em}\\1#{Tty.reset}")
+ .sub(/^ \* /, "#{Tty.bold}brew#{Tty.reset} ")
+ .gsub(/`(.*?)`/, "#{Tty.bold}\\1#{Tty.reset}")
+ .gsub(%r{<([^\s]+?://[^\s]+?)>}) { |url| Formatter.url(url) }
+ .gsub(/<(.*?)>/, "#{Tty.underline}\\1#{Tty.reset}")
.gsub("@hide_from_man_page", "")
end.join.strip
end
diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb
index 6f242039c..2cfb89ea5 100644
--- a/Library/Homebrew/cmd/info.rb
+++ b/Library/Homebrew/cmd/info.rb
@@ -117,7 +117,7 @@ module Homebrew
puts "#{f.full_name}: #{specs * ", "}#{" [#{attrs * ", "}]" unless attrs.empty?}"
puts f.desc if f.desc
- puts "#{Tty.em}#{f.homepage}#{Tty.reset}" if f.homepage
+ puts Formatter.url(f.homepage) if f.homepage
conflicts = f.conflicts.map(&:name).sort!
puts "Conflicts with: #{conflicts*", "}" unless conflicts.empty?
@@ -133,7 +133,7 @@ module Homebrew
end
end
- puts "From: #{Tty.em}#{github_info(f)}#{Tty.reset}"
+ puts "From: #{Formatter.url(github_info(f))}"
unless f.deps.empty?
ohai "Dependencies"
diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb
index 18f2f370c..f97191bda 100644
--- a/Library/Homebrew/cmd/update-report.rb
+++ b/Library/Homebrew/cmd/update-report.rb
@@ -282,13 +282,13 @@ module Homebrew
EOS
rescue => e
ofail <<-EOS.undent
- #{Tty.white}Failed to migrate HOMEBREW_REPOSITORY to #{new_homebrew_repository}!
+ #{Tty.bold}Failed to migrate HOMEBREW_REPOSITORY to #{new_homebrew_repository}!#{Tty.reset}
The error was:
#{e}
Please try to resolve this error yourself and then run `brew update` again to
complete the migration. If you need help please +1 an existing error or comment
with your new error in issue:
- #{Tty.em}https://github.com/Homebrew/brew/issues/987#{Tty.reset}
+ #{Formatter.url("https://github.com/Homebrew/brew/issues/987")}
EOS
$stderr.puts e.backtrace
end