# bash programmable completion for slapt-get by # Pedro Pinto (pnboy~AT~pinguix.com) # # taken from http://jaos.org/pipermail/slapt-get-user/2004-May/000089.html # complete_slaptget() { cur=${COMP_WORDS[COMP_CWORD]} if [ "${COMP_WORDS[$[$COMP_CWORD-1]]}" = "--remove" ]; then COMPREPLY=( $( cd /var/log/packages; ls "$cur"* 2> /dev/null | sed -e 's/-[^-]*-[^-]*-[^-]*$//') ) else COMPREPLY=( $( slapt-get --search "^$cur" 2> /dev/null | awk '{print $1}' ) ) fi } complete -F complete_slaptget -o default slapt-get