128 lines
2.8 KiB
Bash
128 lines
2.8 KiB
Bash
# bash completion for Slackware Linux pkgtools
|
|
|
|
[ -f /etc/slackware-version ] || return
|
|
|
|
|
|
have pkgtool &&
|
|
_pkgtool()
|
|
{
|
|
local cur prev words cword
|
|
_init_completion || return
|
|
if [[ "$cur" == -* ]]; then
|
|
COMPREPLY=( $( compgen -W '--sets --ignore-tagfiles --tagfile \
|
|
--source-mounted --source_dir --target_dir --source_device' \
|
|
-- "$cur" ) )
|
|
return 0
|
|
fi
|
|
|
|
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
|
|
;;
|
|
--tagfile)
|
|
_filedir
|
|
return 0
|
|
;;
|
|
esac
|
|
} &&
|
|
complete -F _pkgtool pkgtool
|
|
|
|
have removepkg &&
|
|
_removepkg()
|
|
{
|
|
local cur prev words cword
|
|
_init_completion || return
|
|
if [[ "$cur" == -* ]]; then
|
|
COMPREPLY=( $( compgen -W '-copy -keep -preserve -warn' \
|
|
-- "$cur" ) )
|
|
return 0
|
|
fi
|
|
|
|
COMPREPLY=( $( cd /var/log/packages; compgen -f -- "$cur" ) )
|
|
} &&
|
|
complete -F _removepkg removepkg
|
|
|
|
have upgradepkg &&
|
|
_upgradepkg()
|
|
{
|
|
local cur prev words cword
|
|
_init_completion || return
|
|
if [[ "$cur" == -* ]]; then
|
|
COMPREPLY=( $( compgen -W '--dry-run --install-new --reinstall \
|
|
--verbose' -- "$cur") )
|
|
return 0
|
|
fi
|
|
|
|
_filedir "t[bglx]z"
|
|
} && complete -F _upgradepkg upgradepkg
|
|
|
|
have installpkg &&
|
|
_installpkg()
|
|
{
|
|
local cur prev words cword
|
|
_init_completion || return
|
|
if [[ "$cur" == -* ]]; then
|
|
COMPREPLY=( $( compgen -W '--warn --md5sum --root --infobox --terse \
|
|
--menu --ask --priority --tagfile' -- "$cur") )
|
|
return 0
|
|
fi
|
|
|
|
case "$prev" in
|
|
--root)
|
|
_filedir -d
|
|
return 0
|
|
;;
|
|
--priority)
|
|
COMPREPLY=( $( compgen -W 'ADD REC OPT SKP' -- "$cur" ) )
|
|
return 0
|
|
;;
|
|
--tagfile)
|
|
_filedir
|
|
return 0
|
|
;;
|
|
esac
|
|
|
|
_filedir "t[bglx]z"
|
|
} && complete -F _installpkg installpkg
|
|
|
|
have makepkg &&
|
|
_makepkg()
|
|
{
|
|
local cur prev words cword
|
|
_init_completion || return
|
|
if [[ "$cur" == -* ]]; then
|
|
COMPREPLY=( $( compgen -W '-l --linkadd -p --prepend \
|
|
-c --chown' -- "$cur") )
|
|
return 0
|
|
fi
|
|
|
|
case "$prev" in
|
|
-l|--linkadd|-c|--chown)
|
|
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
|
|
return 0
|
|
;;
|
|
esac
|
|
|
|
_filedir
|
|
} && complete -F _makepkg makepkg
|
|
|
|
have explodepkg &&
|
|
complete -o plusdirs -f -X '!*.t[bglx]z' explodepkg
|
|
|
|
# Local variables:
|
|
# mode: shell-script
|
|
# sh-basic-offset: 4
|
|
# sh-indent-comment: t
|
|
# indent-tabs-mode: nil
|
|
# End:
|
|
# ex: ts=4 sw=4 et filetype=sh
|