about summary refs log tree commit diff
path: root/Completion/Debian/Command/_bts
blob: 70b95ef9609b3bda4f2239ba9b7c3518cbffb953 (plain) (blame)
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
#compdef bts

local expl first=1

_arguments -A "-*" \
  '(-o --offline)'{-o,--offline}'[use cached bugs]' \
  '(--online --no-offline)'{--online,--no-offline}'[do not use cached bugs]' \
  '(--cache --no-cache)--cache[cache new versions of pages]' \
  '(--cache --no-cache)--no-cache[do not cache new versions of pages]' \
  '--cache-mode=:cache mode:(min mbox full)' \
  '--cache-delay=:seconds:' \
  '--mbox[open a mail reader to read the corresponding mbox]' \
  '--mailreader=:reader:' \
  '(-f --force-refresh)'{-f,--force-refresh}'[download bug report even if unchanged]' \
  '-no-force-refresh[do not force refresh]' \
  '(-q --quiet)*'{-q,--quiet}'[only display info about newly cached pages]' \
  '(--no-conf --noconf)*'{--no-conf,--noconf}'[do not read any config files]' \
  '*:subcommand and args:->subcmds' && return 0

compset -N '-[^0-9]##' && first=0
compset -N '[,.]' && first=0
[[ $first -eq 0 ]] || compset -n 2

if [[ CURRENT -eq 1 ]]; then
  _wanted cmd expl 'bts command' compadd show bugs reopen retitle \
      reassign merge unmerge tag tags severity forwarded notforwarded help \
      clone submitter found notfound block unblock user usertag usertags \
      package owner noowner reportspam cache cleancache claim unclaim \
      subscribe unsubscribe fixed notfixed affects spamreport status \
      select done archive unarchive summary forcemerge limit listcachedbugs \
      version
  return
fi

