From 97b8f9a31fa9dd67bc3760a3ab7974f6a80d4450 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Fri, 4 Feb 2011 18:21:23 -0500 Subject: [PATCH] bash completion: --options for `brew install foo` To trigger the option autocompletion, type: brew install foo --[tab][tab] Signed-off-by: Adam Vandenberg --- Library/Contributions/brew_bash_completion.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Library/Contributions/brew_bash_completion.sh b/Library/Contributions/brew_bash_completion.sh index e12d375d26..1d54ce5da3 100644 --- a/Library/Contributions/brew_bash_completion.sh +++ b/Library/Contributions/brew_bash_completion.sh @@ -39,6 +39,13 @@ _brew_to_completion() COMPREPLY=( $(compgen -W "$(\ls $(brew --cellar))" -- ${cur}) ) return ;; + # Complete --options for selected brew + *) + [[ ${COMP_WORDS[1]} == "install" ]] && [[ "$cur" == --* ]] && { + COMPREPLY=( $(compgen -W "$(brew options "$prev" | grep -P "^--")" -- ${cur}) ) + return + } + ;; esac }