1#compdef _git-bug git-bug
2
3
4function _git-bug {
5 local -a commands
6
7 _arguments -C \
8 "1: :->cmnds" \
9 "*::arg:->args"
10
11 case $state in
12 cmnds)
13 commands=(
14 "add:Create a new bug."
15 "bridge:Configure and use bridges to other bug trackers."
16 "commands:Display available commands."
17 "comment:Display or add comments to a bug."
18 "deselect:Clear the implicitly selected bug."
19 "label:Display, add or remove labels to/from a bug."
20 "ls:List bugs."
21 "ls-id:List bug identifiers."
22 "ls-label:List valid labels."
23 "pull:Pull bugs update from a git remote."
24 "push:Push bugs update to a git remote."
25 "select:Select a bug for implicit use in future commands."
26 "show:Display the details of a bug."
27 "status:Display or change a bug status."
28 "termui:Launch the terminal UI."
29 "title:Display or change a title of a bug."
30 "user:Display or change the user identity."
31 "version:Show git-bug version information."
32 "webui:Launch the web UI."
33 )
34 _describe "command" commands
35 ;;
36 esac
37
38 case "$words[1]" in
39 add)
40 _git-bug_add
41 ;;
42 bridge)
43 _git-bug_bridge
44 ;;
45 commands)
46 _git-bug_commands
47 ;;
48 comment)
49 _git-bug_comment
50 ;;
51 deselect)
52 _git-bug_deselect
53 ;;
54 label)
55 _git-bug_label
56 ;;
57 ls)
58 _git-bug_ls
59 ;;
60 ls-id)
61 _git-bug_ls-id
62 ;;
63 ls-label)
64 _git-bug_ls-label
65 ;;
66 pull)
67 _git-bug_pull
68 ;;
69 push)
70 _git-bug_push
71 ;;
72 select)
73 _git-bug_select
74 ;;
75 show)
76 _git-bug_show
77 ;;
78 status)
79 _git-bug_status
80 ;;
81 termui)
82 _git-bug_termui
83 ;;
84 title)
85 _git-bug_title
86 ;;
87 user)
88 _git-bug_user
89 ;;
90 version)
91 _git-bug_version
92 ;;
93 webui)
94 _git-bug_webui
95 ;;
96 esac
97}
98
99function _git-bug_add {
100 _arguments \
101 '(-t --title)'{-t,--title}'[Provide a title to describe the issue]:' \
102 '(-m --message)'{-m,--message}'[Provide a message to describe the issue]:' \
103 '(-F --file)'{-F,--file}'[Take the message from the given file. Use - to read the message from the standard input]:'
104}
105
106
107function _git-bug_bridge {
108 local -a commands
109
110 _arguments -C \
111 "1: :->cmnds" \
112 "*::arg:->args"
113
114 case $state in
115 cmnds)
116 commands=(
117 "auth:List all known bridge authentication credentials."
118 "configure:Configure a new bridge."
119 "pull:Pull updates."
120 "push:Push updates."
121 "rm:Delete a configured bridge."
122 )
123 _describe "command" commands
124 ;;
125 esac
126
127 case "$words[1]" in
128 auth)
129 _git-bug_bridge_auth
130 ;;
131 configure)
132 _git-bug_bridge_configure
133 ;;
134 pull)
135 _git-bug_bridge_pull
136 ;;
137 push)
138 _git-bug_bridge_push
139 ;;
140 rm)
141 _git-bug_bridge_rm
142 ;;
143 esac
144}
145
146
147function _git-bug_bridge_auth {
148 local -a commands
149
150 _arguments -C \
151 "1: :->cmnds" \
152 "*::arg:->args"
153
154 case $state in
155 cmnds)
156 commands=(
157 "add-token:Store a new token"
158 "rm:Remove a credential."
159 "show:Display an authentication credential."
160 )
161 _describe "command" commands
162 ;;
163 esac
164
165 case "$words[1]" in
166 add-token)
167 _git-bug_bridge_auth_add-token
168 ;;
169 rm)
170 _git-bug_bridge_auth_rm
171 ;;
172 show)
173 _git-bug_bridge_auth_show
174 ;;
175 esac
176}
177
178function _git-bug_bridge_auth_add-token {
179 _arguments \
180 '(-t --target)'{-t,--target}'[The target of the bridge. Valid values are [github,gitlab,launchpad-preview]]:'
181}
182
183function _git-bug_bridge_auth_rm {
184 _arguments
185}
186
187function _git-bug_bridge_auth_show {
188 _arguments
189}
190
191function _git-bug_bridge_configure {
192 _arguments \
193 '(-n --name)'{-n,--name}'[A distinctive name to identify the bridge]:' \
194 '(-t --target)'{-t,--target}'[The target of the bridge. Valid values are [github,gitlab,launchpad-preview]]:' \
195 '(-u --url)'{-u,--url}'[The URL of the target repository]:' \
196 '(-o --owner)'{-o,--owner}'[The owner of the target repository]:' \
197 '(-c --credential)'{-c,--credential}'[The identifier or prefix of an already known credential for the API (see "git-bug bridge auth")]:' \
198 '--token[A raw authentication token for the API]:' \
199 '--token-stdin[Will read the token from stdin and ignore --token]' \
200 '(-p --project)'{-p,--project}'[The name of the target repository]:'
201}
202
203function _git-bug_bridge_pull {
204 _arguments \
205 '(-n --no-resume)'{-n,--no-resume}'[force importing all bugs]' \
206 '(-s --since)'{-s,--since}'[import only bugs updated after the given date (ex: "200h" or "june 2 2019")]:'
207}
208
209function _git-bug_bridge_push {
210 _arguments
211}
212
213function _git-bug_bridge_rm {
214 _arguments
215}
216
217function _git-bug_commands {
218 _arguments \
219 '(-p --pretty)'{-p,--pretty}'[Output the command description as well as Markdown compatible comment]'
220}
221
222
223function _git-bug_comment {
224 local -a commands
225
226 _arguments -C \
227 "1: :->cmnds" \
228 "*::arg:->args"
229
230 case $state in
231 cmnds)
232 commands=(
233 "add:Add a new comment to a bug."
234 )
235 _describe "command" commands
236 ;;
237 esac
238
239 case "$words[1]" in
240 add)
241 _git-bug_comment_add
242 ;;
243 esac
244}
245
246function _git-bug_comment_add {
247 _arguments \
248 '(-F --file)'{-F,--file}'[Take the message from the given file. Use - to read the message from the standard input]:' \
249 '(-m --message)'{-m,--message}'[Provide the new message from the command line]:'
250}
251
252function _git-bug_deselect {
253 _arguments
254}
255
256
257function _git-bug_label {
258 local -a commands
259
260 _arguments -C \
261 "1: :->cmnds" \
262 "*::arg:->args"
263
264 case $state in
265 cmnds)
266 commands=(
267 "add:Add a label to a bug."
268 "rm:Remove a label from a bug."
269 )
270 _describe "command" commands
271 ;;
272 esac
273
274 case "$words[1]" in
275 add)
276 _git-bug_label_add
277 ;;
278 rm)
279 _git-bug_label_rm
280 ;;
281 esac
282}
283
284function _git-bug_label_add {
285 _arguments
286}
287
288function _git-bug_label_rm {
289 _arguments
290}
291
292function _git-bug_ls {
293 _arguments \
294 '(*-s *--status)'{\*-s,\*--status}'[Filter by status. Valid values are [open,closed]]:' \
295 '(*-a *--author)'{\*-a,\*--author}'[Filter by author]:' \
296 '(*-p *--participant)'{\*-p,\*--participant}'[Filter by participant]:' \
297 '(*-A *--actor)'{\*-A,\*--actor}'[Filter by actor]:' \
298 '(*-l *--label)'{\*-l,\*--label}'[Filter by label]:' \
299 '(*-t *--title)'{\*-t,\*--title}'[Filter by title]:' \
300 '(*-n *--no)'{\*-n,\*--no}'[Filter by absence of something. Valid values are [label]]:' \
301 '(-b --by)'{-b,--by}'[Sort the results by a characteristic. Valid values are [id,creation,edit]]:' \
302 '(-d --direction)'{-d,--direction}'[Select the sorting direction. Valid values are [asc,desc]]:'
303}
304
305function _git-bug_ls-id {
306 _arguments
307}
308
309function _git-bug_ls-label {
310 _arguments
311}
312
313function _git-bug_pull {
314 _arguments
315}
316
317function _git-bug_push {
318 _arguments
319}
320
321function _git-bug_select {
322 _arguments
323}
324
325function _git-bug_show {
326 _arguments \
327 '(-f --field)'{-f,--field}'[Select field to display. Valid values are [author,authorEmail,createTime,humanId,id,labels,shortId,status,title,actors,participants]]:'
328}
329
330
331function _git-bug_status {
332 local -a commands
333
334 _arguments -C \
335 "1: :->cmnds" \
336 "*::arg:->args"
337
338 case $state in
339 cmnds)
340 commands=(
341 "close:Mark a bug as closed."
342 "open:Mark a bug as open."
343 )
344 _describe "command" commands
345 ;;
346 esac
347
348 case "$words[1]" in
349 close)
350 _git-bug_status_close
351 ;;
352 open)
353 _git-bug_status_open
354 ;;
355 esac
356}
357
358function _git-bug_status_close {
359 _arguments
360}
361
362function _git-bug_status_open {
363 _arguments
364}
365
366function _git-bug_termui {
367 _arguments
368}
369
370
371function _git-bug_title {
372 local -a commands
373
374 _arguments -C \
375 "1: :->cmnds" \
376 "*::arg:->args"
377
378 case $state in
379 cmnds)
380 commands=(
381 "edit:Edit a title of a bug."
382 )
383 _describe "command" commands
384 ;;
385 esac
386
387 case "$words[1]" in
388 edit)
389 _git-bug_title_edit
390 ;;
391 esac
392}
393
394function _git-bug_title_edit {
395 _arguments \
396 '(-t --title)'{-t,--title}'[Provide a title to describe the issue]:'
397}
398
399
400function _git-bug_user {
401 local -a commands
402
403 _arguments -C \
404 '(-f --field)'{-f,--field}'[Select field to display. Valid values are [email,humanId,id,lastModification,lastModificationLamport,login,metadata,name]]:' \
405 "1: :->cmnds" \
406 "*::arg:->args"
407
408 case $state in
409 cmnds)
410 commands=(
411 "adopt:Adopt an existing identity as your own."
412 "create:Create a new identity."
413 "ls:List identities."
414 )
415 _describe "command" commands
416 ;;
417 esac
418
419 case "$words[1]" in
420 adopt)
421 _git-bug_user_adopt
422 ;;
423 create)
424 _git-bug_user_create
425 ;;
426 ls)
427 _git-bug_user_ls
428 ;;
429 esac
430}
431
432function _git-bug_user_adopt {
433 _arguments
434}
435
436function _git-bug_user_create {
437 _arguments
438}
439
440function _git-bug_user_ls {
441 _arguments
442}
443
444function _git-bug_version {
445 _arguments \
446 '(-n --number)'{-n,--number}'[Only show the version number]' \
447 '(-c --commit)'{-c,--commit}'[Only show the commit hash]' \
448 '(-a --all)'{-a,--all}'[Show all version informations]'
449}
450
451function _git-bug_webui {
452 _arguments \
453 '--open[Automatically open the web UI in the default browser]' \
454 '--no-open[Prevent the automatic opening of the web UI in the default browser]' \
455 '(-p --port)'{-p,--port}'[Port to listen to (default is random)]:'
456}
457