2009-06-08 20:49:52 +03:00
|
|
|
# bash completion for Slackware Linux pkgtools
|
|
|
|
|
2011-04-22 02:35:41 +04:00
|
|
|
[ -f /etc/slackware-version ] || return
|
|
|
|
|
2010-07-25 19:53:04 +04:00
|
|
|
|
|
|
|
have pkgtool &&
|
2010-05-24 00:08:57 +04:00
|
|
|
_pkgtool()
|
|
|
|
{
|
2011-04-22 03:03:22 +04:00
|
|
|
local cur prev words cword
|
|
|
|
_init_completion || return
|
2010-05-24 00:08:57 +04:00
|
|
|
if [[ "$cur" == -* ]]; then
|
2011-03-28 20:26:19 +04:00
|
|
|
COMPREPLY=( $( compgen -W '--sets --ignore-tagfiles --tagfile \
|
|
|
|
--source-mounted --source_dir --target_dir --source_device' \
|
2010-05-24 00:08:57 +04:00
|
|
|
-- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
2011-04-22 03:03:22 +04:00
|
|
|
case "$prev" in
|
2010-05-24 00:08:57 +04:00
|
|
|
--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
|
|
|
|
;;
|
2010-05-24 23:08:11 +04:00
|
|
|
--tagfile)
|
|
|
|
_filedir
|
|
|
|
return 0
|
|
|
|
;;
|
2010-05-24 00:08:57 +04:00
|
|
|
esac
|
|
|
|
} &&
|
2010-05-24 23:08:11 +04:00
|
|
|
complete -F _pkgtool pkgtool
|
2010-05-24 00:08:57 +04:00
|
|
|
|
2010-07-25 19:53:04 +04:00
|
|
|
have removepkg &&
|
2009-06-08 20:49:52 +03:00
|
|
|
_removepkg()
|
|
|
|
{
|
2011-04-22 03:03:22 +04:00
|
|
|
local cur prev words cword
|
|
|
|
_init_completion || return
|
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
|
|
|
|
2011-05-21 17:50:57 +04:00
|
|
|
local root=${ROOT:-/}
|
|
|
|
COMPREPLY=( $( cd "$root/var/log/packages" 2> /dev/null || return 1 ; \
|
|
|
|
compgen -f -- "$cur" ) )
|
2009-06-08 20:49:52 +03:00
|
|
|
} &&
|
2011-01-25 03:48:34 +03:00
|
|
|
complete -F _removepkg removepkg
|
2010-05-24 02:01:13 +04:00
|
|
|
|
2010-07-25 19:53:04 +04:00
|
|
|
have upgradepkg &&
|
2010-05-24 02:28:48 +04:00
|
|
|
_upgradepkg()
|
|
|
|
{
|
2011-04-22 03:03:22 +04:00
|
|
|
local cur prev words cword
|
|
|
|
_init_completion || return
|
2010-05-24 02:28:48 +04:00
|
|
|
if [[ "$cur" == -* ]]; then
|
|
|
|
COMPREPLY=( $( compgen -W '--dry-run --install-new --reinstall \
|
|
|
|
--verbose' -- "$cur") )
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
2011-01-25 03:48:34 +03:00
|
|
|
_filedir "t[bglx]z"
|
|
|
|
} && complete -F _upgradepkg upgradepkg
|
2010-05-24 02:28:48 +04:00
|
|
|
|
2010-07-25 19:53:04 +04:00
|
|
|
have installpkg &&
|
2010-05-24 22:58:52 +04:00
|
|
|
_installpkg()
|
|
|
|
{
|
2011-04-22 03:03:22 +04:00
|
|
|
local cur prev words cword
|
|
|
|
_init_completion || return
|
2010-05-24 22:58:52 +04:00
|
|
|
if [[ "$cur" == -* ]]; then
|
2011-03-28 20:24:00 +04:00
|
|
|
COMPREPLY=( $( compgen -W '--warn --md5sum --root --infobox --terse \
|
2010-05-24 22:58:52 +04:00
|
|
|
--menu --ask --priority --tagfile' -- "$cur") )
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
2011-04-22 03:03:22 +04:00
|
|
|
case "$prev" in
|
2010-05-24 22:58:52 +04:00
|
|
|
--root)
|
|
|
|
_filedir -d
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--priority)
|
|
|
|
COMPREPLY=( $( compgen -W 'ADD REC OPT SKP' -- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
--tagfile)
|
|
|
|
_filedir
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2011-01-25 03:48:34 +03:00
|
|
|
_filedir "t[bglx]z"
|
|
|
|
} && complete -F _installpkg installpkg
|
2010-05-24 22:58:52 +04:00
|
|
|
|
2010-07-25 19:53:04 +04:00
|
|
|
have makepkg &&
|
2010-05-24 23:33:52 +04:00
|
|
|
_makepkg()
|
|
|
|
{
|
2011-04-22 03:03:22 +04:00
|
|
|
local cur prev words cword
|
|
|
|
_init_completion || return
|
2010-05-24 23:33:52 +04:00
|
|
|
if [[ "$cur" == -* ]]; then
|
|
|
|
COMPREPLY=( $( compgen -W '-l --linkadd -p --prepend \
|
|
|
|
-c --chown' -- "$cur") )
|
|
|
|
return 0
|
|
|
|
fi
|
|
|
|
|
2011-04-22 03:03:22 +04:00
|
|
|
case "$prev" in
|
2011-01-25 03:48:34 +03:00
|
|
|
-l|--linkadd|-c|--chown)
|
2010-05-24 23:33:52 +04:00
|
|
|
COMPREPLY=( $( compgen -W 'y n' -- "$cur" ) )
|
|
|
|
return 0
|
|
|
|
;;
|
|
|
|
esac
|
2010-05-30 13:35:00 +04:00
|
|
|
|
|
|
|
_filedir
|
2011-01-25 03:48:34 +03:00
|
|
|
} && complete -F _makepkg makepkg
|
2010-05-24 23:33:52 +04:00
|
|
|
|
2010-07-25 19:53:04 +04:00
|
|
|
have explodepkg &&
|
2010-05-24 22:58:52 +04:00
|
|
|
complete -o plusdirs -f -X '!*.t[bglx]z' explodepkg
|
2011-05-02 13:18:33 +03:00
|
|
|
|
|
|
|
# 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
|