aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/utils.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index e46926063..c08887740 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -138,6 +138,15 @@ def puts_columns items, star_items=[]
end
end
+def which cmd
+ path = `/usr/bin/which #{cmd}`.chomp
+ if path.empty?
+ nil
+ else
+ Pathname.new(path)
+ end
+end
+
def which_editor
editor = ENV['HOMEBREW_EDITOR'] || ENV['EDITOR']
# If an editor wasn't set, try to pick a sane default