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 formulae

echo 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 From ac091437e5b2ae8ca21058cf47184f1788c8d697 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Wed, 8 Feb 2017 00:12:50 -0800 Subject: renamed where to formula --- Library/Homebrew/cmd/help.rb | 2 +- Library/Homebrew/dev-cmd/formula.rb | 15 +++++++++++++++ Library/Homebrew/dev-cmd/where.rb | 15 --------------- completions/zsh/_brew | 2 +- docs/brew.1.html | 2 +- manpages/brew.1 | 8 ++++---- 6 files changed, 22 insertions(+), 22 deletions(-) create mode 100644 Library/Homebrew/dev-cmd/formula.rb delete mode 100644 Library/Homebrew/dev-cmd/where.rb diff --git a/Library/Homebrew/cmd/help.rb b/Library/Homebrew/cmd/help.rb index 70379314e..669f92ddd 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 (where|edit) [FORMULA...] + brew (formula|edit) [FORMULA...] http://docs.brew.sh/Formula-Cookbook.html Further help: diff --git a/Library/Homebrew/dev-cmd/formula.rb b/Library/Homebrew/dev-cmd/formula.rb new file mode 100644 index 000000000..80008a354 --- /dev/null +++ b/Library/Homebrew/dev-cmd/formula.rb @@ -0,0 +1,15 @@ +#: * `formula` : +#: echo location of the specified to stdout + +require "formula" + +module Homebrew + module_function + + def formula + raise FormulaUnspecifiedError if ARGV.named.empty? + ARGV.resolved_formulae.each do |f| + puts "#{f.path}\n" + end + end +end diff --git a/Library/Homebrew/dev-cmd/where.rb b/Library/Homebrew/dev-cmd/where.rb deleted file mode 100644 index 63237301b..000000000 --- a/Library/Homebrew/dev-cmd/where.rb +++ /dev/null @@ -1,15 +0,0 @@ -#: * `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 8b1ac2ede..5d3924357 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:location of formulae' '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' @@ -120,7 +121,6 @@ __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' diff --git a/docs/brew.1.html b/docs/brew.1.html index e16b47412..58a1dccca 100644 --- a/docs/brew.1.html +++ b/docs/brew.1.html @@ -537,6 +537,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 formulae

echo location of the specified formulae to stdout

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 @@ -625,7 +626,6 @@ between tags.

If --keep-tmp is passed, retain the temporary directory containing the new repository clone.

-
where formulae

echo location of the specified formulae to stdout

diff --git a/manpages/brew.1 b/manpages/brew.1 index 27a3a6949..7c151eebd 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -728,6 +728,10 @@ Open all of Homebrew for editing\. Open \fIformula\fR in the editor\. . .TP +\fBformula\fR \fIformulae\fR +echo location of the specified \fIformulae\fR to stdout +. +.TP \fBlinkage\fR [\fB\-\-test\fR] [\fB\-\-reverse\fR] \fIformula\-name\fR Checks the library links of an installed formula\. . @@ -823,10 +827,6 @@ 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 From de16dcc1ade56878cae04cf26bdaa465730c28d8 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Wed, 8 Feb 2017 00:27:50 -0800 Subject: brew formula not shown in --help to avoid increasing vertical space --- Library/Homebrew/cmd/help.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/help.rb b/Library/Homebrew/cmd/help.rb index 669f92ddd..1378e7b1f 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 (formula|edit) [FORMULA...] + brew edit [FORMULA...] http://docs.brew.sh/Formula-Cookbook.html Further help: -- cgit v1.2.3 From 0d715f90ea0e9b84231ce2221709f2134ee0ae31 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Sat, 11 Feb 2017 16:37:41 -0800 Subject: applied changes suggested in PR --- Library/Homebrew/dev-cmd/formula.rb | 8 +++----- completions/zsh/_brew | 13 ++++++------- docs/brew.1.html | 2 +- manpages/brew.1 | 4 ++-- 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/Library/Homebrew/dev-cmd/formula.rb b/Library/Homebrew/dev-cmd/formula.rb index 80008a354..71687dfa7 100644 --- a/Library/Homebrew/dev-cmd/formula.rb +++ b/Library/Homebrew/dev-cmd/formula.rb @@ -1,5 +1,5 @@ -#: * `formula` : -#: echo location of the specified to stdout +#: * `formula` : +#: Display the path where is require "formula" @@ -8,8 +8,6 @@ module Homebrew def formula raise FormulaUnspecifiedError if ARGV.named.empty? - ARGV.resolved_formulae.each do |f| - puts "#{f.path}\n" - end + ARGV.resolved_formulae.each { |f| puts f.path } end end diff --git a/completions/zsh/_brew b/completions/zsh/_brew index 5d3924357..04cf56f70 100644 --- a/completions/zsh/_brew +++ b/completions/zsh/_brew @@ -88,7 +88,7 @@ __brew_common_commands() { 'doctor:audits your installation for common issues' 'edit:edit a formula' 'fetch:download formula resources to the cache' - 'formula:location of formulae' + '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' @@ -367,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 \ @@ -794,12 +799,6 @@ _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 58a1dccca..effb16998 100644 --- a/docs/brew.1.html +++ b/docs/brew.1.html @@ -537,7 +537,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 formulae

echo location of the specified formulae to stdout

+
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 7c151eebd..1d435bf62 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -728,8 +728,8 @@ Open all of Homebrew for editing\. Open \fIformula\fR in the editor\. . .TP -\fBformula\fR \fIformulae\fR -echo location of the specified \fIformulae\fR to stdout +\fBformula\fR \fIformula\fR +Display the path where \fIformula\fR is . .TP \fBlinkage\fR [\fB\-\-test\fR] [\fB\-\-reverse\fR] \fIformula\-name\fR -- cgit v1.2.3 From 588f98cf825be855782ec00272f8d7e691d37c69 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Sun, 12 Feb 2017 14:47:05 -0800 Subject: formula:formula_cmd_test --- Library/Homebrew/test/formula_cmd_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 Library/Homebrew/test/formula_cmd_test.rb 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 -- cgit v1.2.3