Skip to content

Commit

Permalink
fish completion: complete formula options
Browse files Browse the repository at this point in the history
  • Loading branch information
mistydemeo committed Nov 13, 2012
1 parent 89cb0b0 commit cb2b95a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Library/Contributions/brew_fish_completion.fish
Expand Up @@ -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'

Expand Down

0 comments on commit cb2b95a

Please sign in to comment.