/etc/bash_completion.d/dzhandle is in zope-common 0.5.52.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | #-*- mode: shell-script;-*-
# Debian GNU/Linux dzhandle(1) completion
# Copyright 2006 Fabio Tranchitella <kobold@debian.org>
have dzhandle &&
_dzhandle()
{
local cur prev options paroptions i delayed_options ZVER
COMPREPLY=()
cur=${COMP_WORDS[COMP_CWORD]}
options='-h --help -v --verbose -f --force -z --zope-versions -u --user -c --config-file'
actions=$(
{
dzhandle | grep -e '^actions:' -A 100 | grep -e '^ ' | awk '{print $1;}'
} | sort -u)
ZVER=`echo $COMP_LINE| sed -e 's/.* -z *\([^ ]\+\) .*/-z\1/g' | grep -e '^-'`
paroptions=""
i=${COMP_CWORD}
realprev=${COMP_WORDS[COMP_CWORD-1]}
while [ "$i" -gt 0 ]; do
i=$(($i-1))
prev=${COMP_WORDS[i]}
if [ $(echo "$actions" | sed -e 's/ /\n/g' | grep -e "^$prev$" | wc -l) -eq 1 ]; then
[ "$prev" != "zopectl" ] && [ "$prev" != "zeoctl" ] && \
paroptions=`dzhandle $prev --help | grep -e '^ -' | sed -e 's/,//g' | \
sed -e 's/ /\n/g' | egrep '^-' | cut -d"=" -f1 | sort | uniq`
break;
fi
done
if [ -z "$paroptions" ]; then
paroptions="$options $actions"
fi
if [ "$prev" == "make-instance" ] ; then
case $realprev in
--addon-mode|-m)
delayed_options='all manual'
COMPREPLY=( $( compgen -W "$delayed_options" | grep ^$cur ) )
;;
--restart|-r)
delayed_options='configuring end manually'
COMPREPLY=( $( compgen -W "$delayed_options" | grep ^$cur ) )
;;
--addon-install-technique|-a)
delayed_options='linked tree-linked copied'
COMPREPLY=( $( compgen -W "$delayed_options" | grep ^$cur ) )
;;
*)
COMPREPLY=( $(
compgen -W "$paroptions" | grep "^$cur"
) )
;;
esac
elif [ "$prev" == "purge-instance" ] || [ "$prev" == "remove-instance" ] || [ "$prev" == "show-instance" ] || \
[ "$prev" == "zopectl" ] ; then
[ "$prev" == "$realprev" ] && \
COMPREPLY=( $(
compgen -W "`dzhandle $ZVER list-instances | awk '{print $1}' | sort -u`" | grep "^$cur"
) )
elif [ "$prev" == "purge-zeoinstance" ] || [ "$prev" == "show-zeoinstance" ] || [ "$prev" == "zeoctl" ] ; then
[ "$prev" == "$realprev" ] && \
COMPREPLY=( $(
compgen -W "`dzhandle $ZVER list-zeoinstances | awk '{print $1}' | sort -u`" | grep "^$cur"
) )
elif [ "$prev" == "add-product" ] || [ "$prev" == "remove-product" ] ; then
if [ "$prev" == "$realprev" ] ; then
COMPREPLY=( $(
compgen -W "`dzhandle $ZVER list-instances | awk '{print $1}' | sort -u`" | grep "^$cur"
) )
else
COMPREPLY=( $(
compgen -W "`dzhandle $ZVER list-products| grep -e '^product' | awk '{print $2;}' | sort -u`" | grep "^$cur"
) )
fi
else
COMPREPLY=( $(
compgen -W "$paroptions" | grep "^$cur"
) )
fi
return 0
}
[ "$have" ] && complete -F _dzhandle -o filenames dzhandle
|