blob: 972fc1e5c229b14a503c6f706f912fd28a1322cf (
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
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
|
# bash completion for pkgcheck
source "/usr/share/bash-completion/helpers/gentoo-common.sh"
_pkgcheck() {
local i cmd cur prev words cword split
_init_completion || return
local subcommands=(
scan
cache
replay
show
)
local base_options=(
-h --help
--version
--debug
-q --quiet
-v --verbose
--color
)
local boolean_options=(
true
false
)
_list_repo_atoms() {
builtin cd "$(git rev-parse --show-toplevel)" || return
if [[ $cur == */* ]]; then
compgen -W "$(compgen -G "${cur}*" )" -- "${cur}"
else
compgen -W "$(compgen -G "${cur}*" -S / )" -- "${cur}"
fi
}
if [[ ${prev} == "--color" ]]; then
COMPREPLY=($(compgen -W "${boolean_options[*]}" -- "${cur}"))
return
fi
COMPREPLY=($(compgen -W "${base_options[*]}" -- "${cur}"))
# find the subcommand
for (( i=1; i < COMP_CWORD; i++ )); do
if [[ ${COMP_WORDS[i]} != -* ]]; then
cmd=${COMP_WORDS[i]}
break
fi
done
if (( i == COMP_CWORD )); then
COMPREPLY+=($(compgen -W "${subcommands}" -- "${cur}"))
return
fi
local subcmd_options
case ${cmd} in
cache)
local subcmd_options=(
--cache-dir
-l --list
-u --update
-R --remove
-f --force
-n --dry-run
-t --type
)
case ${prev} in
--cache-dir)
_filedir -d
;;
-t | --type)
COMPREPLY=($(compgen -W "$(</usr/share/pkgcheck/caches)" -- "${cur}"))
;;
*)
COMPREPLY+=($(compgen -W "${subcmd_options[*]}" -- "${cur}"))
;;
esac
;;
ci)
local subcmd_options=(
--failures
)
case ${prev} in
--failures)
_filedir
;;
*)
COMPREPLY+=($(compgen -W "${subcmd_options[*]}" -- "${cur}"))
;;
esac
;;
replay)
local subcmd_options=(
-R --reporter
--format
)
case ${prev} in
-R | --reporter)
COMPREPLY=($(compgen -W "$(</usr/share/pkgcheck/reporters)" -- "${cur}"))
;;
--format)
COMPREPLY=()
;;
*)
if [[ ${cur} == -* ]]; then
COMPREPLY+=($(compgen -W "${subcmd_options[*]}" -- "${cur}"))
else
_filedir
fi
;;
esac
;;
scan)
local subcmd_options=(
--config
-r --repo
-R --reporter
-f --filter
-j --jobs
-t --tasks
--cache
--cache-dir
--exit
--net
-C --checksets
-s --scopes
-c --checks
-k --keywords
--timeout
-a --arches
--commits
-p --profiles
)
case ${prev} in
-[jt] | --jobs | --tasks)
COMPREPLY=()
;;
--cache-dir)
_filedir -d
;;
-r | --repo)
COMPREPLY=($(compgen -W "$(_parsereposconf -l)" -- "${cur}"))
;;
-R | --reporter)
COMPREPLY=($(compgen -W "$(</usr/share/pkgcheck/reporters)" -- "${cur}"))
;;
-c | --checks)
COMPREPLY=($(compgen -W "$(</usr/share/pkgcheck/checks)" -- "${cur}"))
;;
-k | --keywords)
COMPREPLY=($(compgen -W "$(</usr/share/pkgcheck/keywords)" -- "${cur}"))
;;
-s | --scopes)
COMPREPLY=($(compgen -W "$(</usr/share/pkgcheck/scopes)" -- "${cur}"))
;;
-f | --filter)
local filter_options=(
latest
no
)
COMPREPLY=($(compgen -W "${filter_options[*]}" -- "${cur}"))
;;
*)
case ${cur} in
-*)
COMPREPLY+=($(compgen -W "${subcmd_options[*]}" -- "${cur}"))
;;
*)
_pkgname -A "${cur}"
;;
esac
;;
esac
;;
show)
local subcmd_options=(
-k --keywords
-c --checks
-s --scopes
-r --reporters
-C --caches
)
COMPREPLY+=($(compgen -W "${subcmd_options[*]}" -- "${cur}"))
;;
esac
}
complete -F _pkgcheck pkgcheck
# vim: set ft=bash sw=4 et sts=4 :
|