2009-06-08 20:49:52 +03:00
|
|
|
# bash completion for Slackware Linux pkgtools
|
|
|
|
|
2010-05-24 00:08:57 +04:00
|
|
|
have pkgtool && [ -f /etc/slackware-version ] &&
|
|
|
|
_pkgtool()
|
|
|
|
{
|
|
|
|
COMPREPLY=()
|
|
|
|
local cur="${COMP_WORDS[COMP_CWORD]}"
|
|
|
|
if [[ "$cur" == -* ]]; then
|
|
|
|
COMPREPLY=( $( compgen -W '--sets --ignore_tagfiles --tagfile \
|
|
|
|
--source_mounted --source_dir --target_dir --source_device' \
|
|
|
|
-- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
local prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
|
|
|
|
|
|
local split=false
|
|
|
|
_split_longopt && split=true
|
|
|
|
|
|
|
|
case $prev in
|
|
|
|
--source_dir|--target_dir)
|
|
|
|
_filedir -d
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--sets)
|
|
|
|
# argument required but no completions available
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--source_device)
|
|
|
|
COMPREPLY=( $( compgen -f -d -- "${cur:-/dev/}" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
$split && return 0
|
|
|
|
|
|
|
|
local IFS=$'\t\n'
|
|
|
|
COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
|
|
|
|
$( compgen -d -- "$cur" ) )
|
|
|
|
} &&
|
|
|
|
complete -F _pkgtool -o filenames pkgtool
|
|
|
|
|
2009-06-08 20:49:52 +03:00
|
|
|
have removepkg && [ -f /etc/slackware-version ] &&
|
|
|
|
_removepkg()
|
|
|
|
{
|
2009-10-04 19:42:50 +02:00
|
|
|
COMPREPLY=()
|
2010-05-24 00:14:02 +04:00
|
|
|
local cur=`_get_cword`
|
2010-05-24 02:01:13 +04:00
|
|
|
if [[ "$cur" == -* ]]; then
|
|
|
|
COMPREPLY=( $( compgen -W '-copy -keep -preserve -warn' \
|
|
|
|
-- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
fi
|
2009-06-08 20:49:52 +03:00
|
|
|
|
2009-10-04 19:42:50 +02:00
|
|
|
COMPREPLY=( $( (cd /var/log/packages; compgen -f -- "$cur") ) )
|
2009-06-08 20:49:52 +03:00
|
|
|
} &&
|
2010-05-24 02:01:13 +04:00
|
|
|
complete -F _removepkg -o filenames removepkg
|
|
|
|
|
|
|
|
complete -o plusdirs -f -X '!*.t[bglx]z' installpkg upgradepkg explodepkg
|
2009-10-01 20:54:51 +03:00
|
|
|
|
|
|
|
# Local variables:
|
|
|
|
# mode: shell-script
|
2009-10-04 19:42:50 +02:00
|
|
|
# sh-basic-offset: 4
|
2009-10-01 20:54:51 +03:00
|
|
|
# sh-indent-comment: t
|
2009-10-04 19:42:50 +02:00
|
|
|
# indent-tabs-mode: nil
|
2009-10-01 20:54:51 +03:00
|
|
|
# End:
|
2009-10-04 19:42:50 +02:00
|
|
|
# ex: ts=4 sw=4 et filetype=sh
|