GIF89a;
Mass Deface 0; i--)) do case ${COMP_WORDS[$i]} in add|load) COMPREPLY=( $(compgen -W "$(_module_not_yet_loaded)" -- "$cur") ) break;; rm|remove|unload|switch|swap) COMPREPLY=( $(IFS=: compgen -W "${LOADEDMODULES}" -- "$cur") ) break;; esac done } _module() { local cur="$2" prev="$3" cmds opts COMPREPLY=() cmds="add apropos avail clear display help\ initadd initclear initlist initprepend initrm initswitch\ keyword list load purge refresh rm show swap switch\ unload unuse update use whatis" opts="-c -f -h -i -l -s -t -u -v -H -V\ --create --force --help --human --icase\ --long --silent --terse --userlvl --verbose --version" case "$prev" in add|load) COMPREPLY=( $(compgen -W "$(_module_not_yet_loaded)" -- "$cur") );; rm|remove|unload|switch|swap) COMPREPLY=( $(IFS=: compgen -W "${LOADEDMODULES}" -- "$cur") );; unuse) COMPREPLY=( $(IFS=: compgen -W "${MODULEPATH}" -- "$cur") );; use|*-a*) ;; # let readline handle the completion -u|--userlvl) COMPREPLY=( $(compgen -W "novice expert advanced" -- "$cur") );; av*|disp*|help|show|whatis) COMPREPLY=( $(compgen -W "$(_module_avail)" -- "$cur") );; *) if test $COMP_CWORD -gt 2 then _module_long_arg_list "$cur" else case "$cur" in # The mappings below are optional abbreviations for convenience ls) COMPREPLY="list";; # map ls -> list r*) COMPREPLY="rm";; # also covers 'remove' sw*) COMPREPLY="switch";; -*) COMPREPLY=( $(compgen -W "$opts" -- "$cur") );; *) COMPREPLY=( $(compgen -W "$cmds" -- "$cur") );; esac fi;; esac } complete -o default -F _module module