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
|
usage_banner <<~EOS
|
||||||
`bump` [<options>]
|
`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
|
EOS
|
||||||
flag "--formula=",
|
flag "--formula=",
|
||||||
description: "Return results for package by name."
|
description: "Return results for package by name."
|
||||||
@ -24,9 +25,21 @@ module Homebrew
|
|||||||
def bump
|
def bump
|
||||||
bump_args.parse
|
bump_args.parse
|
||||||
|
|
||||||
outdated_repology_packages = Repology.parse_api_response
|
requested_formula = Homebrew.args.formula
|
||||||
outdated_packages = validate_and_format_packages(outdated_repology_packages)
|
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)
|
display(outdated_packages)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,13 @@ module Repology
|
|||||||
JSON.parse(output)
|
JSON.parse(output)
|
||||||
end
|
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
|
def parse_api_response
|
||||||
ohai "Querying outdated packages from Repology"
|
ohai "Querying outdated packages from Repology"
|
||||||
|
|
||||||
|
|||||||
@ -698,11 +698,13 @@ 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`
|
### `bump` [*`options`*]
|
||||||
|
|
||||||
Display out-of-date brew formulae, the latest version available, and whether a
|
Display out-of-date brew formulae and the latest version available. Also
|
||||||
pull request has been opened.
|
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.
|
||||||
|
|
||||||
|
|||||||
@ -910,8 +910,12 @@ 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"
|
.SS "\fBbump\fR [\fIoptions\fR]"
|
||||||
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\.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
|
\fB\-\-formula\fR
|
||||||
|
Return results for package by name\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
\fB\-\-limit\fR
|
\fB\-\-limit\fR
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user