slackware: added sbopkg completion

This commit is contained in:
Sergey V 2010-11-05 16:46:05 +03:00
parent 49c8d71418
commit a31ce051b6

View File

@ -150,4 +150,55 @@ _slapt-src()
COMPREPLY=( $( grep "^SLACKBUILD NAME: $cur" "$slck_data" | cut -f3- -d\ ) )
} && complete -F _slapt-src slapt-src
have sbopkg &&
_sbopkg()
{
COMPREPLY=()
local cur prev
_get_comp_words_by_ref cur prev
case $prev in
-f)
_filedir
return 0
;;
-s|-g)
return 0
;;
-V)
COMPREPLY='?'
return 0;
;;
-i|-b)
COMPREPLY=( $( grep "^SLACKBUILD NAME: $cur" \
/var/lib/sbopkg/SBo/13.1/SLACKBUILDS.TXT | cut -f3- -d\ ) )
return 0
;;
esac
local config=/etc/sbopkg/sbopkg.conf
for (( i=${#words[@]}-1; i>0; i-- )); do
if [[ ${words[i]} == '-f' ]]; then
config="${words[i+1]}"
break
fi
done
if [ ! -r "$config" ]; then
return 0
fi
if [[ "$cur" == --* ]]; then
COMPREPLY=( $( compgen -W '--help' -- "$cur" ) )
return 0
fi
if [[ "$cur" == -* ]]; then
COMPREPLY=( $( compgen -W '-b -c -d -e -f -g -h -i -k -l \
-o -P -p -q -R -r -s -u -V -v' -- "$cur" ) )
return 0
fi
} && complete -F _sbopkg sbopkg -o plusdirs
}