aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMisty De Meo2012-11-05 09:36:59 -0600
committerMisty De Meo2012-11-13 15:46:14 -0600
commitcb2b95a97e1d3872b327be8e327297b0910ec0a6 (patch)
treef37c44f3c97d2f23e78b5f1fb71c06c87285c3e0 /Library
parent89cb0b0f408686bb6be1bd2cf984d840cc4b253a (diff)
downloadhomebrew-cb2b95a97e1d3872b327be8e327297b0910ec0a6.tar.bz2
fish completion: complete formula options
Diffstat (limited to 'Library')
-rw-r--r--Library/Contributions/brew_fish_completion.fish14
1 files changed, 14 insertions, 0 deletions
diff --git a/Library/Contributions/brew_fish_completion.fish b/Library/Contributions/brew_fish_completion.fish
index 1a9cbf9f4..08bfb3c41 100644
--- a/Library/Contributions/brew_fish_completion.fish
+++ b/Library/Contributions/brew_fish_completion.fish
@@ -86,6 +86,20 @@ function __fish_complete_brew_no_command
return 0
end
+function __fish_brew_formula_arguments
+ set formulae (ls (brew --repository)/Library/Formula 2>/dev/null | sed 's/\.rb//g')
+ for formula in (ls (brew --repository)/Library/Aliases 2>/dev/null | sed 's/\.rb//g')
+ set formulae $formula $formulae
+ end
+
+ for cmd in (commandline -opc)
+ if contains -- $cmd $formulae
+ brew options $cmd --compact | tr ' ' '\n'
+ end
+ end
+end
+
+complete -c brew --arguments '(__fish_brew_formula_arguments)'
complete -c brew -x -a "$commands" -n '__fish_complete_brew_no_command'
complete -c brew -x -a '(__fish_complete_brew_argument)' -n '__fish_complete_brew_has_command'