diff --git a/Library/Homebrew/cmd/home.rb b/Library/Homebrew/cmd/home.rb index 224a366c38..6e5d75c6a4 100644 --- a/Library/Homebrew/cmd/home.rb +++ b/Library/Homebrew/cmd/home.rb @@ -18,6 +18,11 @@ module Homebrew Open a or '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 diff --git a/docs/Manpage.md b/docs/Manpage.md index 34fe4fcf8a..0b998725d6 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -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. diff --git a/manpages/brew.1 b/manpages/brew.1 index 57fe82d383..31a05c1726 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -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\. .