diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb index 4858b60bcb..2d8bafe8bb 100644 --- a/Library/Homebrew/cmd/search.rb +++ b/Library/Homebrew/cmd/search.rb @@ -60,7 +60,8 @@ module Homebrew conflicts "--open", "--closed" conflicts(*package_manager_switches) - named_args :text_or_regex, min: 1 + # TODO: (3.2) Add `min: 1` the `named_args` once `brew search --cask` is removed + named_args :text_or_regex end end @@ -73,6 +74,12 @@ module Homebrew return end + if args.no_named? + odisabled "`brew search --cask` with no arguments to output casks", "`brew casks`" if args.cask? + + raise UsageError, "This command requires at least 1 text or regex argument." + end + query = args.named.join(" ") string_or_regex = query_regexp(query) diff --git a/docs/Manpage.md b/docs/Manpage.md index 102fa073be..2153006129 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -482,7 +482,7 @@ reinstalled formulae or, every 30 days, for all formulae. * `--skip-cask-deps`: Skip installing cask dependencies. -### `search`, `-S` [*`options`*] *`text`*|`/`*`regex`*`/` [...] +### `search`, `-S` [*`options`*] [*`text`*|`/`*`regex`*`/` ...] Perform a substring search of cask tokens and formula names for *`text`*. If *`text`* is flanked by slashes, it is interpreted as a regular expression. diff --git a/manpages/brew.1 b/manpages/brew.1 index bbf95ae09f..fffe0ace04 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -654,7 +654,7 @@ Disable/enable quarantining of downloads (default: enabled)\. \fB\-\-skip\-cask\-deps\fR Skip installing cask dependencies\. . -.SS "\fBsearch\fR, \fB\-S\fR [\fIoptions\fR] \fItext\fR|\fB/\fR\fIregex\fR\fB/\fR [\.\.\.]" +.SS "\fBsearch\fR, \fB\-S\fR [\fIoptions\fR] [\fItext\fR|\fB/\fR\fIregex\fR\fB/\fR \.\.\.]" Perform a substring search of cask tokens and formula names for \fItext\fR\. If \fItext\fR is flanked by slashes, it is interpreted as a regular expression\. The search for \fItext\fR is extended online to \fBhomebrew/core\fR and \fBhomebrew/cask\fR\. . .TP