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