case "$words[1]" in
  (unmerge|notforwarded|noowner|reportspam|spamreport|archive|unarchive)
    if [[ CURRENT -eq 2 ]]; then
      _debbugs_bugnumber
    else
      _wanted sep expl 'separator' compadd -S ' ' , .
    fi
  ;;
  (show|bugs)
    if [[ CURRENT -eq 2 ]]; then
      _alternative \
        'packages:package:_deb_packages avail' \
        'emails:package maintainer:compadd $DEBEMAIL' \
        'bugnum:bug number:_debbugs_bugnumber'
    else
      _wanted sep expl 'separator' compadd -S ' ' , .
    fi
  ;;
  reopen)
    if [[ CURRENT -eq 2 ]]; then
      _debbugs_bugnumber
    elif [[ CURRENT -eq 3 ]]; then
      _wanted submitter expl 'new submitter' compadd -- $DEBEMAIL
    else
      _wanted sep expl 'separator' compadd -S ' ' , .
    fi
  ;;
  retitle)
    if [[ CURRENT -eq 2 ]]; then
      _debbugs_bugnumber
    elif [[ CURRENT -eq 3 ]]; then
     _message -e submitter 'new title'
    else
     _wanted sep expl 'separator' compadd -S ' ' , .
    fi
  ;;
  reassign)
    if [[ CURRENT -eq 2 ]]; then
      _debbugs_bugnumber
    elif [[ CURRENT -eq 3 ]]; then
     _wanted submitter expl 'new package' _deb_packages avail
    else
     _wanted sep expl 'separator' compadd -S ' ' , .
    fi
  ;;
  (status)
    # TODO: some additional syntaxes aren't being completed.
  ;&
  (merge|forcemerge)
    _debbugs_bugnumber
    if [[ CURRENT -gt 2 ]]; then
     _wanted sep expl 'separator' compadd -S ' ' , .
    fi
  ;;
  tags#)
    if [[ CURRENT -eq 2 ]]; then
      _debbugs_bugnumber
    elif [[ CURRENT -eq 3 ]]; then
      _wanted operator expl 'operator' compadd - '+' '-' '='
    elif [[ CURRENT -eq 4 ]]; then
      _wanted tag expl 'tag' \
	 compadd patch wontfix moreinfo unreproducible help pending \
	 fixed security upstream confirmed fixed-upstream \
	 fixed-in-experimental d-i ipv6 lfs l10n potato woody sarge \
	 sarge-ignore etch etch-ignore lenny lenny-ignore squeeze \
	 squeeze-ignore wheezy wheezy-ignore sid experimental
    else
      _wanted tag expl 'tag' \
	 compadd patch wontfix moreinfo unreproducible help pending \
	 fixed security upstream confirmed fixed-upstream \
	 fixed-in-experimental d-i ipv6 lfs l10n potato woody sarge \
	 sarge-ignore etch etch-ignore lenny lenny-ignore squeeze \
	 squeeze-ignore wheezy wheezy-ignore sid experimental
      _wanted sep expl 'separator' compadd -S ' ' , .
    fi
  ;;
  severity)
    if [[ CURRENT -eq 2 ]]; then
      _debbugs_bugnumber
    elif [[ CURRENT -eq 3 ]]; then
      _wanted severity expl 'severity' \
	  compadd wishlist minor normal serious important critical grave
    else
      _wanted sep expl 'separator' compadd -S ' ' , .
    fi
  ;;
  forwarded)
    if [[ CURRENT -eq 2 ]]; then
      _debbugs_bugnumber
    elif [[ CURRENT -eq 3 ]]; then
     _wanted upstream expl 'upstream email' _email_addresses -c
    else
     _wanted sep expl 'separator' compadd -S ' ' , .
    fi
  ;;
  (clone)
    if [[ CURRENT -eq 2 ]]; then
      _debbugs_bugnumber
    elif [[ CURRENT -eq 3 || -prefix [-] ]]; then
     _wanted newid expl 'new ID' compadd -- -{1..9}
    else
     _wanted sep expl 'separator' compadd -S ' ' , .
    fi
  ;;
  (submitter)
    if [[ CURRENT -eq 2 ]]; then
      _debbugs_bugnumber
    else
     _alternative \
       'bugnum:bug number:_debbugs_bugnumber' \
       'email:email address:_email_addresses -c' \
       'bang:bang:compadd \!'
    fi
  ;;
  (owner|subscribe|unsubscribe)
    if [[ CURRENT -eq 2 ]]; then
      _debbugs_bugnumber
    elif [[ CURRENT -eq 3 ]]; then
      _alternative \
        'email:email address:_email_addresses -c' \
        'bang:bang:compadd \!'
    else
      _wanted sep expl 'separator' compadd -S ' ' , .
    fi
  ;;
  (found|notfound|fixed|notfixed)
    if [[ CURRENT -eq 2 ]]; then
      _debbugs_bugnumber
    elif [[ CURRENT -eq 3 ]]; then
      _message -e version 'version'
    else
      _wanted sep expl 'separator' compadd -S ' ' , .
    fi
  ;;
  (block|unblock)
    if [[ CURRENT -eq 2 ]]; then
      _debbugs_bugnumber
    elif [[ CURRENT -eq 3 ]]; then
      _wanted prep expl 'preposition' compadd by with
    else
     _alternative \
       'bugnum:bug number:_debbugs_bugnumber' \
       'separator:separator:compadd -S " " , .'
    fi
  ;;
  (user)
    if [[ CURRENT -eq 2 ]]; then
      _wanted upstream expl 'user email for usertags' _email_addresses -c
    else
      _wanted sep expl 'separator' compadd -S ' ' , .
    fi
  ;;
  (usertags#)
    if [[ CURRENT -eq 2 ]]; then
      _debbugs_bugnumber
    elif [[ CURRENT -eq 3 ]]; then
      _wanted operator expl 'operator' compadd - '+' '-' '='
    elif [[ CURRENT -eq 4 ]]; then
      _message -e usertag 'user tag'
    else
      _message -e usertag 'user tag'
      _wanted sep expl 'separator' compadd -S ' ' , .
    fi
  ;;
  (package)
    if [[ CURRENT -eq 2 ]]; then
     _wanted package expl 'package' _deb_packages avail
    else
     _wanted sep expl 'separator' compadd -S ' ' , .
    fi
  ;;
  (cache)
     _alternative \
       'source-packages:source package:_deb_packages -P "src:" source' \
       'package:binary package:_deb_packages avail' \
       'email:email address:_email_addresses -c -P "from:"' \
       'bugnum:bug number:_debbugs_bugnumber' \
       'rc:rc:compadd release-critical'
  ;;
  (cleancache)
     _alternative \
       'source-packages:source package:_deb_packages -P "src:" source' \
       'package:binary package:_deb_packages avail' \
       'email:email address:_email_addresses -c -P "from:"' \
       'bugnum:bug number:_debbugs_bugnumber' \
       'all:all:compadd ALL'
  ;;
  (claim|unclaim)
    if [[ CURRENT -eq 2 ]]; then
      _debbugs_bugnumber
    elif [[ CURRENT -eq 3 ]]; then
      _alternative \
        'email:email address:_email_addresses -c' \
	'separator:separator:compadd -S " " , .'
    else
      _wanted sep expl 'separator' compadd -S ' ' , .
    fi
  ;;
  (affects)
    if [[ CURRENT -eq 2 ]]; then
      _debbugs_bugnumber
    elif [[ CURRENT -eq 3 ]]; then
      _wanted operator expl 'operator' compadd - '+' '-' '='
    else
      _wanted package expl 'package' _deb_packages avail
    fi
  ;;
  (summary)
    case $CURRENT in
      (2) _debbugs_bugnumber;;
      (3) _message -e message-number 'message number';&
      (4) _wanted sep expl 'separator' compadd -S ' ' , .;;
    esac
  ;;
  (close|done)
    case $CURRENT in
      (2) _debbugs_bugnumber;;
      (3) _message -e version 'version';&
      (4) _wanted sep expl 'separator' compadd -S ' ' , .;;
    esac
  ;;
  (select)
    _values -S : -w "select field" \
      '*package[binary package]: :_deb_packages avail' \
      '*source[source package]: :_deb_packages source' \
      '*maintainer:email address of the maintainer:_email_addresses -c' \
      '*submitter:email address of the submitter:_email_addresses -c' \
      '*severity:severity:(wishlist minor normal important serious grave critical)' \
      '*tag[tags applied to the bug]:tags:' \
      '*owner:owner:_email_addresses -c' \
      '*correspondent:email address of a correspondent:_email_addresses -c' \
      '*affects:affected package:_deb_packages avail' \
      '*users:namespaces of usertags:_email_addresses -c' \
      '*archive:whether to search archived bugs:((0:no 1:yes both:both))'
      # undocumented: bugs
    _wanted sep expl 'separator' compadd -S ' ' , .
  ;;
  (limit)
    _values -S : -w "limit field" \
      '*submitter[email address of the submitter]:submitter:_email_addresses -c' \
      '*date[bug submission timestamp]:unix timestamp' \
      '*subject[subject of the bug]:bug subject:' \
      '*msgid[message-id of the initial bug report]:message-id:' \
      '*package[binary package]: :_deb_packages avail' \
      '*source[source package]: :_deb_packages source' \
      '*tag[tags applied to the bug]:tags:' \
      '*severity:severity:(wishlist minor normal important serious grave critical)' \
      '*owner:owner:_email_addresses -c' \
      '*affects:affected package:_deb_packages avail' \
      '*archive:whether to search archived bugs:((0:no 1:yes both:both))'
    _wanted sep expl 'separator' compadd -S ' ' , .
  ;;
  help)
  ;&
  *) _wanted sep expl 'separator' compadd -S ' ' , .
  ;;
esac