diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:03:18 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 01:03:18 +0000 |
commit | f2621414ee5f2f601424c22f00e207903e3b6104 (patch) | |
tree | 56a856dafd1ca684bb23263cacaa723ee4f404fc /completions/apt-mark | |
parent | Adding debian version 1:2.11-8. (diff) | |
download | bash-completion-f2621414ee5f2f601424c22f00e207903e3b6104.tar.xz bash-completion-f2621414ee5f2f601424c22f00e207903e3b6104.zip |
Merging upstream version 1:2.12.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'completions/apt-mark')
-rw-r--r-- | completions/apt-mark | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/completions/apt-mark b/completions/apt-mark new file mode 100644 index 0000000..7ef3f76 --- /dev/null +++ b/completions/apt-mark @@ -0,0 +1,64 @@ +# Debian apt-mark(8) completion -*- shell-script -*- + +_comp_cmd_apt_mark() +{ + local cur prev words cword was_split comp_args + _comp_initialize -s -- "$@" || return + + local special="" i + for ((i = 1; i < cword; i++)); do + if [[ ${words[i]} == @(auto|manual|minimize-manual|showauto|showmanual|hold|unhold|showhold|install|remove|deinstall|purge|showinstall|showremove|showpurge) ]]; then + special=${words[i]} + break + fi + done + + if [[ $special ]]; then + case $special in + auto | manual | unhold) + local -A showcmds=([auto]=manual [manual]=auto [unhold]=hold) + local showcmd=${showcmds[$special]} + _comp_compgen_split -- "$("$1" "show$showcmd" 2>/dev/null)" + return + ;; + minimize-manual) + return + ;; + *) + _comp_compgen -x apt-get installed_packages + ;; + esac + return + fi + + local noargopts='!(-*|*[ocf]*)' + # shellcheck disable=SC2254 + case $prev in + --help | --version | --option | -${noargopts}[hvo]) + return + ;; + --config-file | -${noargopts}c) + _comp_compgen_filedir conf + return + ;; + --file | -${noargopts}f) + _comp_compgen_filedir + return + ;; + esac + + [[ $was_split ]] && return + + if [[ $cur == -* ]]; then + _comp_compgen -- -W '--file= --help --version --config-file --option' + [[ ${COMPREPLY-} == *= ]] && compopt -o nospace + else + _comp_compgen -- -W 'auto manual minimize-manual showauto showmanual + hold unhold showhold install remove purge showinstall showremove + showpurge' + fi + +} && + complete -F _comp_cmd_apt_mark apt-mark + +# ex: filetype=sh |