Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

outdated & tap-info: set default value for --json #5837

Merged
merged 1 commit into from
Mar 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 8 additions & 5 deletions Library/Homebrew/cmd/outdated.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@ def outdated_args
description: "List only the names of outdated brews (takes precedence over `--verbose`)."
switch :verbose,
description: "Display detailed version information."
flag "--json=",
description: "Show output in JSON format for provided <version>. Currently the only "\
"accepted value of <version> is `v1`."
flag "--json",
description: "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>"
switch "--fetch-HEAD",
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 "\
"updates when a new stable or development version has been released."
switch :debug
conflicts "--quiet", "--verbose", "--json="
conflicts "--quiet", "--verbose", "--json"
end
end

Expand All @@ -39,7 +40,9 @@ def outdated
else
ARGV.resolved_formulae
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)
else
outdated = print_outdated(formulae)
Expand Down
12 changes: 7 additions & 5 deletions Library/Homebrew/cmd/tap-info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ def tap_info_args
EOS
switch "--installed",
description: "Display information on all installed taps."
flag "--json=",
description: "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>"
flag "--json",
description: "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>"
switch :debug
end
end
Expand All @@ -32,7 +32,9 @@ def tap_info
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))
else
print_tap_info(taps.sort_by(&:to_s))
Expand Down
4 changes: 2 additions & 2 deletions docs/Manpage.md
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ By default, version information is displayed in interactive shells, and
suppressed otherwise.

* `--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 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.

Expand Down Expand Up @@ -479,7 +479,7 @@ Display a brief summary of all installed taps if no *`tap`* are passed.
* `--installed`:
Display information on all installed taps.
* `--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`*

Expand Down
2 changes: 1 addition & 1 deletion manpages/brew-cask.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.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"
\fBbrew\-cask\fR \- a friendly binary installer for macOS
Expand Down
6 changes: 3 additions & 3 deletions manpages/brew.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.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"
\fBbrew\fR \- The missing package manager for macOS
Expand Down Expand Up @@ -438,7 +438,7 @@ By default, version information is displayed in interactive shells, and suppress
.
.TP
\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
\fB\-\-fetch\-HEAD\fR
Expand Down Expand Up @@ -603,7 +603,7 @@ Display information on all installed taps\.
.
.TP
\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"
Pin \fItap\fR, prioritising its formulae over core when formula names are supplied by the user\. See also \fBtap\-unpin\fR\.
Expand Down