Created
September 11, 2009 11:39
-
-
Save Sutto/185244 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Probably not the ideal solution, and from a fish noob | |
# but it *seems* to work. Hurrah! | |
function __fish_complete_homebrew_formula | |
ls (brew --prefix)/Library/Formula | sed s/\.rb// | |
end | |
function __fish_complete_brew_has_command --description 'Test if brew is given a command' | |
set arguments (commandline -opc) | |
if [ (count $arguments) -lt 2 ] | |
return 1 | |
end | |
if contains $arguments[2] install remove list link link home info | |
return 0 | |
end | |
return 1 | |
end | |
function __fish_complete_brew_no_command | |
for i in (commandline -opc) | |
if contains -- $i install remove search list link home info gen prune | |
return 1 | |
end | |
end | |
return 0 | |
end | |
complete -c brew -x -a 'install remove search list link home info gen prune' -n '__fish_complete_brew_no_command' | |
complete -c brew -x -a '(__fish_complete_homebrew_formula)' -n '__fish_complete_brew_has_command' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment