diff --git a/bash_completion b/bash_completion new file mode 100644 index 0000000..3284b5e --- /dev/null +++ b/bash_completion @@ -0,0 +1,28 @@ +# bkctld(8) completion +# +# Copyright (c) 2017 Victor Laborie +# + +function _bkctld() +{ + local cur prev commands jails keys + + cur=${COMP_WORDS[COMP_CWORD]}; + prev=${COMP_WORDS[COMP_CWORD-1]}; + commands="init update remove start stop reload restart sync status key port ip inc rm" + + if [ $COMP_CWORD -eq 1 ]; then + COMPREPLY=($(compgen -W '${commands}' -- ${cur})) + elif [ $COMP_CWORD -eq 2 ]; then + [ -f /etc/default/bkctld ] && source /etc/default/bkctld + [ -z "${JAILDIR}" ] && JAILDIR='/backup/jails' + jails=$(ls "${JAILDIR}") + COMPREPLY=($(compgen -W "${jails}" -- ${cur})) + elif [ $COMP_CWORD -eq 3 ]; then + keys=$(ls *.pub) + COMPREPLY=($(compgen -W "${keys}" -- ${cur})) + fi + + return 0 +} && +complete -F _bkctld bkctld diff --git a/debian/changelog b/debian/changelog index bc96747..01273b9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +bkctld (1.1) unstable; urgency=high + + * Add bash completion + + -- Victor Laborie Thu, 02 Feb 2017 18:24:50 +0100 + bkctld (1.0.2) unstable; urgency=high * Fix bkctld sync diff --git a/debian/compat b/debian/compat index 7f8f011..ec63514 100644 --- a/debian/compat +++ b/debian/compat @@ -1 +1 @@ -7 +9 diff --git a/debian/control b/debian/control index 9a7f770..1f0de55 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: bkctld Section: utils Priority: optional Maintainer: Victor Laborie -Build-Depends: debhelper +Build-Depends: debhelper (>= 9), dh-exec Standards-Version: 3.9.6 Package: bkctld diff --git a/debian/install b/debian/install old mode 100644 new mode 100755 index d084355..e673ce9 --- a/debian/install +++ b/debian/install @@ -1,3 +1,5 @@ +#!/usr/bin/dh-exec bkctld usr/sbin tpl/* usr/share/bkctld docs/zzz_evobackup usr/share/doc/bkctld +bash_completion => /etc/bash_completion.d/bkctld