Merge pull request #5837 from EricFromCanada/json-v1-default

outdated & tap-info: set default value for --json
This commit is contained in:
Mike McQuaid 2019-03-05 08:38:22 +00:00 committed by GitHub
commit d9b43928f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 16 deletions

View File

@ -19,15 +19,16 @@ module Homebrew
description: "List only the names of outdated brews (takes precedence over `--verbose`)." description: "List only the names of outdated brews (takes precedence over `--verbose`)."
switch :verbose, switch :verbose,
description: "Display detailed version information." description: "Display detailed version information."
flag "--json=", flag "--json",
description: "Show output in JSON format for provided <version>. Currently the only "\ description: "Print output in JSON format. Currently the default and only accepted "\
"accepted value of <version> is `v1`." "value for <version> is `v1`. See the docs for examples of using the JSON "\
"output: <https://docs.brew.sh/Querying-Brew>"
switch "--fetch-HEAD", switch "--fetch-HEAD",
description: "Fetch the upstream repository to detect if the HEAD installation of the "\ description: "Fetch the upstream repository to detect if the HEAD installation of the "\
"formula is outdated. Otherwise, the repository's HEAD will be checked for "\ "formula is outdated. Otherwise, the repository's HEAD will be checked for "\
"updates when a new stable or development version has been released." "updates when a new stable or development version has been released."
switch :debug switch :debug
conflicts "--quiet", "--verbose", "--json=" conflicts "--quiet", "--verbose", "--json"
end end
end end
@ -39,7 +40,9 @@ module Homebrew
else else
ARGV.resolved_formulae ARGV.resolved_formulae
end end
if args.json == "v1" if args.json
raise UsageError, "invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
outdated = print_outdated_json(formulae) outdated = print_outdated_json(formulae)
else else
outdated = print_outdated(formulae) outdated = print_outdated(formulae)

View File

@ -13,10 +13,10 @@ module Homebrew
EOS EOS
switch "--installed", switch "--installed",
description: "Display information on all installed taps." description: "Display information on all installed taps."
flag "--json=", flag "--json",
description: "Print a JSON representation of <taps>. Currently the only accepted value for "\ description: "Print a JSON representation of <taps>. Currently the default and only accepted "\
"<version> is `v1`. See the docs for examples of using the JSON output: "\ "value for <version> is `v1`. See the docs for examples of using the JSON "\
"<https://docs.brew.sh/Querying-Brew>" "output: <https://docs.brew.sh/Querying-Brew>"
switch :debug switch :debug
end end
end end
@ -32,7 +32,9 @@ module Homebrew
end end
end end
if args.json == "v1" if args.json
raise UsageError, "invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
print_tap_json(taps.sort_by(&:to_s)) print_tap_json(taps.sort_by(&:to_s))
else else
print_tap_info(taps.sort_by(&:to_s)) print_tap_info(taps.sort_by(&:to_s))

View File

@ -339,7 +339,7 @@ By default, version information is displayed in interactive shells, and
suppressed otherwise. suppressed otherwise.
* `--json`: * `--json`:
Show output in JSON format for provided *`version`*. Currently the only accepted value of *`version`* is `v1`. Print output in JSON format. Currently the default and only accepted value for *`version`* is `v1`. See the docs for examples of using the JSON output: <https://docs.brew.sh/Querying-Brew>
* `--fetch-HEAD`: * `--fetch-HEAD`:
Fetch the upstream repository to detect if the HEAD installation of the formula is outdated. Otherwise, the repository's HEAD will be checked for updates when a new stable or development version has been released. Fetch the upstream repository to detect if the HEAD installation of the formula is outdated. Otherwise, the repository's HEAD will be checked for updates when a new stable or development version has been released.
@ -479,7 +479,7 @@ Display a brief summary of all installed taps if no *`tap`* are passed.
* `--installed`: * `--installed`:
Display information on all installed taps. Display information on all installed taps.
* `--json`: * `--json`:
Print a JSON representation of *`taps`*. Currently the only accepted value for *`version`* is `v1`. See the docs for examples of using the JSON output: <https://docs.brew.sh/Querying-Brew> Print a JSON representation of *`taps`*. Currently the default and only accepted value for *`version`* is `v1`. See the docs for examples of using the JSON output: <https://docs.brew.sh/Querying-Brew>
### `tap-pin` *`tap`* ### `tap-pin` *`tap`*

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BREW\-CASK" "1" "February 2019" "Homebrew" "brew-cask" .TH "BREW\-CASK" "1" "March 2019" "Homebrew" "brew-cask"
. .
.SH "NAME" .SH "NAME"
\fBbrew\-cask\fR \- a friendly binary installer for macOS \fBbrew\-cask\fR \- a friendly binary installer for macOS

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BREW" "1" "February 2019" "Homebrew" "brew" .TH "BREW" "1" "March 2019" "Homebrew" "brew"
. .
.SH "NAME" .SH "NAME"
\fBbrew\fR \- The missing package manager for macOS \fBbrew\fR \- The missing package manager for macOS
@ -438,7 +438,7 @@ By default, version information is displayed in interactive shells, and suppress
. .
.TP .TP
\fB\-\-json\fR \fB\-\-json\fR
Show output in JSON format for provided \fIversion\fR\. Currently the only accepted value of \fIversion\fR is \fBv1\fR\. Print output in JSON format\. Currently the default and only accepted value for \fIversion\fR is \fBv1\fR\. See the docs for examples of using the JSON output: \fIhttps://docs\.brew\.sh/Querying\-Brew\fR
. .
.TP .TP
\fB\-\-fetch\-HEAD\fR \fB\-\-fetch\-HEAD\fR
@ -603,7 +603,7 @@ Display information on all installed taps\.
. .
.TP .TP
\fB\-\-json\fR \fB\-\-json\fR
Print a JSON representation of \fItaps\fR\. Currently the only accepted value for \fIversion\fR is \fBv1\fR\. See the docs for examples of using the JSON output: \fIhttps://docs\.brew\.sh/Querying\-Brew\fR Print a JSON representation of \fItaps\fR\. Currently the default and only accepted value for \fIversion\fR is \fBv1\fR\. See the docs for examples of using the JSON output: \fIhttps://docs\.brew\.sh/Querying\-Brew\fR
. .
.SS "\fBtap\-pin\fR \fItap\fR" .SS "\fBtap\-pin\fR \fItap\fR"
Pin \fItap\fR, prioritising its formulae over core when formula names are supplied by the user\. See also \fBtap\-unpin\fR\. Pin \fItap\fR, prioritising its formulae over core when formula names are supplied by the user\. See also \fBtap\-unpin\fR\.