Created
March 8, 2011 18:19
-
-
Save kejadlen/860694 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
_thor() { | |
COMP_WORDBREAKS=${COMP_WORDBREAKS//:} | |
local cur prev opts | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
opts=`thor help | tail -n +2 | awk '{print $2}'` | |
opts="${opts} `thor list | tail -n +3 | awk '{print $2}'`" | |
if [[ ${#COMP_WORDS[@]} -lt 3 ]]; then | |
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) | |
return 0 | |
fi | |
} | |
complete -F _thor thor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment