Merge pull request #1972 from timotheecour/pr_brew_where_command
add `brew formula` command to show location of a formula
This commit is contained in:
commit
7281cfaf63
13
Library/Homebrew/dev-cmd/formula.rb
Normal file
13
Library/Homebrew/dev-cmd/formula.rb
Normal file
@ -0,0 +1,13 @@
|
||||
#: * `formula` <formula>:
|
||||
#: Display the path where <formula> is
|
||||
|
||||
require "formula"
|
||||
|
||||
module Homebrew
|
||||
module_function
|
||||
|
||||
def formula
|
||||
raise FormulaUnspecifiedError if ARGV.named.empty?
|
||||
ARGV.resolved_formulae.each { |f| puts f.path }
|
||||
end
|
||||
end
|
||||
8
Library/Homebrew/test/formula_cmd_test.rb
Normal file
8
Library/Homebrew/test/formula_cmd_test.rb
Normal file
@ -0,0 +1,8 @@
|
||||
require "testing_env"
|
||||
|
||||
class IntegrationCommandTestFormula < IntegrationCommandTestCase
|
||||
def test_formula
|
||||
formula_file = setup_test_formula "testball"
|
||||
assert_equal formula_file.to_s, cmd("formula", "testball")
|
||||
end
|
||||
end
|
||||
@ -88,6 +88,7 @@ __brew_common_commands() {
|
||||
'doctor:audits your installation for common issues'
|
||||
'edit:edit a formula'
|
||||
'fetch:download formula resources to the cache'
|
||||
'formula:the path for a formula'
|
||||
'gist-logs:generate a gist of the full build logs'
|
||||
'home:visit the homepage of a formula or the brew project'
|
||||
'info:information about a formula'
|
||||
@ -366,6 +367,11 @@ _brew_fetch() {
|
||||
'*:formula:__brew_formulae'
|
||||
}
|
||||
|
||||
# brew formula formula:
|
||||
_brew_formula() {
|
||||
__brew_formulae
|
||||
}
|
||||
|
||||
# brew gist-logs [--new-issue|-n] formula
|
||||
_brew_gist_logs() {
|
||||
_arguments \
|
||||
|
||||
@ -540,6 +540,7 @@ you to explicitly set the name and version of the package you are creating.</p>
|
||||
the specified tap.</p></dd>
|
||||
<dt class="flush"><code>edit</code></dt><dd><p>Open all of Homebrew for editing.</p></dd>
|
||||
<dt><code>edit</code> <var>formula</var></dt><dd><p>Open <var>formula</var> in the editor.</p></dd>
|
||||
<dt><code>formula</code> <var>formula</var></dt><dd><p>Display the path where <var>formula</var> is</p></dd>
|
||||
<dt><code>linkage</code> [<code>--test</code>] [<code>--reverse</code>] <var>formula-name</var></dt><dd><p>Checks the library links of an installed formula.</p>
|
||||
|
||||
<p>Only works on installed formulae. An error is raised if it is run on
|
||||
|
||||
@ -731,6 +731,10 @@ Open all of Homebrew for editing\.
|
||||
Open \fIformula\fR in the editor\.
|
||||
.
|
||||
.TP
|
||||
\fBformula\fR \fIformula\fR
|
||||
Display the path where \fIformula\fR is
|
||||
.
|
||||
.TP
|
||||
\fBlinkage\fR [\fB\-\-test\fR] [\fB\-\-reverse\fR] \fIformula\-name\fR
|
||||
Checks the library links of an installed formula\.
|
||||
.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user