diff --git a/Library/Homebrew/dev-cmd/formula.rb b/Library/Homebrew/dev-cmd/formula.rb new file mode 100644 index 000000000..71687dfa7 --- /dev/null +++ b/Library/Homebrew/dev-cmd/formula.rb @@ -0,0 +1,13 @@ +#: * `formula` : +#: Display the path where 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 diff --git a/Library/Homebrew/test/formula_cmd_test.rb b/Library/Homebrew/test/formula_cmd_test.rb new file mode 100644 index 000000000..abbe42d98 --- /dev/null +++ b/Library/Homebrew/test/formula_cmd_test.rb @@ -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 diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 9f7b8ebe5..04cf56f70 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -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 \ diff --git a/docs/brew.1.html b/docs/brew.1.html index 6f2d1fb7b..e8b914281 100644 --- a/docs/brew.1.html +++ b/docs/brew.1.html @@ -540,6 +540,7 @@ you to explicitly set the name and version of the package you are creating.

the specified tap.

edit

Open all of Homebrew for editing.

edit formula

Open formula in the editor.

+
formula formula

Display the path where formula is

linkage [--test] [--reverse] formula-name

Checks the library links of an installed formula.

Only works on installed formulae. An error is raised if it is run on diff --git a/manpages/brew.1 b/manpages/brew.1 index 8a9625798..7591cf4ea 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -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\. .