Fix --formula and --cask flags.

These were all made `--formulae` and `--casks` for consistency but that
doesn't behave as expected because they have special behaviours in
`args`. Instead, use the singular form everywhere.
This commit is contained in:
Mike McQuaid 2020-08-07 09:53:30 +01:00
parent 21ef9d942c
commit 3875f16782
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70
10 changed files with 61 additions and 61 deletions

View File

@ -23,12 +23,12 @@ module Homebrew
description: "Show the cache file used when building from source." description: "Show the cache file used when building from source."
switch "--force-bottle", switch "--force-bottle",
description: "Show the cache file used when pouring a bottle." description: "Show the cache file used when pouring a bottle."
switch "--formulae", switch "--formula",
description: "Only show cache files for formulae." description: "Only show cache files for formulae."
switch "--casks", switch "--cask",
description: "Only show cache files for casks." description: "Only show cache files for casks."
conflicts "--build-from-source", "--force-bottle" conflicts "--build-from-source", "--force-bottle"
conflicts "--formulae", "--casks" conflicts "--formula", "--cask"
end end
end end
@ -37,11 +37,11 @@ module Homebrew
if args.no_named? if args.no_named?
puts HOMEBREW_CACHE puts HOMEBREW_CACHE
elsif args.formulae? elsif args.formula?
args.named.each do |name| args.named.each do |name|
print_formula_cache name, args: args print_formula_cache name, args: args
end end
elsif args.casks? elsif args.cask?
args.named.each do |name| args.named.each do |name|
print_cask_cache name print_cask_cache name
end end

View File

@ -32,9 +32,9 @@ module Homebrew
switch "--pinned", switch "--pinned",
description: "Show the versions of pinned formulae, or only the specified (pinned) "\ description: "Show the versions of pinned formulae, or only the specified (pinned) "\
"formulae if <formula> are provided. See also `pin`, `unpin`." "formulae if <formula> are provided. See also `pin`, `unpin`."
switch "--formulae", switch "--formula", "--formulae",
description: "List only formulae." description: "List only formulae."
switch "--casks", switch "--cask", "--casks",
description: "List only casks." description: "List only casks."
# passed through to ls # passed through to ls
switch "-1", switch "-1",
@ -48,8 +48,8 @@ module Homebrew
switch "-t", switch "-t",
description: "Sort by time modified, listing most recently modified first." description: "Sort by time modified, listing most recently modified first."
["--formulae", "--unbrewed", "--multiple", "--pinned", "-l", "-r", "-t"].each do |flag| ["--formula", "--unbrewed", "--multiple", "--pinned", "-l", "-r", "-t"].each do |flag|
conflicts "--casks", flag conflicts "--cask", flag
end end
end end
end end
@ -57,7 +57,7 @@ module Homebrew
def list def list
args = list_args.parse args = list_args.parse
return list_casks(args: args) if args.casks? return list_casks(args: args) if args.cask?
return list_unbrewed if args.unbrewed? return list_unbrewed if args.unbrewed?

View File

