/etc/bash_completion.d/cupt is in cupt 2.3.2.
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 | _cupt()
{
local cur subcommands subcommand command arguments package_name_arguments common_options
subcommands='-h --help help \
-v --version version \
config-dump show showsrc search \
depends rdepends why policy policysrc \
pkgnames changelog copyright screenshots \
snapshot update \
install remove full-upgrade safe-upgrade dist-upgrade reinstall \
build-dep satisfy source \
clean autoclean shell \
markauto unmarkauto showauto'
COMPREPLY=()
command="${COMP_WORDS[0]}"
cur="${COMP_WORDS[COMP_CWORD]}"
local previous_word="${COMP_WORDS[$((COMP_CWORD-1))]}"
if [ "${previous_word}" == "-o" ] || [ "${previous_word}" == "--option" ]; then
COMPREPLY=($(compgen -W "$($command config-dump | sed 's/ .*//')" -- ${cur}))
if type -t __ltrim_colon_completions > /dev/null; then
__ltrim_colon_completions ${cur}
fi
return 0;
fi
# determining subcommand
for word_number in `seq 1 $((COMP_CWORD-1))`; do
if [[ "${COMP_WORDS[word_number]}" != -* ]]; then
# ok, that should be subcommand
subcommand="${COMP_WORDS[word_number]}"
break
fi
done
if [ "${subcommand}" == "" ]; then
# there's no main subcommand yet
arguments=${subcommands}
else
# found subcommand, go case by case then
local subcommand_type
case "${subcommand}" in
install|remove|full-upgrade|safe-upgrade|dist-upgrade|reinstall|build-dep)
subcommand_type='manage'
;;
source)
subcommand_type='query'
arguments='--tar-only --diff-only --dsc-only --download-only'
;;
show|showsrc)
subcommand_type='query'
arguments='--all-versions -a --no-all-versions --with-release-info'
;;
why|policy|policysrc|pkgnames|changelog|copyright|screenshots)
subcommand_type='query'
;;
search)
arguments='--case-sensitive --names-only -n'
;;
depends|rdepends)
subcommand_type='query'
arguments='--with-suggests --recurse'
;;
snapshot)
arguments='list save load remove rename'
;;
markauto|unmarkauto)
package_name_arguments="$(${command} pkgnames ${cur} --installed-only)"
;;
showauto)
arguments='--invert'
;;
esac
if ([ "${subcommand_type}" == "query" ] || [ "${subcommand_type}" == "manage" ]) && [[ "${cur}" != -* ]]; then
package_name_arguments="$(${command} pkgnames ${cur})"
fi
if [ "${subcommand_type}" == "query" ]; then
# query-specific options
arguments="${arguments} --important --installed-only"
fi
if [ "${subcommand_type}" == "manage" ]; then
# manage-specific options
arguments="${arguments} --no-remove --no-auto-remove --simulate -s \
--resolver=fair --resolver=full --max-solution-count= \
--no-install-recommends -R --show-versions -V
--show-size-changes -Z --show-reasons --show-deps -D \
--no-install-unpacked --download-only -d \
--summary-only --no-summary \
--assume-yes --yes -y"
fi
fi
common_options="-o --option --target-release --default-release -t --purge --quiet -q"
common_options="${common_options} --include-archives= --exclude-archives= --include-codenames= --exclude-codenames="
arguments="${arguments} ${common_options}"
arguments=$(compgen -W "${arguments}" -- ${cur})
COMPREPLY=(${arguments} ${package_name_arguments})
return 0
}
complete -F _cupt cupt
|