shell completion: support external commands
Closes Homebrew/homebrew#41519. Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
parent
a2d9d68591
commit
ca458a8ed1
@ -580,62 +580,7 @@ _brew ()
|
|||||||
done
|
done
|
||||||
|
|
||||||
if [[ $i -eq $COMP_CWORD ]]; then
|
if [[ $i -eq $COMP_CWORD ]]; then
|
||||||
__brewcomp "
|
__brewcomp "$(brew commands --quiet --include-aliases)"
|
||||||
--cache --cellar
|
|
||||||
--env --prefix --repository
|
|
||||||
aspell-dictionaries
|
|
||||||
audit
|
|
||||||
bottle
|
|
||||||
cat
|
|
||||||
cleanup
|
|
||||||
commands
|
|
||||||
config --config
|
|
||||||
create
|
|
||||||
deps
|
|
||||||
diy configure
|
|
||||||
doctor
|
|
||||||
edit
|
|
||||||
fetch
|
|
||||||
gist-logs
|
|
||||||
help
|
|
||||||
home
|
|
||||||
info abv
|
|
||||||
install
|
|
||||||
irb
|
|
||||||
leaves
|
|
||||||
linkapps
|
|
||||||
link ln
|
|
||||||
list ls
|
|
||||||
log
|
|
||||||
man
|
|
||||||
missing
|
|
||||||
options
|
|
||||||
outdated
|
|
||||||
prune
|
|
||||||
pin
|
|
||||||
postinstall
|
|
||||||
pull
|
|
||||||
readall
|
|
||||||
search
|
|
||||||
reinstall
|
|
||||||
sh
|
|
||||||
style
|
|
||||||
switch
|
|
||||||
tap
|
|
||||||
tap-readme
|
|
||||||
test
|
|
||||||
test-bot
|
|
||||||
tests
|
|
||||||
uninstall remove rm
|
|
||||||
unlink
|
|
||||||
unlinkapps
|
|
||||||
unpack
|
|
||||||
unpin
|
|
||||||
untap
|
|
||||||
update
|
|
||||||
upgrade
|
|
||||||
uses
|
|
||||||
"
|
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -677,7 +622,7 @@ _brew ()
|
|||||||
uninstall|remove|rm) _brew_uninstall ;;
|
uninstall|remove|rm) _brew_uninstall ;;
|
||||||
unpack) _brew_unpack ;;
|
unpack) _brew_unpack ;;
|
||||||
unpin) __brew_complete_formulae ;;
|
unpin) __brew_complete_formulae ;;
|
||||||
untap) __brew_complete_tapped ;;
|
untap|tap-info) __brew_complete_tapped ;;
|
||||||
update) _brew_update ;;
|
update) _brew_update ;;
|
||||||
upgrade) _brew_upgrade ;;
|
upgrade) _brew_upgrade ;;
|
||||||
uses) _brew_uses ;;
|
uses) _brew_uses ;;
|
||||||
|
@ -25,7 +25,6 @@ _brew_outdated_formulae() {
|
|||||||
local -a _1st_arguments
|
local -a _1st_arguments
|
||||||
_1st_arguments=(
|
_1st_arguments=(
|
||||||
'audit:check formulae for Homebrew coding style'
|
'audit:check formulae for Homebrew coding style'
|
||||||
'bundle:look for a Brewfile and run each line as a brew command'
|
|
||||||
'cat:display formula file for a formula'
|
'cat:display formula file for a formula'
|
||||||
'cleanup:uninstall unused and old versions of packages'
|
'cleanup:uninstall unused and old versions of packages'
|
||||||
'commands:show a list of commands'
|
'commands:show a list of commands'
|
||||||
@ -55,6 +54,7 @@ _1st_arguments=(
|
|||||||
'update:freshen up links'
|
'update:freshen up links'
|
||||||
'upgrade:upgrade outdated formulae'
|
'upgrade:upgrade outdated formulae'
|
||||||
'uses:show formulae which depend on a formula'
|
'uses:show formulae which depend on a formula'
|
||||||
|
`brew commands --quiet --include-aliases`
|
||||||
)
|
)
|
||||||
|
|
||||||
local expl
|
local expl
|
||||||
@ -97,7 +97,7 @@ case "$words[1]" in
|
|||||||
_arguments \
|
_arguments \
|
||||||
'(--macports)--macports[search the macports repository]' \
|
'(--macports)--macports[search the macports repository]' \
|
||||||
'(--fink)--fink[search the fink repository]' ;;
|
'(--fink)--fink[search the fink repository]' ;;
|
||||||
untap)
|
untap|tap-info)
|
||||||
_brew_installed_taps
|
_brew_installed_taps
|
||||||
_wanted installed_taps expl 'installed taps' compadd -a installed_taps ;;
|
_wanted installed_taps expl 'installed taps' compadd -a installed_taps ;;
|
||||||
upgrade)
|
upgrade)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user