update argument handling and syntactical feedback changes

This commit is contained in:
Elizabeth Tackett 2020-08-16 18:45:50 -05:00
parent 3ecb90b987
commit 9cae9f284c
5 changed files with 13 additions and 38 deletions

View File

@ -8,13 +8,11 @@ module Homebrew
def bump_args def bump_args
Homebrew::CLI::Parser.new do Homebrew::CLI::Parser.new do
usage_banner <<~EOS usage_banner <<~EOS
`bump` [<options>] `bump` [<options>] [<formula>]
Display out-of-date brew formulae and the latest version available. Display out-of-date brew formulae and the latest version available.
Also displays whether a pull request has been opened with the URL. Also displays whether a pull request has been opened with the URL.
EOS EOS
flag "--formula=",
description: "Return results for package by name."
flag "--limit=", flag "--limit=",
description: "Limit number of package results returned." description: "Limit number of package results returned."
switch :verbose switch :verbose
@ -25,7 +23,7 @@ module Homebrew
def bump def bump
args = bump_args.parse args = bump_args.parse
requested_formula = args.formula requested_formula = args.formulae.first.to_s
requested_limit = args.limit.to_i if args.limit.present? requested_limit = args.limit.to_i if args.limit.present?
raise FormulaUnavailableError, requested_formula if requested_formula && !validate_formula(requested_formula) raise FormulaUnavailableError, requested_formula if requested_formula && !validate_formula(requested_formula)

View File

@ -11,7 +11,7 @@ describe "brew bump" do
it "returns data for valid specified formula" do it "returns data for valid specified formula" do
install_test_formula "testball" install_test_formula "testball"
expect { brew "bump", "--formula=testball" } expect { brew "bump", "testball" }
.to output.to_stdout .to output.to_stdout
.and not_to_output.to_stderr .and not_to_output.to_stderr
.and be_a_success .and be_a_success

View File

@ -49,6 +49,7 @@ module Repology
end end
puts "#{outdated_packages.size} outdated #{"package".pluralize(outdated_packages.size)} found" puts "#{outdated_packages.size} outdated #{"package".pluralize(outdated_packages.size)} found"
puts
outdated_packages outdated_packages
end end
@ -90,7 +91,7 @@ module Repology
pull_requests = GitHub.fetch_pull_requests(formula_name, tap_full_name, state: "open") pull_requests = GitHub.fetch_pull_requests(formula_name, tap_full_name, state: "open")
if pull_requests.try(:any?) if pull_requests.try(:any?)
pull_requests = pull_requests.map { |pr| "#{pr["title"]} (#{Formatter.url(pr["url"])})" }.join(", ") pull_requests = pull_requests.map { |pr| "#{pr["title"]} (#{Formatter.url(pr["html_url"])})" }.join(", ")
end end
pull_requests = "None" if pull_requests.empty? pull_requests = "None" if pull_requests.empty?

View File

@ -727,13 +727,11 @@ at its original value, while `--no-rebuild` will remove it.
* `--root-url`: * `--root-url`:
Use the specified *`URL`* as the root of the bottle's URL instead of Homebrew's default. Use the specified *`URL`* as the root of the bottle's URL instead of Homebrew's default.
### `bump` [*`options`*] ### `bump` [*`options`*] [*`formula`*]
Display out-of-date brew formulae and the latest version available. Also Display out-of-date brew formulae and the latest version available. Also
displays whether a pull request has been opened with the URL. displays whether a pull request has been opened with the URL.
* `--formula`:
Return results for package by name.
* `--limit`: * `--limit`:
Limit number of package results returned. Limit number of package results returned.
@ -1219,21 +1217,17 @@ flags which will help find keg-only dependencies like `openssl`, `icu4c`, etc.
Read the `Brewfile` from this location. Use `--file=-` to pipe to stdin/stdout. Read the `Brewfile` from this location. Use `--file=-` to pipe to stdin/stdout.
* `--global`: * `--global`:
Read the `Brewfile` from `~/.Brewfile`. Read the `Brewfile` from `~/.Brewfile`.
* `-v`, `--verbose`:
`install` prints output from commands as they are run. `check` lists all missing dependencies.
* `--no-upgrade`: * `--no-upgrade`:
`install` won't run `brew upgrade` on outdated dependencies. Note they may still be upgraded by `brew install` if needed. `install` won't run `brew upgrade` on outdated dependencies. Note they may still be upgraded by `brew install` if needed.
* `-f`, `--force`:
`dump` overwrites an existing `Brewfile`. `cleanup` actually performs its cleanup operations.
* `--no-lock`: * `--no-lock`:
`install` won't output a `Brewfile.lock.json`. `install` won't output a `Brewfile.lock.json`.
* `--all`: * `--all`:
`list` all dependencies. `list` all dependencies.
* `--formula`: * `--brews`:
`list` Homebrew dependencies. `list` Homebrew dependencies.
* `--cask`: * `--casks`:
`list` Homebrew Cask dependencies. `list` Homebrew Cask dependencies.
* `--tap`: * `--taps`:
`list` tap dependencies. `list` tap dependencies.
* `--mas`: * `--mas`:
`list` Mac App Store dependencies. `list` Mac App Store dependencies.
@ -1306,8 +1300,6 @@ and Linux workers.
use the `git` repository of the given tap. Defaults to the core tap for syntax checking. use the `git` repository of the given tap. Defaults to the core tap for syntax checking.
* `--fail-fast`: * `--fail-fast`:
immediately exit on a failing step. immediately exit on a failing step.
* `-v`, `--verbose`:
print test step output in real time. Has the side effect of passing output as raw bytes instead of re-encoding in UTF-8.
* `--test-default-formula`: * `--test-default-formula`:
use a default testing formula when not building a tap and no other formulae are specified. use a default testing formula when not building a tap and no other formulae are specified.
* `--bintray-org`: * `--bintray-org`:

