From 16d13fe086f191a0b39e08f2d8e96daa292e5f78 Mon Sep 17 00:00:00 2001 From: hyuraku <32809703+hyuraku@users.noreply.github.com> Date: Fri, 11 Dec 2020 23:09:14 +0900 Subject: [PATCH] add two options to cmd/home --- Library/Homebrew/cmd/home.rb | 9 ++++++++- docs/Manpage.md | 5 +++++ manpages/brew.1 | 8 ++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) 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 2a0f1aa258..2c7df14819 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 822caa2e63..79614d7464 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\. .