Created
July 25, 2012 01:28
-
-
Save carlosrberto/3173843 to your computer and use it in GitHub Desktop.
Fabric autocomplete
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
_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