View File

@ -960,14 +960,10 @@ When passed with \fB\-\-write\fR, a new commit will not generated after writing
\fB\-\-root\-url\fR \fB\-\-root\-url\fR
Use the specified \fIURL\fR as the root of the bottle\'s URL instead of Homebrew\'s default\. Use the specified \fIURL\fR as the root of the bottle\'s URL instead of Homebrew\'s default\.
. .
.SS "\fBbump\fR [\fIoptions\fR]" .SS "\fBbump\fR [\fIoptions\fR] [\fIformula\fR]"
Display out\-of\-date brew formulae and the latest version available\. Also displays whether a pull request has been opened with the URL\. Display out\-of\-date brew formulae and the latest version available\. Also displays whether a pull request has been opened with the URL\.
. .
.TP .TP
\fB\-\-formula\fR
Return results for package by name\.
.
.TP
\fB\-\-limit\fR \fB\-\-limit\fR
Limit number of package results returned\. Limit number of package results returned\.
. .
@ -1576,18 +1572,10 @@ Read the \fBBrewfile\fR from this location\. Use \fB\-\-file=\-\fR to pipe to st
Read the \fBBrewfile\fR from \fB~/\.Brewfile\fR\. Read the \fBBrewfile\fR from \fB~/\.Brewfile\fR\.
. .
.TP .TP
\fB\-v\fR, \fB\-\-verbose\fR
\fBinstall\fR prints output from commands as they are run\. \fBcheck\fR lists all missing dependencies\.
.
.TP
\fB\-\-no\-upgrade\fR \fB\-\-no\-upgrade\fR
\fBinstall\fR won\'t run \fBbrew upgrade\fR on outdated dependencies\. Note they may still be upgraded by \fBbrew install\fR if needed\. \fBinstall\fR won\'t run \fBbrew upgrade\fR on outdated dependencies\. Note they may still be upgraded by \fBbrew install\fR if needed\.
. .
.TP .TP
\fB\-f\fR, \fB\-\-force\fR
\fBdump\fR overwrites an existing \fBBrewfile\fR\. \fBcleanup\fR actually performs its cleanup operations\.
.
.TP
\fB\-\-no\-lock\fR \fB\-\-no\-lock\fR
\fBinstall\fR won\'t output a \fBBrewfile\.lock\.json\fR\. \fBinstall\fR won\'t output a \fBBrewfile\.lock\.json\fR\.
. .
@ -1596,15 +1584,15 @@ Read the \fBBrewfile\fR from \fB~/\.Brewfile\fR\.
\fBlist\fR all dependencies\. \fBlist\fR all dependencies\.
. .
.TP .TP
\fB\-\-formula\fR \fB\-\-brews\fR
\fBlist\fR Homebrew dependencies\. \fBlist\fR Homebrew dependencies\.
. .
.TP .TP
\fB\-\-cask\fR \fB\-\-casks\fR
\fBlist\fR Homebrew Cask dependencies\. \fBlist\fR Homebrew Cask dependencies\.
. .
.TP .TP
\fB\-\-tap\fR \fB\-\-taps\fR
\fBlist\fR tap dependencies\. \fBlist\fR tap dependencies\.
. .
.TP .TP
@ -1700,10 +1688,6 @@ use the \fBgit\fR repository of the given tap\. Defaults to the core tap for syn
immediately exit on a failing step\. immediately exit on a failing step\.
. .
.TP .TP
\fB\-v\fR, \fB\-\-verbose\fR
print test step output in real time\. Has the side effect of passing output as raw bytes instead of re\-encoding in UTF\-8\.
.
.TP
\fB\-\-test\-default\-formula\fR \fB\-\-test\-default\-formula\fR
use a default testing formula when not building a tap and no other formulae are specified\. use a default testing formula when not building a tap and no other formulae are specified\.
. .