From ae829ed229395159adf6f1f17fb26518ec27fca6 Mon Sep 17 00:00:00 2001
From: Timothee Cour
Date: Tue, 7 Feb 2017 23:25:02 -0800
Subject: add brew where command
---
Library/Homebrew/cmd/help.rb | 2 +-
Library/Homebrew/dev-cmd/where.rb | 15 +++++++++++++++
completions/zsh/_brew | 7 +++++++
docs/brew.1.html | 1 +
manpages/brew.1 | 4 ++++
5 files changed, 28 insertions(+), 1 deletion(-)
create mode 100644 Library/Homebrew/dev-cmd/where.rb
diff --git a/Library/Homebrew/cmd/help.rb b/Library/Homebrew/cmd/help.rb
index 1378e7b1f..70379314e 100644
--- a/Library/Homebrew/cmd/help.rb
+++ b/Library/Homebrew/cmd/help.rb
@@ -15,7 +15,7 @@ Troubleshooting:
Developers:
brew create [URL [--no-fetch]]
- brew edit [FORMULA...]
+ brew (where|edit) [FORMULA...]
http://docs.brew.sh/Formula-Cookbook.html
Further help:
diff --git a/Library/Homebrew/dev-cmd/where.rb b/Library/Homebrew/dev-cmd/where.rb
new file mode 100644
index 000000000..63237301b
--- /dev/null
+++ b/Library/Homebrew/dev-cmd/where.rb
@@ -0,0 +1,15 @@
+#: * `where` :
+#: echo location of the specified to stdout
+
+require "formula"
+
+module Homebrew
+ module_function
+
+ def where
+ raise FormulaUnspecifiedError if ARGV.named.empty?
+ ARGV.resolved_formulae.each do |f|
+ puts "#{f.path}\n"
+ end
+ end
+end
diff --git a/completions/zsh/_brew b/completions/zsh/_brew
index 9f7b8ebe5..8b1ac2ede 100644
--- a/completions/zsh/_brew
+++ b/completions/zsh/_brew
@@ -120,6 +120,7 @@ __brew_common_commands() {
'update:fetch latest version of Homebrew and all formulae'
'upgrade:upgrade outdated formulae'
'uses:show formulae which depend on a formula'
+ 'where:location of formulae'
'--cellar:brew cellar'
'--env:brew environment'
'--repository:brew repository'
@@ -793,6 +794,12 @@ _brew_vendor_install() {
'--target'
}
+
+# brew where formulae:
+_brew_where() {
+ __brew_formulae
+}
+
# the main completion function
_brew() {
local curcontext="$curcontext" state state_descr line expl
diff --git a/docs/brew.1.html b/docs/brew.1.html
index c8f6f2b68..e16b47412 100644
--- a/docs/brew.1.html
+++ b/docs/brew.1.html
@@ -625,6 +625,7 @@ between tags.
If --keep-tmp is passed, retain the temporary directory containing
the new repository clone.
+where formulaeecho location of the specified formulae to stdout
diff --git a/manpages/brew.1 b/manpages/brew.1
index dd3c19c3b..27a3a6949 100644
--- a/manpages/brew.1
+++ b/manpages/brew.1
@@ -823,6 +823,10 @@ If \fB\-\-to\-tag\fR is passed, set HOMEBREW_UPDATE_TO_TAG to test updating betw
.IP
If \fB\-\-keep\-tmp\fR is passed, retain the temporary directory containing the new repository clone\.
.
+.TP
+\fBwhere\fR \fIformulae\fR
+echo location of the specified \fIformulae\fR to stdout
+.
.SH "OFFICIAL EXTERNAL COMMANDS"
.
.TP
--
cgit v1.2.3