blob: 7ef3f7680f4fa659c567490f102efdb5093a5e64 (
plain)
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
|
# 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
|