From 4f0b7255acde456c8eba6016c7f0f507205f925a Mon Sep 17 00:00:00 2001 From: hyuraku <32809703+hyuraku@users.noreply.github.com> Date: Sun, 13 Dec 2020 23:05:08 +0900 Subject: [PATCH] style: add two options --- Library/Homebrew/dev-cmd/style.rb | 10 +++++++++- docs/Manpage.md | 4 ++++ manpages/brew.1 | 8 ++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/dev-cmd/style.rb b/Library/Homebrew/dev-cmd/style.rb index 7e2fcbf136..8e860911d1 100644 --- a/Library/Homebrew/dev-cmd/style.rb +++ b/Library/Homebrew/dev-cmd/style.rb @@ -29,6 +29,10 @@ module Homebrew description: "Include the RuboCop cop name for each violation in the output." switch "--reset-cache", description: "Reset the RuboCop cache." + switch "--formula", "--formulae", + description: "Treat all named arguments as formulae." + switch "--cask", "--casks", + description: "Treat all named arguments as casks." comma_array "--only-cops", description: "Specify a comma-separated list to check for violations of only the "\ "listed RuboCop cops." @@ -36,6 +40,7 @@ module Homebrew description: "Specify a comma-separated list to skip checking for violations of the "\ "listed RuboCop cops." + conflicts "--formula", "--cask" conflicts "--only-cops", "--except-cops" end end @@ -43,10 +48,13 @@ module Homebrew def style args = style_args.parse + only = :formula if args.formula? && !args.cask? + only = :cask if args.cask? && !args.formula? + target = if args.no_named? nil else - args.named.to_paths + args.named.to_paths(only: only) end only_cops = args.only_cops diff --git a/docs/Manpage.md b/docs/Manpage.md index 34fe4fcf8a..022b1e3a56 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1233,6 +1233,10 @@ including core code and all formulae. Include the RuboCop cop name for each violation in the output. * `--reset-cache`: Reset the RuboCop cache. +* `--formula`: + Treat all named arguments as formulae. +* `--cask`: + Treat all named arguments as casks. * `--only-cops`: Specify a comma-separated *`cops`* list to check for violations of only the listed RuboCop cops. * `--except-cops`: diff --git a/manpages/brew.1 b/manpages/brew.1 index 57fe82d383..561eebb663 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1708,6 +1708,14 @@ Include the RuboCop cop name for each violation in the output\. Reset the RuboCop cache\. . .TP +\fB\-\-formula\fR +Treat all named arguments as formulae\. +. +.TP +\fB\-\-cask\fR +Treat all named arguments as casks\. +. +.TP \fB\-\-only\-cops\fR Specify a comma\-separated \fIcops\fR list to check for violations of only the listed RuboCop cops\. .