add --formula flag to allow user specific queries
This commit is contained in:
parent
c52653adb8
commit
1d328eb7e5
@ -10,7 +10,8 @@ module Homebrew
|
||||
usage_banner <<~EOS
|
||||
`bump` [<options>]
|
||||
|
||||
Display out-of-date brew formulae, the latest version available, and whether a pull request has been opened.
|
||||
Display out-of-date brew formulae and the latest version available.
|
||||
Also displays whether a pull request has been opened with the URL.
|
||||
EOS
|
||||
flag "--formula=",
|
||||
description: "Return results for package by name."
|
||||
@ -24,9 +25,21 @@ module Homebrew
|
||||
def bump
|
||||
bump_args.parse
|
||||
|
||||
outdated_repology_packages = Repology.parse_api_response
|
||||
outdated_packages = validate_and_format_packages(outdated_repology_packages)
|
||||
requested_formula = Homebrew.args.formula
|
||||
requested_formula.downcase! if requested_formula
|
||||
|
||||
if requested_formula && !get_formula_details(requested_formula)
|
||||
ohai "Requested formula #{requested_formula} is not valid Homebrew formula."
|
||||
return
|
||||
end
|
||||
|
||||
outdated_repology_packages = if requested_formula
|
||||
Repology.single_package_query(requested_formula)
|
||||
else
|
||||
Repology.parse_api_response
|
||||
end
|
||||
|
||||
outdated_packages = validate_and_format_packages(outdated_repology_packages)
|
||||
display(outdated_packages)
|
||||
end
|
||||
|
||||
|
||||
@ -15,6 +15,13 @@ module Repology
|
||||
JSON.parse(output)
|
||||
end
|
||||
|
||||
def single_package_query(name)
|
||||
url = "https://repology.org/api/v1/project/#{name}"
|
||||
|
||||
output, _errors, _status = curl_output(url.to_s)
|
||||
{ name: JSON.parse(output) }
|
||||
end
|
||||
|
||||
def parse_api_response
|
||||
ohai "Querying outdated packages from Repology"
|
||||
|
||||
|
||||
@ -698,11 +698,13 @@ at its original value, while `--no-rebuild` will remove it.
|
||||
* `--root-url`:
|
||||
Use the specified *`URL`* as the root of the bottle's URL instead of Homebrew's default.
|
||||
|
||||
### `bump`
|
||||
### `bump` [*`options`*]
|
||||
|
||||
Display out-of-date brew formulae, the latest version available, and whether a
|
||||
pull request has been opened.
|
||||
Display out-of-date brew formulae and the latest version available. Also
|
||||
displays whether a pull request has been opened with the URL.
|
||||
|
||||
* `--formula`:
|
||||
Return results for package by name.
|
||||
* `--limit`:
|
||||
Limit number of package results returned.
|
||||
|
||||
|
||||
@ -910,8 +910,12 @@ When passed with \fB\-\-write\fR, a new commit will not generated after writing
|
||||
\fB\-\-root\-url\fR
|
||||
Use the specified \fIURL\fR as the root of the bottle\'s URL instead of Homebrew\'s default\.
|
||||
.
|
||||
.SS "\fBbump\fR"
|
||||
Display out\-of\-date brew formulae, the latest version available, and whether a pull request has been opened\.
|
||||
.SS "\fBbump\fR [\fIoptions\fR]"
|
||||
Display out\-of\-date brew formulae and the latest version available\. Also displays whether a pull request has been opened with the URL\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-formula\fR
|
||||
Return results for package by name\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-limit\fR
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user