diff options
| author | Markus Reiter | 2017-02-04 21:52:04 +0100 |
|---|---|---|
| committer | Markus Reiter | 2017-02-05 06:48:23 +0100 |
| commit | b54c3d618e8c2704eb9930776c883f0052ecc9db (patch) | |
| tree | b0a521becf792935724c0d0a58e0e3f0317eb34b | |
| parent | f0337a318320bebe56de1b07b406cd8fbca9c8a5 (diff) | |
| download | brew-b54c3d618e8c2704eb9930776c883f0052ecc9db.tar.bz2 | |
Add `user_tilde` method to shorten/anonymize output.
| -rw-r--r-- | Library/Homebrew/cask/lib/hbc/cli/doctor.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb index 0fa08be8a..7b777abbb 100644 --- a/Library/Homebrew/cask/lib/hbc/cli/doctor.rb +++ b/Library/Homebrew/cask/lib/hbc/cli/doctor.rb @@ -65,10 +65,14 @@ module Hbc def self.render_env_var(var) if ENV.key?(var) var = %Q(#{var}="#{ENV[var]}") - puts var.gsub(ENV["HOME"], "~") + puts user_tilde(var) end end + def self.user_tilde(path) + path.gsub(ENV["HOME"], "~") + end + # This could be done by calling into Homebrew, but the situation # where "doctor" is needed is precisely the situation where such # things are less dependable. @@ -84,7 +88,7 @@ module Hbc end def self.render_staging_location(path) - path = Pathname.new(path) + path = Pathname.new(user_tilde(path.to_s)) if !path.exist? "#{path} #{error_string "error: path does not exist"}}" elsif !path.writable? @@ -95,6 +99,7 @@ module Hbc end def self.render_load_path(paths) + paths.map(&method(:user_tilde)) return "#{none_string} #{error_string}" if [*paths].empty? paths end |
