aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Contributions/brew_bash_completion.sh
diff options
context:
space:
mode:
authorJustin Hileman2011-02-04 18:21:23 -0500
committerAdam Vandenberg2011-02-04 16:46:04 -0800
commit97b8f9a31fa9dd67bc3760a3ab7974f6a80d4450 (patch)
tree99a040fe99c7972544d03c31dccee4b74ed42a64 /Library/Contributions/brew_bash_completion.sh
parent9752fc93fd7aea9731dec80272810ab02e651cde (diff)
downloadbrew-97b8f9a31fa9dd67bc3760a3ab7974f6a80d4450.tar.bz2
bash completion: --options for `brew install foo`
To trigger the option autocompletion, type: brew install foo --[tab][tab] Signed-off-by: Adam Vandenberg <flangy@gmail.com>
Diffstat (limited to 'Library/Contributions/brew_bash_completion.sh')
-rw-r--r--Library/Contributions/brew_bash_completion.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/Library/Contributions/brew_bash_completion.sh b/Library/Contributions/brew_bash_completion.sh
index e12d375d2..1d54ce5da 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
}