From 51392352adc73b10c227b71153e66ba620cfb2fd Mon Sep 17 00:00:00 2001 From: Martin Afanasjew Date: Tue, 20 Oct 2015 08:10:50 +0200 Subject: [PATCH] linkapps/unlinkapps: improve bash/zsh completion Closes Homebrew/homebrew#45175. Signed-off-by: Xu Cheng --- Library/Contributions/brew_bash_completion.sh | 3 ++- Library/Contributions/brew_zsh_completion.zsh | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Library/Contributions/brew_bash_completion.sh b/Library/Contributions/brew_bash_completion.sh index 0c7326176b..5f9eeda6a7 100644 --- a/Library/Contributions/brew_bash_completion.sh +++ b/Library/Contributions/brew_bash_completion.sh @@ -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 ;; diff --git a/Library/Contributions/brew_zsh_completion.zsh b/Library/Contributions/brew_zsh_completion.zsh index 27faa339a2..085ffc8213 100644 --- a/Library/Contributions/brew_zsh_completion.zsh +++ b/Library/Contributions/brew_zsh_completion.zsh @@ -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]' \