linkapps/unlinkapps: improve bash/zsh completion

Closes Homebrew/homebrew#45175.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Martin Afanasjew 2015-10-20 08:10:50 +02:00 committed by Xu Cheng
parent 4cfdef65ed
commit 51392352ad
2 changed files with 13 additions and 1 deletions

View File

@ -326,6 +326,7 @@ _brew_linkapps ()
return
;;
esac
__brew_complete_installed
}
_brew_list ()
@ -621,7 +622,7 @@ _brew ()
install|instal|reinstall) _brew_install ;;
irb) _brew_irb ;;
link|ln) _brew_link ;;
linkapps) _brew_linkapps ;;
linkapps|unlinkapps) _brew_linkapps ;;
list|ls) _brew_list ;;
log) _brew_log ;;
man) _brew_man ;;

View File

@ -51,6 +51,7 @@ _1st_arguments=(
'reinstall:install a formula anew; re-using its current options'
'leaves:show installed formulae that are not dependencies of another installed formula'
'link:link a formula'
'linkapps:symlink .app bundles provided by formulae into /Applications'
'list:list files in a formula or not-installed formulae'
'log:git commit log for a formula'
'missing:check all installed formuale for missing dependencies.'
@ -69,6 +70,7 @@ _1st_arguments=(
'test-bot:test a formula and build a bottle'
'uninstall:uninstall a formula'
'unlink:unlink a formula'
'unlinkapps:remove symlinked .app bundles provided by formulae from /Applications'
'unpin:unpin specified formulae'
'untap:remove a tapped repository'
'update:fetch latest version of Homebrew and all formulae'
@ -99,6 +101,15 @@ case "$words[1]" in
install|reinstall|audit|home|homepage|log|info|abv|uses|cat|deps|desc|edit|options|switch)
_brew_all_formulae
_wanted formulae expl 'all formulae' compadd -a formulae ;;
linkapps|unlinkapps)
_arguments \
'(--local)--local[operate on ~/Applications instead of /Applications]' \
'1: :->forms' && return 0
if [[ "$state" == forms ]]; then
_brew_installed_formulae
_wanted installed_formulae expl 'installed formulae' compadd -a installed_formulae
fi ;;
list|ls)
_arguments \
'(--unbrewed)--unbrewed[files in brew --prefix not controlled by brew]' \