add brew where command

This commit is contained in:
Timothee Cour 2017-02-07 23:25:02 -08:00
parent cf18a999f1
commit ae829ed229
5 changed files with 28 additions and 1 deletions

View File

@ -15,7 +15,7 @@ Troubleshooting:
Developers: Developers:
brew create [URL [--no-fetch]] brew create [URL [--no-fetch]]
brew edit [FORMULA...] brew (where|edit) [FORMULA...]
http://docs.brew.sh/Formula-Cookbook.html http://docs.brew.sh/Formula-Cookbook.html
Further help: Further help:

View File

@ -0,0 +1,15 @@
#: * `where` <formulae>:
#: echo location of the specified <formulae> 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

View File

@ -120,6 +120,7 @@ __brew_common_commands() {
'update:fetch latest version of Homebrew and all formulae' 'update:fetch latest version of Homebrew and all formulae'
'upgrade:upgrade outdated formulae' 'upgrade:upgrade outdated formulae'
'uses:show formulae which depend on a formula' 'uses:show formulae which depend on a formula'
'where:location of formulae'
'--cellar:brew cellar' '--cellar:brew cellar'
'--env:brew environment' '--env:brew environment'
'--repository:brew repository' '--repository:brew repository'
@ -793,6 +794,12 @@ _brew_vendor_install() {
'--target' '--target'
} }
# brew where formulae:
_brew_where() {
__brew_formulae
}
# the main completion function # the main completion function
_brew() { _brew() {
local curcontext="$curcontext" state state_descr line expl local curcontext="$curcontext" state state_descr line expl

View File

@ -625,6 +625,7 @@ between tags.</p>
<p>If <code>--keep-tmp</code> is passed, retain the temporary directory containing <p>If <code>--keep-tmp</code> is passed, retain the temporary directory containing
the new repository clone.</p></dd> the new repository clone.</p></dd>
<dt><code>where</code> <var>formulae</var></dt><dd><p>echo location of the specified <var>formulae</var> to stdout</p></dd>
</dl> </dl>

View File

@ -823,6 +823,10 @@ If \fB\-\-to\-tag\fR is passed, set HOMEBREW_UPDATE_TO_TAG to test updating betw
.IP .IP
If \fB\-\-keep\-tmp\fR is passed, retain the temporary directory containing the new repository clone\. 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" .SH "OFFICIAL EXTERNAL COMMANDS"
. .
.TP .TP