Created
August 19, 2012 23:23
-
-
Save jrbasso/3398516 to your computer and use it in GitHub Desktop.
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
# Bash completation for application | |
_my_application() | |
{ | |
local cur prev opts job | |
COMPREPLY=() | |
job="${COMP_WORDS[0]}" | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
if [[ ${COMP_CWORD} = 1 ]] ; then | |
opts=$(${job} __check__) | |
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) | |
return 0 | |
fi | |
if [[ ${COMP_CWORD} = 2 ]] ; then | |
opts=$(${job} __check__ $prev) | |
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) | |
return 0 | |
fi | |
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) | |
return 0; | |
} | |
complete -F _my_application job |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment