diff options
Diffstat (limited to '')
-rw-r--r-- | scripts/chdist.bash_completion | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/scripts/chdist.bash_completion b/scripts/chdist.bash_completion new file mode 100644 index 0000000..51dbf49 --- /dev/null +++ b/scripts/chdist.bash_completion @@ -0,0 +1,60 @@ +# /usr/share/bash-completion/completions/chdist +# Bash command completion for ‘chdist(1)’. +# Documentation: ‘bash(1)’, section “Programmable Completion”. + +_chdist () +{ + local cur=$2 prev=$3 + local options='--help -h --data-dir -d --arch -a' + local commands='create apt apt-get apt-cache apt-rdepends aptitude + src2bin bin2src + compare-packages compare-bin-packages + compare-versions compare-bin-versions + grep-dctrl-packages grep-dctrl-sources + list' + # Sync'd with buildd.debian.org on 2016-04-02: + local archs="all alpha amd64 arm64 armel armhf hppa hurd-i386 i386 ia64 kfreebsd-amd64 kfreebsd-i386 m68k mips mips64el mipsel powerpc powerpcspe ppc64 ppc64el s390 s390x sh4 sparc sparc64 x32" + local dists=$(ls ~/.chdist 2>/dev/null) + + COMPREPLY=() + + + case "$prev" in + -@(-arch|a)) + COMPREPLY=( $( compgen -W "$archs" -- $cur ) ) + return 0 + ;; + -@(-data-dir|d)) + _filedir + return 0 + ;; + -@(-help|h)|list) + return 0 + ;; + create|apt|apt-get|apt-cache|apt-rdepends|aptitude|src2bin|bin2src|compare-packages|compare-bin-packages|compare-versions|compare-bin-versions|grep-dctrl-packages|grep-dctrl-sources) + COMPREPLY=( $( compgen -W "$dists" -- $cur ) ) + return 0 + esac + + if [[ "$cur" == -* ]]; then + # return one of the possible options + COMPREPLY=( $( compgen -W "$options" -- $cur ) ) + else + # return one of the possible commands + COMPREPLY=( $( compgen -W "$commands" -- $cur ) ) + fi + + return 0 + +} + + +complete -F _chdist chdist + + +# Local variables: +# coding: utf-8 +# mode: shell-script +# indent-tabs-mode: nil +# End: +# vim: fileencoding=utf-8 filetype=sh expandtab shiftwidth=4 : |