/usr/share/bash-completion/completions/debtags is in debtags 2.1.5.
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 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | # Debian GNU/Linux debtags(1) completion
# (C) 2004 2005 Emanuele Rocca <ema@debian.org>
# (C) 2017 Enrico Rossi <e.rossi@tecnobrain.com>
# License: GNU GPL v2 or later
# @note: depracated command will not be completed.
_debtags()
{
local cur prev options
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
# Helper function to keep up with ":"
_get_comp_words_by_ref -n : cur prev
options='cat check diff dumpavail grep help \
mkpatch search show submit tagcat tagsearch \
tagshow update vocfilter'
local i
for (( i=0; i < ${#COMP_WORDS[@]}; i++ )); do
case ${COMP_WORDS[i]} in
cat|grep)
if [[ "$cur" == -* ]]; then
options='--facets --names --quiet --invert --help'
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
fi
return 0
;;
check)
if [[ "$cur" == -* ]]; then
options='--facets --names --quiet --help'
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
return 0
fi
_filedir
return 0
;;
diff|mkpatch)
if [[ "$cur" == -* ]]; then
options='--help'
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
return 0
fi
_filedir
return 0
;;
tagshow)
# No more that 1 args
if [[ "$COMP_CWORD" -gt 4 ]]; then
return 0
fi
if [[ "$cur" == -* ]]; then
options='--help'
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
return 0
fi
COMPREPLY=( $( grep "^Tag: $cur" /var/lib/debtags/vocabulary |cut -b 6- ) )
# Helper function to keep up with ":"
__ltrim_colon_completions "$cur"
return 0
;;
search|dumpavail)
if [[ "$cur" == -* ]]; then
options='--names --quiet --full --short --invert --help'
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
return 0
fi
COMPREPLY=( $( grep "^Tag: $cur" /var/lib/debtags/vocabulary |cut -b 6- ) )
# Helper function to keep up with ":"
__ltrim_colon_completions "$cur"
return 0
;;
*)
;;
esac
done
# short or long option
if [[ "$cur" == -* ]]; then
options='--verbose --debug -V --version -? --help'
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
return 0
fi
if [[ "$COMP_CWORD" == 1 ]]; then
COMPREPLY=( $( compgen -W "$options" -- $cur ) )
return 0
fi
} && complete -F _debtags debtags
# ex: ts=4 sw=4 et filetype=sh
|