whitespaces

This commit is contained in:
Jérémy Lecour 2020-04-11 09:58:37 +02:00 committed by Jérémy Lecour
parent e01a705cff
commit 908e3c8b3a

View file

@ -5,24 +5,24 @@
function _bkctld() function _bkctld()
{ {
local cur prev commands jails keys local cur prev commands jails keys
cur=${COMP_WORDS[COMP_CWORD]}; cur=${COMP_WORDS[COMP_CWORD]};
prev=${COMP_WORDS[COMP_CWORD-1]}; prev=${COMP_WORDS[COMP_CWORD-1]};
commands=$(find /usr/lib/bkctld/ -name "bkctld-*" -exec basename {} \;|sed 's/^bkctld-//') commands=$(find /usr/lib/bkctld/ -name "bkctld-*" -exec basename {} \; | sed 's/^bkctld-//')
if [ $COMP_CWORD -eq 1 ]; then if [ $COMP_CWORD -eq 1 ]; then
COMPREPLY=($(compgen -W '${commands}' -- ${cur})) COMPREPLY=($(compgen -W '${commands}' -- ${cur}))
elif [ $COMP_CWORD -eq 2 ]; then elif [ $COMP_CWORD -eq 2 ]; then
[ -f /etc/default/bkctld ] && source /etc/default/bkctld [ -f /etc/default/bkctld ] && source /etc/default/bkctld
[ -z "${JAILDIR}" ] && JAILDIR='/backup/jails' [ -z "${JAILDIR}" ] && JAILDIR='/backup/jails'
jails=$(ls "${JAILDIR}") jails=$(ls "${JAILDIR}")
COMPREPLY=($(compgen -W "${jails}" -- ${cur})) COMPREPLY=($(compgen -W "${jails}" -- ${cur}))
elif [ $COMP_CWORD -eq 3 ]; then elif [ $COMP_CWORD -eq 3 ]; then
keys=$(ls *.pub) keys=$(ls *.pub)
COMPREPLY=($(compgen -W "${keys}" -- ${cur})) COMPREPLY=($(compgen -W "${keys}" -- ${cur}))
fi fi
return 0 return 0
} && } &&
complete -F _bkctld bkctld complete -F _bkctld bkctld