# qconf bash autocompletion script by Ivo Janssen # start autocompletion by sourcing this file: $ . ./qconf_completion.sh _qconf_complete() { local cur prev opts qswitch COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" qswitch="${COMP_WORDS[1]}" # # qconf options # # ADD DEL MOD SHOW LIST opts=" -ah -dh -sh -acal -dcal -mcal -scal -scall -ackpt -dckpt -mckpt -sckpt -sckptl -mc -sc -ae -de -me -se -sel -aconf -dconf -mconf -sconf -sconfl -ahgrp -dhgrp -mhgrp -shgrp -shgrpl -am -dm -sm -ao -do -so -ap -dp -mp -sp -spl -aprj -dprj -mprj -sprj -sprl -aq -dq -mq -sq -sql -arqs -drqs -mrqs -srqs -srqsl -astree -dstree -mstree -sstree -as -ds -ss -auser -duser -muser -suser -suserl -au -du -dul -mu -su -sul -ke -km -ks -msconf -sconf -sss -secl -tsm " # # autocomplete the qconf base command # if [ "${prev##*/}" = "qconf" ] then COMPREPLY=($(compgen -W "$opts" -- "$cur")) return 0 fi # # autocomplete the arguments to some of the commands. # local poss case "${qswitch}" in -dh ) poss="`qconf -sh |xargs echo`";; -mcal | -dcal | -scal ) poss="`qconf -scall |xargs echo`";; -mckpt | -dckpt | -sckpt ) poss="`qconf -sckptl |xargs echo`";; -me | -de | -se ) poss="`qconf -sel |xargs echo`";; -ae ) poss="`qconf -sel |xargs echo`";; -ke ) poss="`qconf -sel |xargs echo` all";; -mconf | -sconf ) poss="`qconf -sconfl |xargs echo` global";; -dconf ) poss="`qconf -sconfl |xargs echo`";; -mhgrp | -dhgrp | -shgrp ) poss="`qconf -shgrpl |xargs echo`";; -dm ) poss="`qconf -sm |xargs echo`";; -do ) poss="`qconf -so |xargs echo`";; -mp | -dp | -sp ) poss="`qconf -spl |xargs echo`";; -mprj | -dprj | -sprj ) poss="`qconf -sprjl |xargs echo`";; -mq | -dq | -sq ) poss="`qconf -sql |xargs echo`";; -mrqs | -drqs | -srqsl ) poss="`qconf -srqsl |xargs echo`";; -ds ) poss="`qconf -ss |xargs echo`";; -muser | -duser | -suser ) poss="`qconf -suserl |xargs echo`";; -au | -du ) poss="`qconf -suserl |xargs echo`";; -mu | -dul | -su ) poss="`qconf -sul |xargs echo`";; * ) poss="";; esac COMPREPLY=($(compgen -W "${poss}" -- ${cur})) return 0 } complete -F _qconf_complete qconf