add two options to cmd/home

This commit is contained in:
hyuraku 2020-12-11 23:09:14 +09:00
parent 4f438f6e45
commit 16d13fe086
3 changed files with 21 additions and 1 deletions

View File

@ -18,6 +18,11 @@ module Homebrew
Open a <formula> or <cask>'s homepage in a browser, or open
Homebrew's own homepage if no argument is provided.
EOS
switch "--formula", "--formulae",
description: "Treat all named arguments as formulae."
switch "--cask", "--casks",
description: "Treat all named arguments as casks."
conflicts "--formula", "--cask"
end
end
@ -30,7 +35,9 @@ module Homebrew
return
end
homepages = args.named.to_formulae_and_casks.map do |formula_or_cask|
only = :formula if args.formula? && !args.cask?
only = :cask if args.cask? && !args.formula?
homepages = args.named.to_formulae_and_casks(only: only).map do |formula_or_cask|
puts "Opening homepage for #{name_of(formula_or_cask)}"
formula_or_cask.homepage
end

View File

@ -211,6 +211,11 @@ error message if no logs are found.
Open a *`formula`* or *`cask`*'s homepage in a browser, or open
Homebrew's own homepage if no argument is provided.
* `--formula`:
Treat all named arguments as formulae.
* `--cask`:
Treat all named arguments as casks.
### `info` [*`options`*] [*`formula`*|*`cask`*]
Display brief statistics for your Homebrew installation.

View File

@ -258,6 +258,14 @@ The Gist will be marked private and will not appear in listings but will be acce
.SS "\fBhome\fR [\fIformula\fR|\fIcask\fR]"
Open a \fIformula\fR or \fIcask\fR\'s homepage in a browser, or open Homebrew\'s own homepage if no argument is provided\.
.
.TP
\fB\-\-formula\fR
Treat all named arguments as formulae\.
.
.TP
\fB\-\-cask\fR
Treat all named arguments as casks\.
.
.SS "\fBinfo\fR [\fIoptions\fR] [\fIformula\fR|\fIcask\fR]"
Display brief statistics for your Homebrew installation\.
.