summaryrefslogtreecommitdiffstats
path: root/scripts/debdiff.bash_completion
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:53:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:53:52 +0000
commitefe47381c599b07e4c7bbdb2e91e8090a541c887 (patch)
tree05cf57183f5a23394eca11b00f97a74a5dfdf79d /scripts/debdiff.bash_completion
parentInitial commit. (diff)
downloaddevscripts-efe47381c599b07e4c7bbdb2e91e8090a541c887.tar.xz
devscripts-efe47381c599b07e4c7bbdb2e91e8090a541c887.zip
Adding upstream version 2.23.4+deb12u1.upstream/2.23.4+deb12u1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/debdiff.bash_completion')
-rw-r--r--scripts/debdiff.bash_completion154
1 files changed, 154 insertions, 0 deletions
diff --git a/scripts/debdiff.bash_completion b/scripts/debdiff.bash_completion
new file mode 100644
index 0000000..d6f373c
--- /dev/null
+++ b/scripts/debdiff.bash_completion
@@ -0,0 +1,154 @@
+# /usr/share/bash-completion/completions/debdiff
+# Bash command completion for ‘debdiff(1)’.
+# Documentation: ‘bash(1)’, section “Programmable Completion”.
+
+# This is free software, and you are welcome to redistribute it under
+# certain conditions; see the end of this file for copyright
+# information, grant of license, and disclaimer of warranty.
+
+_have debdiff &&
+_debdiff () {
+ local cur prev words cword
+ _init_completion || return
+
+ local i
+ local command_name=debdiff
+ local options=(
+ -h --help -v --version
+ -q --quiet
+ -d --dirs --nodirs
+ -w --ignore-space
+ --diffstat --no-diffstat
+ --auto-ver-sort --no-auto-ver-sort
+ --unpack-tarballs --no-unpack-tarballs
+ --apply-patches --no-apply-patches
+ --control --nocontrol --controlfiles
+ --wdiff-source-control --no-wdiff-source-control --wp --wl --wt
+ --show-moved --noshow-moved --renamed
+ --debs-dir
+ --from
+ --move --move-regex
+ --exclude
+ )
+
+ local file_list_mode=normal
+ local -i move_from=-1
+ local -i move_to=-1
+
+ unset COMPREPLY
+
+ case "$prev" in
+ "$command_name")
+ options+=( --noconf --no-conf )
+ ;;
+
+ --debs-dir)
+ COMPREPLY=( $( compgen -A directory -- "$cur" ) )
+ ;;
+
+ esac
+
+ if [[ -v COMPREPLY ]] ; then
+ return 0
+ fi
+
+ for (( i=1; i<${#words[@]}; i++ )); do
+ if [[ $file_list_mode == @(deb|dsc|changes) ]]; then
+ if (( i == ${#words[@]}-1 )); then
+ break
+ else
+ COMPREPLY=()
+ return 0
+ fi
+ fi
+ if (( ${move_from} == -1 && ${move_to} == -1 )); then
+ file_list_mode=normal
+ elif (( ${move_from} >= 0 && ${move_to} == -1 )); then
+ file_list_mode=from
+ elif (( ${move_from} >= 0 && ${move_to} >= 0 && ${move_to} < ${move_from} )); then
+ file_list_mode=to
+ else
+ COMPREPLY=()
+ return 0
+ fi
+ if [[ $file_list_mode == normal && ${words[i]} == --from ]]; then
+ move_from=0
+ file_list_mode=from
+ elif [[ $file_list_mode == normal && ${words[i]} == *.deb ]]; then
+ file_list_mode=deb
+ elif [[ $file_list_mode == normal && ${words[i]} == *.udeb ]]; then
+ file_list_mode=deb
+ elif [[ $file_list_mode == normal && ${words[i]} == *.dsc ]]; then
+ file_list_mode=dsc
+ elif [[ $file_list_mode == normal && ${words[i]} == *.changes ]]; then
+ file_list_mode=changes
+ elif [[ $file_list_mode == from && ${words[i]} == *.deb ]]; then
+ (( ++move_from ))
+ elif [[ $file_list_mode == from && ${words[i]} == *.udeb ]]; then
+ (( ++move_from ))
+ elif [[ $file_list_mode == from && ${words[i]} == --to ]]; then
+ move_to=0
+ file_list_mode=to
+ elif [[ $file_list_mode = to && ${words[i]} == *.deb ]]; then
+ (( ++move_to ))
+ elif [[ $file_list_mode = to && ${words[i]} == *.udeb ]]; then
+ (( ++move_to ))
+ fi
+ done
+
+ case $file_list_mode in
+ normal)
+ if [[ $prev == --debs-dir ]]; then
+ COMPREPLY=( $( compgen -G "${cur}*" ) )
+ compopt -o dirnames
+ elif [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W "${options[*]}" -- "$cur" ) )
+ else
+ COMPREPLY=( $( compgen -G "${cur}*.@(deb|udeb|dsc|changes)" ) )
+ compopt -o filenames
+ compopt -o plusdirs
+ fi
+ ;;
+ deb|from|to)
+ COMPREPLY=( $( compgen -G "${cur}*.deb" "${cur}*.udeb" ) )
+ if (( $move_from > 0 && $move_to < 0 )) ; then
+ COMPREPLY+=( $( compgen -W "--to" -- "$cur" ) )
+ fi
+ compopt -o filenames
+ compopt -o plusdirs
+ ;;
+ dsc)
+ COMPREPLY=( $( compgen -G "${cur}*.dsc" ) )
+ compopt -o filenames
+ compopt -o plusdirs
+ ;;
+ changes)
+ COMPREPLY=( $( compgen -G "${cur}*.changes" ) )
+ compopt -o filenames
+ compopt -o plusdirs
+ ;;
+ *)
+ COMPREPLY=( $( compgen -W "${options[*]}" -- "$cur" ) )
+ ;;
+ esac
+
+ return 0
+
+} &&
+complete -F _debdiff debdiff
+
+
+# Copyright © 2016–2017 Ben Finney <ben+debian@benfinney.id.au>
+# Copyright © 2015 Nicholas Bamber <nicholas@periapt.co.uk>
+#
+# This is free software: you may copy, modify, and/or distribute this work
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; version 2 of that license or any later version.
+# No warranty expressed or implied. See the file ‘LICENSE.GPL-2’ for details.
+
+# Local variables:
+# coding: utf-8
+# mode: shell-script
+# indent-tabs-mode: nil
+# End:
+# vim: fileencoding=utf-8 filetype=sh expandtab shiftwidth=4 :