@ -21,9 +21,9 @@ module Homebrew
description: "List only the names of outdated kegs (takes precedence over `--verbose`)." description: "List only the names of outdated kegs (takes precedence over `--verbose`)."
switch "-v", "--verbose", switch "-v", "--verbose",
description: "Include detailed version information." description: "Include detailed version information."
switch "--formulae", switch "--formula",
description: "Only output outdated formulae." description: "Only output outdated formulae."
switch "--casks", switch "--cask",
description: "Only output outdated casks." description: "Only output outdated casks."
flag "--json", flag "--json",
description: "Print output in JSON format. There are two versions: v1 and v2. " \ description: "Print output in JSON format. There are two versions: v1 and v2. " \
@ -37,7 +37,7 @@ module Homebrew
description: "Print outdated casks with `auto_updates` or `version :latest`." description: "Print outdated casks with `auto_updates` or `version :latest`."
conflicts "--quiet", "--verbose", "--json" conflicts "--quiet", "--verbose", "--json"
conflicts "--formulae", "--casks" conflicts "--formula", "--cask"
end end
end end
@ -49,7 +49,7 @@ module Homebrew
# TODO: enable for next major/minor release # TODO: enable for next major/minor release
# odeprecated "brew outdated --json#{json_version == :v1 ? "=v1" : ""}", "brew outdated --json=v2" # odeprecated "brew outdated --json#{json_version == :v1 ? "=v1" : ""}", "brew outdated --json=v2"
outdated = if args.formulae? || !args.casks? outdated = if args.formula? || !args.cask?
outdated_formulae args: args outdated_formulae args: args
else else
outdated_casks args: args outdated_casks args: args
@ -58,9 +58,9 @@ module Homebrew
puts JSON.generate(json_info(outdated, args: args)) puts JSON.generate(json_info(outdated, args: args))
when :v2 when :v2
formulae, casks = if args.formulae? formulae, casks = if args.formula?
[outdated_formulae(args: args), []] [outdated_formulae(args: args), []]
elsif args.casks? elsif args.cask?
[[], outdated_casks(args: args)] [[], outdated_casks(args: args)]
else else
outdated_formulae_casks args: args outdated_formulae_casks args: args
@ -75,9 +75,9 @@ module Homebrew
outdated = formulae + casks outdated = formulae + casks
else else
outdated = if args.formulae? outdated = if args.formula?
outdated_formulae args: args outdated_formulae args: args
elsif args.casks? elsif args.cask?
outdated_casks args: args outdated_casks args: args
else else
outdated_formulae_casks(args: args).flatten outdated_formulae_casks(args: args).flatten

View File

@ -36,10 +36,10 @@ module Homebrew
If no <text> is provided, list all locally available formulae (including tapped ones). If no <text> is provided, list all locally available formulae (including tapped ones).
No online search is performed. No online search is performed.
EOS EOS
switch "--formulae", switch "--formula", "--formulae",
description: "Without <text>, list all locally available formulae (no online search is performed). " \ description: "Without <text>, list all locally available formulae (no online search is performed). " \
"With <text>, search online and locally for formulae." "With <text>, search online and locally for formulae."
switch "--casks", switch "--cask", "--casks",
description: "Without <text>, list all locally available casks (including tapped ones, no online " \ description: "Without <text>, list all locally available casks (including tapped ones, no online " \
"search is performed). With <text>, search online and locally for casks." "search is performed). With <text>, search online and locally for casks."
switch "--desc", switch "--desc",
@ -66,8 +66,8 @@ module Homebrew
end end
if args.no_named? if args.no_named?
if args.casks? if args.cask?
raise UsageError, "specifying both --formulae and --casks requires <text>" if args.formulae? raise UsageError, "specifying both --formula and --cask requires <text>" if args.formula?
puts Formatter.columns(Cask::Cask.to_a.map(&:full_name).sort) puts Formatter.columns(Cask::Cask.to_a.map(&:full_name).sort)
else else
@ -92,8 +92,8 @@ module Homebrew
local_casks = search_casks(string_or_regex) local_casks = search_casks(string_or_regex)
remote_casks = remote_results[:casks] remote_casks = remote_results[:casks]
all_casks = local_casks + remote_casks all_casks = local_casks + remote_casks
print_formulae = args.formulae? print_formulae = args.formula?
print_casks = args.casks? print_casks = args.cask?
print_formulae = print_casks = true if !print_formulae && !print_casks print_formulae = print_casks = true if !print_formulae && !print_casks
if print_formulae && all_formulae.any? if print_formulae && all_formulae.any?
@ -102,7 +102,7 @@ module Homebrew
end end
if print_casks && all_casks.any? if print_casks && all_casks.any?
puts if args.formulae? && all_formulae.any? puts if args.formula? && all_formulae.any?
ohai "Casks" ohai "Casks"
puts Formatter.columns(all_casks) puts Formatter.columns(all_casks)
end end

View File

@ -26,9 +26,9 @@ module Homebrew
switch "-d", "--debug", switch "-d", "--debug",
description: "If brewing fails, open an interactive debugging session with access to IRB "\ description: "If brewing fails, open an interactive debugging session with access to IRB "\
"or a shell inside the temporary build directory." "or a shell inside the temporary build directory."
switch "--formulae", switch "--formula",
description: "Only upgrade outdated formulae." description: "Only upgrade outdated formulae."
switch "--casks", switch "--cask",
description: "Only upgrade outdated casks." description: "Only upgrade outdated casks."
switch "-s", "--build-from-source", switch "-s", "--build-from-source",
description: "Compile <formula> from source even if a bottle is available." description: "Compile <formula> from source even if a bottle is available."
@ -60,11 +60,11 @@ module Homebrew
switch "--greedy", switch "--greedy",
description: "Upgrade casks with `auto_updates` or `version :latest`" description: "Upgrade casks with `auto_updates` or `version :latest`"
conflicts "--build-from-source", "--force-bottle" conflicts "--build-from-source", "--force-bottle"
conflicts "--formulae", "--greedy" conflicts "--formula", "--greedy"
["--formulae", "-s", "--build-from-source", "-i", "--interactive", ["--formula", "-s", "--build-from-source", "-i", "--interactive",
"--force-bottle", "--fetch-HEAD", "--ignore-pinned", "--keep-tmp", "--force-bottle", "--fetch-HEAD", "--ignore-pinned", "--keep-tmp",
"--display-times"].each do |flag| "--display-times"].each do |flag|
conflicts "--casks", flag conflicts "--cask", flag
end end
formula_options formula_options
end end
@ -77,8 +77,8 @@ module Homebrew
# If one or more formulae are specified, but no casks were # If one or more formulae are specified, but no casks were
# specified, we want to make note of that so we don't # specified, we want to make note of that so we don't
# try to upgrade all outdated casks. # try to upgrade all outdated casks.
upgrade_formulae = formulae.present? && casks.blank? && !args.casks? upgrade_formulae = formulae.present? && casks.blank? && !args.cask?
upgrade_casks = casks.present? && formulae.blank? && !args.formulae? upgrade_casks = casks.present? && formulae.blank? && !args.formula?
upgrade_outdated_formulae(formulae, args: args) unless upgrade_casks upgrade_outdated_formulae(formulae, args: args) unless upgrade_casks
upgrade_outdated_casks(casks, args: args) unless upgrade_formulae upgrade_outdated_casks(casks, args: args) unless upgrade_formulae

View File

@ -453,7 +453,7 @@ _brew_search() {
local cur="${COMP_WORDS[COMP_CWORD]}" local cur="${COMP_WORDS[COMP_CWORD]}"
case "$cur" in case "$cur" in
-*) -*)
__brewcomp "--casks --debian --desc --fedora --fink --macports --opensuse --ubuntu" __brewcomp "--cask --debian --desc --fedora --fink --macports --opensuse --ubuntu"
return return
;; ;;
esac esac

View File

@ -208,7 +208,7 @@ function __fish_brew_suggest_casks_outdated -d "Lists outdated casks with the in
end end
function __fish_brew_suggest_casks_all -d "Lists locally available casks" function __fish_brew_suggest_casks_all -d "Lists locally available casks"
brew search --casks brew search --cask
end end

View File

