Created
July 19, 2011 09:51
-
-
Save davidszotten/1091866 to your computer and use it in GitHub Desktop.
fabric bash completion
This file contains 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
# only load the commands when launching shell. | |
# if you make frequent edits to your fab file, consider moving this inside _fab() | |
_fab_commands=$(~/path/to/virtualenv/bin/fab --fabfile=~/path/to/fabfile/fabfile.py --shortlist) | |
_fab() | |
{ | |
local cur prev | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
COMPREPLY=( $(compgen -W "${_fab_commands}" -- ${cur}) ) | |
case "${COMPREPLY}" in | |
# commands i frequently add options to, add colon instead of space | |
aws_name|aws_host) | |
COMPREPLY="$COMPREPLY:" | |
;; | |
*) | |
COMPREPLY="$COMPREPLY " | |
;; | |
esac | |
return 0 | |
} | |
complete -o nospace -F _fab fab |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment