shell completion: support external commands

Closes Homebrew/homebrew#41519.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Xu Cheng 2015-07-10 23:22:46 +08:00
parent a2d9d68591
commit ca458a8ed1
2 changed files with 4 additions and 59 deletions

View File

@ -580,62 +580,7 @@ _brew ()
done
if [[ $i -eq $COMP_CWORD ]]; then
__brewcomp "
--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
"
__brewcomp "$(brew commands --quiet --include-aliases)"
return
fi
@ -677,7 +622,7 @@ _brew ()
uninstall|remove|rm) _brew_uninstall ;;
unpack) _brew_unpack ;;
unpin) __brew_complete_formulae ;;
untap) __brew_complete_tapped ;;
untap|tap-info) __brew_complete_tapped ;;
update) _brew_update ;;
upgrade) _brew_upgrade ;;
uses) _brew_uses ;;

View File

@ -25,7 +25,6 @@ _brew_outdated_formulae() {
local -a _1st_arguments
_1st_arguments=(
'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'
'cleanup:uninstall unused and old versions of packages'
'commands:show a list of commands'
@ -55,6 +54,7 @@ _1st_arguments=(
'update:freshen up links'
'upgrade:upgrade outdated formulae'
'uses:show formulae which depend on a formula'
`brew commands --quiet --include-aliases`
)
local expl
@ -97,7 +97,7 @@ case "$words[1]" in
_arguments \
'(--macports)--macports[search the macports repository]' \
'(--fink)--fink[search the fink repository]' ;;
untap)
untap|tap-info)
_brew_installed_taps
_wanted installed_taps expl 'installed taps' compadd -a installed_taps ;;
upgrade)