Skip to content

Instantly share code, notes, and snippets.

@carlosrberto
Created July 25, 2012 01:28
Show Gist options
  • Save carlosrberto/3173843 to your computer and use it in GitHub Desktop.
Save carlosrberto/3173843 to your computer and use it in GitHub Desktop.
Fabric autocomplete
_fab()
{
local cur
COMPREPLY=()
# Variable to hold the current word
cur="${COMP_WORDS[COMP_CWORD]}"
# Build a list of the available tasks using the command 'fab -l'
local tags=$(fab -l 2>/dev/null | grep "^ " | awk '{print $1;}')
# Generate possible matches and store them in the
# array variable COMPREPLY
COMPREPLY=($(compgen -W "${tags}" $cur))
}
# Assign the auto-completion function _fab for our command fab.
complete -F _fab fab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment