Skip to content

Instantly share code, notes, and snippets.

@davidszotten
Created July 19, 2011 09:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save davidszotten/1091866 to your computer and use it in GitHub Desktop.
Save davidszotten/1091866 to your computer and use it in GitHub Desktop.
fabric bash completion
# 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