mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
completions: fix short option conflict in zsh completion
This commit is contained in:
parent
7156fb7d3a
commit
910a5c3d3f
@ -266,10 +266,10 @@ module Homebrew
|
||||
|
||||
sig { params(command: String, option: String).returns(String) }
|
||||
def self.generate_zsh_option_exclusions(command, option)
|
||||
conflicts = Commands.option_conflicts(command, option.gsub(/^--/, ""))
|
||||
conflicts = Commands.option_conflicts(command, option.gsub(/^--?/, ""))
|
||||
return "" unless conflicts.presence
|
||||
|
||||
"(#{conflicts.map { |conflict| "--#{conflict}" }.join(" ")})"
|
||||
"(#{conflicts.map { |conflict| "-#{"-" if conflict.size > 1}#{conflict}" }.join(" ")})"
|
||||
end
|
||||
|
||||
sig { params(commands: T::Array[String]).returns(String) }
|
||||
|
@ -961,7 +961,7 @@ _brew_fetch() {
|
||||
'(--cask)--formula[Treat all named arguments as formulae]' \
|
||||
'*::formula:__brew_formulae' \
|
||||
- cask \
|
||||
'(--HEAD --deps --s --build-bottle --force-bottle --bottle-tag --formula)--cask[Treat all named arguments as casks]' \
|
||||
'(--HEAD --deps -s --build-bottle --force-bottle --bottle-tag --formula)--cask[Treat all named arguments as casks]' \
|
||||
'*::cask:__brew_casks'
|
||||
}
|
||||
|
||||
@ -1287,22 +1287,22 @@ _brew_linkage() {
|
||||
# brew list
|
||||
_brew_list() {
|
||||
_arguments \
|
||||
'(--cask --versions --pinned --l --full-name)--built-from-source[List the formulae compiled from source]' \
|
||||
'(--cask --versions --pinned -l --full-name)--built-from-source[List the formulae compiled from source]' \
|
||||
'--debug[Display any debugging information]' \
|
||||
'(--versions --pinned --installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source --l --r --t)--full-name[Print formulae with fully-qualified names. Unless `--full-name`, `--versions` or `--pinned` are passed, other options (i.e. `-1`, `-l`, `-r` and `-t`) are passed to `ls`(1) which produces the actual output]' \
|
||||
'(--versions --pinned --installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source -l -r -t)--full-name[Print formulae with fully-qualified names. Unless `--full-name`, `--versions` or `--pinned` are passed, other options (i.e. `-1`, `-l`, `-r` and `-t`) are passed to `ls`(1) which produces the actual output]' \
|
||||
'--help[Show this message]' \
|
||||
'(--cask --versions --pinned --l --full-name)--installed-as-dependency[List the formulae installed as dependencies]' \
|
||||
'(--cask --versions --pinned --l --full-name)--installed-on-request[List the formulae installed on request]' \
|
||||
'(--cask --versions --pinned -l --full-name)--installed-as-dependency[List the formulae installed as dependencies]' \
|
||||
'(--cask --versions --pinned -l --full-name)--installed-on-request[List the formulae installed on request]' \
|
||||
'(--cask --pinned)--multiple[Only show formulae with multiple versions installed]' \
|
||||
'(--cask --multiple --installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source --1 --l --r --t --full-name)--pinned[List only pinned formulae, or only the specified (pinned) formulae if formula are provided. See also `pin`, `unpin`]' \
|
||||
'(--cask --versions --pinned --l --full-name)--poured-from-bottle[List the formulae installed from a bottle]' \
|
||||
'(--cask --multiple --installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source -1 -l -r -t --full-name)--pinned[List only pinned formulae, or only the specified (pinned) formulae if formula are provided. See also `pin`, `unpin`]' \
|
||||
'(--cask --versions --pinned -l --full-name)--poured-from-bottle[List the formulae installed from a bottle]' \
|
||||
'--quiet[Make some output more quiet]' \
|
||||
'--verbose[Make some output more verbose]' \
|
||||
'(--installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source --1 --l --r --t --full-name)--versions[Show the version number for installed formulae, or only the specified formulae if formula are provided]' \
|
||||
'-1[Force output to be one entry per line. This is the default when output is not to a terminal]' \
|
||||
'-l[List formulae and/or casks in long format. Has no effect when a formula or cask name is passed as an argument]' \
|
||||
'-r[Reverse the order of the formulae and/or casks sort to list the oldest entries first. Has no effect when a formula or cask name is passed as an argument]' \
|
||||
'-t[Sort formulae and/or casks by time modified, listing most recently modified first. Has no effect when a formula or cask name is passed as an argument]' \
|
||||
'(--installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source -1 -l -r -t --full-name)--versions[Show the version number for installed formulae, or only the specified formulae if formula are provided]' \
|
||||
'(--versions --pinned)-1[Force output to be one entry per line. This is the default when output is not to a terminal]' \
|
||||
'(--installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source --versions --pinned --full-name)-l[List formulae and/or casks in long format. Has no effect when a formula or cask name is passed as an argument]' \
|
||||
'(--versions --pinned --full-name)-r[Reverse the order of the formulae and/or casks sort to list the oldest entries first. Has no effect when a formula or cask name is passed as an argument]' \
|
||||
'(--versions --pinned --full-name)-t[Sort formulae and/or casks by time modified, listing most recently modified first. Has no effect when a formula or cask name is passed as an argument]' \
|
||||
- installed_formula \
|
||||
'(--cask)--formula[List only formulae, or treat all named arguments as formulae]' \
|
||||
'*::installed_formula:__brew_installed_formulae' \
|
||||
@ -1354,13 +1354,13 @@ _brew_log() {
|
||||
_arguments \
|
||||
'--debug[Display any debugging information]' \
|
||||
'--help[Show this message]' \
|
||||
'(--1)--max-count[Print only a specified number of commits]' \
|
||||
'(-1)--max-count[Print only a specified number of commits]' \
|
||||
'--oneline[Print only one line per commit]' \
|
||||
'--patch[Also print patch from commit]' \
|
||||
'--quiet[Make some output more quiet]' \
|
||||
'--stat[Also print diffstat from commit]' \
|
||||
'--verbose[Make some output more verbose]' \
|
||||
'-1[Print only one commit]' \
|
||||
'(--max-count)-1[Print only one commit]' \
|
||||
- formula \
|
||||
'(--cask)--formula[Treat all named arguments as formulae]' \
|
||||
'*::formula:__brew_formulae' \
|
||||
@ -1372,22 +1372,22 @@ _brew_log() {
|
||||
# brew ls
|
||||
_brew_ls() {
|
||||
_arguments \
|
||||
'(--cask --versions --pinned --l --full-name)--built-from-source[List the formulae compiled from source]' \
|
||||
'(--cask --versions --pinned -l --full-name)--built-from-source[List the formulae compiled from source]' \
|
||||
'--debug[Display any debugging information]' \
|
||||
'(--versions --pinned --installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source --l --r --t)--full-name[Print formulae with fully-qualified names. Unless `--full-name`, `--versions` or `--pinned` are passed, other options (i.e. `-1`, `-l`, `-r` and `-t`) are passed to `ls`(1) which produces the actual output]' \
|
||||
'(--versions --pinned --installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source -l -r -t)--full-name[Print formulae with fully-qualified names. Unless `--full-name`, `--versions` or `--pinned` are passed, other options (i.e. `-1`, `-l`, `-r` and `-t`) are passed to `ls`(1) which produces the actual output]' \
|
||||
'--help[Show this message]' \
|
||||
'(--cask --versions --pinned --l --full-name)--installed-as-dependency[List the formulae installed as dependencies]' \
|
||||
'(--cask --versions --pinned --l --full-name)--installed-on-request[List the formulae installed on request]' \
|
||||
'(--cask --versions --pinned -l --full-name)--installed-as-dependency[List the formulae installed as dependencies]' \
|
||||
'(--cask --versions --pinned -l --full-name)--installed-on-request[List the formulae installed on request]' \
|
||||
'(--cask --pinned)--multiple[Only show formulae with multiple versions installed]' \
|
||||
'(--cask --multiple --installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source --1 --l --r --t --full-name)--pinned[List only pinned formulae, or only the specified (pinned) formulae if formula are provided. See also `pin`, `unpin`]' \
|
||||
'(--cask --versions --pinned --l --full-name)--poured-from-bottle[List the formulae installed from a bottle]' \
|
||||
'(--cask --multiple --installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source -1 -l -r -t --full-name)--pinned[List only pinned formulae, or only the specified (pinned) formulae if formula are provided. See also `pin`, `unpin`]' \
|
||||
'(--cask --versions --pinned -l --full-name)--poured-from-bottle[List the formulae installed from a bottle]' \
|
||||
'--quiet[Make some output more quiet]' \
|
||||
'--verbose[Make some output more verbose]' \
|
||||
'(--installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source --1 --l --r --t --full-name)--versions[Show the version number for installed formulae, or only the specified formulae if formula are provided]' \
|
||||
'-1[Force output to be one entry per line. This is the default when output is not to a terminal]' \
|
||||
'-l[List formulae and/or casks in long format. Has no effect when a formula or cask name is passed as an argument]' \
|
||||
'-r[Reverse the order of the formulae and/or casks sort to list the oldest entries first. Has no effect when a formula or cask name is passed as an argument]' \
|
||||
'-t[Sort formulae and/or casks by time modified, listing most recently modified first. Has no effect when a formula or cask name is passed as an argument]' \
|
||||
'(--installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source -1 -l -r -t --full-name)--versions[Show the version number for installed formulae, or only the specified formulae if formula are provided]' \
|
||||
'(--versions --pinned)-1[Force output to be one entry per line. This is the default when output is not to a terminal]' \
|
||||
'(--installed-on-request --installed-as-dependency --poured-from-bottle --built-from-source --versions --pinned --full-name)-l[List formulae and/or casks in long format. Has no effect when a formula or cask name is passed as an argument]' \
|
||||
'(--versions --pinned --full-name)-r[Reverse the order of the formulae and/or casks sort to list the oldest entries first. Has no effect when a formula or cask name is passed as an argument]' \
|
||||
'(--versions --pinned --full-name)-t[Sort formulae and/or casks by time modified, listing most recently modified first. Has no effect when a formula or cask name is passed as an argument]' \
|
||||
- installed_formula \
|
||||
'(--cask)--formula[List only formulae, or treat all named arguments as formulae]' \
|
||||
'*::installed_formula:__brew_installed_formulae' \
|
||||
|
Loading…
x
Reference in New Issue
Block a user