| [ -z "$BASH_VERSION" ] && return |
| #################################################################################################### |
| local choices coffset section |
| if [ ${COMP_CWORD} -gt 2 ]; then |
| if [ ${COMP_WORDS[1]} = --section ]; then |
| case "$((${COMP_CWORD}-$coffset))" in |
| choices=$'--section \nhelp \nsections \nlist \ndetails \nextract ' |
| case "${COMP_WORDS[$(($coffset+1))]}" in |
| choices=$'sections\nlist\ndetails\nextract' |
| sections|list|details|extract) |
| COMPREPLY=($(compgen -f -- ${COMP_WORDS[${COMP_CWORD}]})) |
| case "${COMP_WORDS[$(($coffset+1))]}" in |
| choices="$(gresource list ${COMP_WORDS[$(($coffset+2))]} 2> /dev/null | sed -e 's.$. .')" |
| COMPREPLY=($(compgen -W "${choices}" -- "${COMP_WORDS[${COMP_CWORD}]}")) |
| #################################################################################################### |
| complete -o nospace -F __gresource gresource |