From e0b8531bc72d3297d160a108b97f9af97b5b85e1 Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Wed, 11 Jul 2012 20:08:09 -0700 Subject: [PATCH] Add completions for brew link --- Library/Contributions/brew_bash_completion.sh | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Library/Contributions/brew_bash_completion.sh b/Library/Contributions/brew_bash_completion.sh index acfe971725..6b9dc533c8 100644 --- a/Library/Contributions/brew_bash_completion.sh +++ b/Library/Contributions/brew_bash_completion.sh @@ -211,6 +211,24 @@ _brew_install () __brew_complete_formulae } +_brew_link () +{ + local cur="${COMP_WORDS[COMP_CWORD]}" + case "$cur" in + --*) + if __brewcomp_words_include "--dry-run"; then + return + elif __brewcomp_words_include "--force"; then + return + else + __brewcomp "--dry-run --force" + return + fi + ;; + esac + __brew_complete_installed +} + _brew_list () { local cur="${COMP_WORDS[COMP_CWORD]}" @@ -375,7 +393,6 @@ _brew () home info abv install - link ln list ls log missing @@ -401,7 +418,7 @@ _brew () case "$cmd" in --cache|--cellar|--prefix) __brew_complete_formulae ;; audit|cat|edit|home) __brew_complete_formulae ;; - link|ln|test|unlink) __brew_complete_installed ;; + test|unlink) __brew_complete_installed ;; upgrade) __brew_complete_outdated ;; cleanup) _brew_cleanup ;; create) _brew_create ;; @@ -410,6 +427,7 @@ _brew () fetch) _brew_fetch ;; info|abv) _brew_info ;; install) _brew_install ;; + link|ln) _brew_link ;; list|ls) _brew_list ;; log) _brew_log ;; missing) __brew_complete_formulae ;;