@ -22,7 +22,7 @@ __brew_all_casks() {
local comp_cachename=brew_casks local comp_cachename=brew_casks
if ! _retrieve_cache $comp_cachename; then if ! _retrieve_cache $comp_cachename; then
list=( $(brew search --casks) ) list=( $(brew search --cask) )
_store_cache $comp_cachename list _store_cache $comp_cachename list
fi fi

View File

@ -290,9 +290,9 @@ If *`formula`* is provided, summarise the paths within its current keg.
Only show formulae with multiple versions installed. Only show formulae with multiple versions installed.
* `--pinned`: * `--pinned`:
Show the versions of pinned formulae, or only the specified (pinned) formulae if *`formula`* are provided. See also `pin`, `unpin`. Show the versions of pinned formulae, or only the specified (pinned) formulae if *`formula`* are provided. See also `pin`, `unpin`.
* `--formulae`: * `--formula`:
List only formulae. List only formulae.
* `--casks`: * `--cask`:
List only casks. List only casks.
* `-1`: * `-1`:
Force output to be one entry per line. This is the default when output is not to a terminal. Force output to be one entry per line. This is the default when output is not to a terminal.
@ -359,9 +359,9 @@ otherwise.
List only the names of outdated kegs (takes precedence over `--verbose`). List only the names of outdated kegs (takes precedence over `--verbose`).
* `-v`, `--verbose`: * `-v`, `--verbose`:
Include detailed version information. Include detailed version information.
* `--formulae`: * `--formula`:
Only output outdated formulae. Only output outdated formulae.
* `--casks`: * `--cask`:
Only output outdated casks. Only output outdated casks.
* `--json`: * `--json`:
Print output in JSON format. There are two versions: v1 and v2. v1 is deprecated and is currently the default if no version is specified. v2 prints outdated formulae and casks. Print output in JSON format. There are two versions: v1 and v2. v1 is deprecated and is currently the default if no version is specified. v2 prints outdated formulae and casks.
@ -425,9 +425,9 @@ search for *`text`* is extended online to `homebrew/core` and `homebrew/cask`.
If no *`text`* is provided, list all locally available formulae (including tapped If no *`text`* is provided, list all locally available formulae (including tapped
ones). No online search is performed. ones). No online search is performed.
* `--formulae`: * `--formula`:
Without *`text`*, list all locally available formulae (no online search is performed). With *`text`*, search online and locally for formulae. Without *`text`*, list all locally available formulae (no online search is performed). With *`text`*, search online and locally for formulae.
* `--casks`: * `--cask`:
Without *`text`*, list all locally available casks (including tapped ones, no online search is performed). With *`text`*, search online and locally for casks. Without *`text`*, list all locally available casks (including tapped ones, no online search is performed). With *`text`*, search online and locally for casks.
* `--desc`: * `--desc`:
Search for formulae with a description matching *`text`* and casks with a name matching *`text`*. Search for formulae with a description matching *`text`* and casks with a name matching *`text`*.
@ -550,9 +550,9 @@ the upgraded formulae or, every 30 days, for all formulae.
* `-d`, `--debug`: * `-d`, `--debug`:
If brewing fails, open an interactive debugging session with access to IRB or a shell inside the temporary build directory. If brewing fails, open an interactive debugging session with access to IRB or a shell inside the temporary build directory.
* `--formulae`: * `--formula`:
Only upgrade outdated formulae. Only upgrade outdated formulae.
* `--casks`: * `--cask`:
Only upgrade outdated casks. Only upgrade outdated casks.
* `-s`, `--build-from-source`: * `-s`, `--build-from-source`:
Compile *`formula`* from source even if a bottle is available. Compile *`formula`* from source even if a bottle is available.
@ -611,9 +611,9 @@ If *`formula`* is provided, display the file or directory used to cache *`formul
Show the cache file used when building from source. Show the cache file used when building from source.
* `--force-bottle`: * `--force-bottle`:
Show the cache file used when pouring a bottle. Show the cache file used when pouring a bottle.
* `--formulae`: * `--formula`:
Only show cache files for formulae. Only show cache files for formulae.
* `--casks`: * `--cask`:
Only show cache files for casks. Only show cache files for casks.
### `--caskroom` [*`cask`*] ### `--caskroom` [*`cask`*]
@ -1219,11 +1219,11 @@ flags which will help find keg-only dependencies like `openssl`, `icu4c`, etc.
`install` won't output a `Brewfile.lock.json`. `install` won't output a `Brewfile.lock.json`.
* `--all`: * `--all`:
`list` all dependencies. `list` all dependencies.
* `--formulae`: * `--formula`:
`list` Homebrew dependencies. `list` Homebrew dependencies.
* `--casks`: * `--cask`:
`list` Homebrew Cask dependencies. `list` Homebrew Cask dependencies.
* `--taps`: * `--tap`:
`list` tap dependencies. `list` tap dependencies.
* `--mas`: * `--mas`:
`list` Mac App Store dependencies. `list` Mac App Store dependencies.

View File

@ -393,11 +393,11 @@ Only show formulae with multiple versions installed\.
Show the versions of pinned formulae, or only the specified (pinned) formulae if \fIformula\fR are provided\. See also \fBpin\fR, \fBunpin\fR\. Show the versions of pinned formulae, or only the specified (pinned) formulae if \fIformula\fR are provided\. See also \fBpin\fR, \fBunpin\fR\.
. .
.TP .TP
\fB\-\-formulae\fR \fB\-\-formula\fR
List only formulae\. List only formulae\.
. .
.TP .TP
\fB\-\-casks\fR \fB\-\-cask\fR
List only casks\. List only casks\.
. .
.TP .TP
@ -484,11 +484,11 @@ List only the names of outdated kegs (takes precedence over \fB\-\-verbose\fR)\.
Include detailed version information\. Include detailed version information\.
. .
.TP .TP
\fB\-\-formulae\fR \fB\-\-formula\fR
Only output outdated formulae\. Only output outdated formulae\.
. .
.TP .TP
\fB\-\-casks\fR \fB\-\-cask\fR
Only output outdated casks\. Only output outdated casks\.
. .
.TP .TP
@ -565,11 +565,11 @@ Perform a substring search of cask tokens and formula names for \fItext\fR\. If
If no \fItext\fR is provided, list all locally available formulae (including tapped ones)\. No online search is performed\. If no \fItext\fR is provided, list all locally available formulae (including tapped ones)\. No online search is performed\.
. .
.TP .TP
\fB\-\-formulae\fR \fB\-\-formula\fR
Without \fItext\fR, list all locally available formulae (no online search is performed)\. With \fItext\fR, search online and locally for formulae\. Without \fItext\fR, list all locally available formulae (no online search is performed)\. With \fItext\fR, search online and locally for formulae\.
. .
.TP .TP
\fB\-\-casks\fR \fB\-\-cask\fR
Without \fItext\fR, list all locally available casks (including tapped ones, no online search is performed)\. With \fItext\fR, search online and locally for casks\. Without \fItext\fR, list all locally available casks (including tapped ones, no online search is performed)\. With \fItext\fR, search online and locally for casks\.
. .
.TP .TP
@ -711,11 +711,11 @@ Unless \fBHOMEBREW_NO_INSTALL_CLEANUP\fR is set, \fBbrew cleanup\fR will then be
If brewing fails, open an interactive debugging session with access to IRB or a shell inside the temporary build directory\. If brewing fails, open an interactive debugging session with access to IRB or a shell inside the temporary build directory\.
. .
.TP .TP
\fB\-\-formulae\fR \fB\-\-formula\fR
Only upgrade outdated formulae\. Only upgrade outdated formulae\.
. .
.TP .TP
\fB\-\-casks\fR \fB\-\-cask\fR
Only upgrade outdated casks\. Only upgrade outdated casks\.
. .
.TP .TP
@ -812,11 +812,11 @@ Show the cache file used when building from source\.
Show the cache file used when pouring a bottle\. Show the cache file used when pouring a bottle\.
. .
.TP .TP
\fB\-\-formulae\fR \fB\-\-formula\fR
Only show cache files for formulae\. Only show cache files for formulae\.
. .
.TP .TP
\fB\-\-casks\fR \fB\-\-cask\fR
Only show cache files for casks\. Only show cache files for casks\.
. .
.SS "\fB\-\-caskroom\fR [\fIcask\fR]" .SS "\fB\-\-caskroom\fR [\fIcask\fR]"
@ -1585,15 +1585,15 @@ Read the \fBBrewfile\fR from \fB~/\.Brewfile\fR\.
\fBlist\fR all dependencies\. \fBlist\fR all dependencies\.
. .
.TP .TP
\fB\-\-formulae\fR \fB\-\-formula\fR
\fBlist\fR Homebrew dependencies\. \fBlist\fR Homebrew dependencies\.
. .
.TP .TP
\fB\-\-casks\fR \fB\-\-cask\fR
\fBlist\fR Homebrew Cask dependencies\. \fBlist\fR Homebrew Cask dependencies\.
. .
.TP .TP
\fB\-\-taps\fR \fB\-\-tap\fR
\fBlist\fR tap dependencies\. \fBlist\fR tap dependencies\.
. .
.TP .TP