109 lines
4.3 KiB
Plaintext
109 lines
4.3 KiB
Plaintext
# prt-get(8), prt-cache(8) completion by Johannes Winkelmann, jw@tks6.net
|
|
# problems: options ending on = should not add a space afterwards
|
|
#
|
|
# 12.03.2023: add the flag --softdeps
|
|
# 28.08.2013: use 'install --group' instead of 'grpinst' (patch by Alan)
|
|
# 07.07.2002: use prt-get listinst (from 0.3.1pre1) instead of pkginfo
|
|
# 06.07.2002: first version
|
|
|
|
_prt-get()
|
|
{
|
|
local cur prev
|
|
|
|
COMPREPLY=()
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
|
prev=${COMP_WORDS[COMP_CWORD-1]}
|
|
|
|
if [ $COMP_CWORD -eq 1 ]; then
|
|
COMPREPLY=( $( compgen -W ' \
|
|
install depinst update help \
|
|
version readme list info path \
|
|
search dsearch fsearch printf cache \
|
|
dependent sysup current lock unlock \
|
|
listlocked diff quickdiff depends quickdep \
|
|
dup isinst cat ls edit deptree \
|
|
remove listinst dumpconfig listorphans' $cur ))
|
|
fi
|
|
|
|
|
|
if [ $COMP_CWORD '>' 1 ]; then
|
|
if [[ "$cur" != -* ]]; then
|
|
case ${COMP_WORDS[1]} in
|
|
"install" | "depinst" | "path" | "dependent" | \
|
|
"depends" | "quickdep" | "info" | "readme" | \
|
|
"ls" | "isinst" | "deptree" )
|
|
if [ -f /var/lib/pkg/prt-get.cache ]; then
|
|
plist=`prt-cache list`
|
|
if [ ! "$plist" == "" ]; then
|
|
COMPREPLY=( $( compgen -W '$plist' $cur ) )
|
|
fi
|
|
fi
|
|
;;
|
|
"cat" | "edit" )
|
|
if [ $COMP_CWORD '>' 2 ]; then
|
|
plist=`prt-get ls ${COMP_WORDS[2]}`
|
|
COMPREPLY=( $( compgen -W '$plist' $cur ) )
|
|
else
|
|
if [ -f /var/lib/pkg/prt-get.cache ]; then
|
|
plist=`prt-cache list`
|
|
if [ ! "$plist" == "" ]; then
|
|
COMPREPLY=( $( compgen -W '$plist' $cur ) )
|
|
fi
|
|
fi
|
|
fi
|
|
;;
|
|
"current"|"lock"|"remove")
|
|
plist=`prt-get listinst`
|
|
COMPREPLY=( $( compgen -W '$plist' $cur ) )
|
|
;;
|
|
"update")
|
|
plist=`prt-get quickdiff`
|
|
COMPREPLY=( $( compgen -W '$plist' $cur ) )
|
|
;;
|
|
"unlock")
|
|
plist=`prt-get listlocked`
|
|
COMPREPLY=( $( compgen -W '$plist' $cur ) )
|
|
;;
|
|
esac
|
|
else
|
|
case ${COMP_WORDS[1]} in
|
|
"install" | "update" | "depinst" )
|
|
COMPREPLY=( $( compgen -W '--config= --cache \
|
|
--pre-install \
|
|
--post-install \
|
|
--install-scripts \
|
|
--log --test --group \
|
|
--config \
|
|
--config-append= \
|
|
--config-prepend= \
|
|
--config-set= \
|
|
--aargs= --margs= \
|
|
--rargs= \
|
|
--install-root=' \
|
|
-- $cur ) )
|
|
;;
|
|
"depends" | "quickdep" | "deptree" | "listorphans" )
|
|
COMPREPLY=( $( compgen -W '--softdeps' -- $cur ) )
|
|
;;
|
|
"dependent" )
|
|
COMPREPLY=( $( compgen -W '--softdeps \
|
|
--recursive \
|
|
--tree' -- $cur ) )
|
|
;;
|
|
"list" | "search" | "dsearch" )
|
|
COMPREPLY=( $( compgen -W '-v -vv --cache \
|
|
--config=' -- $cur ) )
|
|
;;
|
|
*)
|
|
COMPREPLY=( $( compgen -W '--cache --log --test --config=' \
|
|
-- $cur ) )
|
|
;;
|
|
esac
|
|
fi
|
|
fi
|
|
|
|
return 0
|
|
}
|
|
complete -F _prt-get -o default prt-get
|
|
complete -F _prt-get -o default prt-cache
|