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 "configure:Configure a new bridge."
118 "pull:Pull updates."
119 "push:Push updates."
120 "rm:Delete a configured bridge."
121 )
122 _describe "command" commands
123 ;;
124 esac
125
126 case "$words[1]" in
127 configure)
128 _git-bug_bridge_configure
129 ;;
130 pull)
131 _git-bug_bridge_pull
132 ;;
133 push)
134 _git-bug_bridge_push
135 ;;
136 rm)
137 _git-bug_bridge_rm
138 ;;
139 esac
140}
141
142function _git-bug_bridge_configure {
143 _arguments \
144 '(-n --name)'{-n,--name}'[A distinctive name to identify the bridge]:' \
145 '(-t --target)'{-t,--target}'[The target of the bridge. Valid values are [github,gitlab,launchpad-preview]]:' \
146 '(-u --url)'{-u,--url}'[The URL of the target repository]:' \
147 '(-o --owner)'{-o,--owner}'[The owner of the target repository]:' \
148 '(-T --token)'{-T,--token}'[The authentication token for the API]:' \
149 '(-p --project)'{-p,--project}'[The name of the target repository]:'
150}
151
152function _git-bug_bridge_pull {
153 _arguments
154}
155
156function _git-bug_bridge_push {
157 _arguments
158}
159
160function _git-bug_bridge_rm {
161 _arguments
162}
163
164function _git-bug_commands {
165 _arguments \
166 '(-p --pretty)'{-p,--pretty}'[Output the command description as well as Markdown compatible comment]'
167}
168
169
170function _git-bug_comment {
171 local -a commands
172
173 _arguments -C \
174 "1: :->cmnds" \
175 "*::arg:->args"
176
177 case $state in
178 cmnds)
179 commands=(
180 "add:Add a new comment to a bug."
181 )
182 _describe "command" commands
183 ;;
184 esac
185
186 case "$words[1]" in
187 add)
188 _git-bug_comment_add
189 ;;
190 esac
191}
192
193function _git-bug_comment_add {
194 _arguments \
195 '(-F --file)'{-F,--file}'[Take the message from the given file. Use - to read the message from the standard input]:' \
196 '(-m --message)'{-m,--message}'[Provide the new message from the command line]:'
197}
198
199function _git-bug_deselect {
200 _arguments
201}
202
203
204function _git-bug_label {
205 local -a commands
206
207 _arguments -C \
208 "1: :->cmnds" \
209 "*::arg:->args"
210
211 case $state in
212 cmnds)
213 commands=(
214 "add:Add a label to a bug."
215 "rm:Remove a label from a bug."
216 )
217 _describe "command" commands
218 ;;
219 esac
220
221 case "$words[1]" in
222 add)
223 _git-bug_label_add
224 ;;
225 rm)
226 _git-bug_label_rm
227 ;;
228 esac
229}
230
231function _git-bug_label_add {
232 _arguments
233}
234
235function _git-bug_label_rm {
236 _arguments
237}
238
239function _git-bug_ls {
240 _arguments \
241 '(*-s *--status)'{\*-s,\*--status}'[Filter by status. Valid values are [open,closed]]:' \
242 '(*-a *--author)'{\*-a,\*--author}'[Filter by author]:' \
243 '(*-p *--participant)'{\*-p,\*--participant}'[Filter by participant]:' \
244 '(*-A *--actor)'{\*-A,\*--actor}'[Filter by actor]:' \
245 '(*-l *--label)'{\*-l,\*--label}'[Filter by label]:' \
246 '(*-t *--title)'{\*-t,\*--title}'[Filter by title]:' \
247 '(*-n *--no)'{\*-n,\*--no}'[Filter by absence of something. Valid values are [label]]:' \
248 '(-b --by)'{-b,--by}'[Sort the results by a characteristic. Valid values are [id,creation,edit]]:' \
249 '(-d --direction)'{-d,--direction}'[Select the sorting direction. Valid values are [asc,desc]]:'
250}
251
252function _git-bug_ls-id {
253 _arguments
254}
255
256function _git-bug_ls-label {
257 _arguments
258}
259
260function _git-bug_pull {
261 _arguments
262}
263
264function _git-bug_push {
265 _arguments
266}
267
268function _git-bug_select {
269 _arguments
270}
271
272function _git-bug_show {
273 _arguments \
274 '(-f --field)'{-f,--field}'[Select field to display. Valid values are [author,authorEmail,createTime,humanId,id,labels,shortId,status,title,actors,participants]]:'
275}
276
277
278function _git-bug_status {
279 local -a commands
280
281 _arguments -C \
282 "1: :->cmnds" \
283 "*::arg:->args"
284
285 case $state in
286 cmnds)
287 commands=(
288 "close:Mark a bug as closed."
289 "open:Mark a bug as open."
290 )
291 _describe "command" commands
292 ;;
293 esac
294
295 case "$words[1]" in
296 close)
297 _git-bug_status_close
298 ;;
299 open)
300 _git-bug_status_open
301 ;;
302 esac
303}
304
305function _git-bug_status_close {
306 _arguments
307}
308
309function _git-bug_status_open {
310 _arguments
311}
312
313function _git-bug_termui {
314 _arguments
315}
316
317
318function _git-bug_title {
319 local -a commands
320
321 _arguments -C \
322 "1: :->cmnds" \
323 "*::arg:->args"
324
325 case $state in
326 cmnds)
327 commands=(
328 "edit:Edit a title of a bug."
329 )
330 _describe "command" commands
331 ;;
332 esac
333
334 case "$words[1]" in
335 edit)
336 _git-bug_title_edit
337 ;;
338 esac
339}
340
341function _git-bug_title_edit {
342 _arguments \
343 '(-t --title)'{-t,--title}'[Provide a title to describe the issue]:'
344}
345
346
347function _git-bug_user {
348 local -a commands
349
350 _arguments -C \
351 '(-f --field)'{-f,--field}'[Select field to display. Valid values are [email,humanId,id,lastModification,lastModificationLamport,login,metadata,name]]:' \
352 "1: :->cmnds" \
353 "*::arg:->args"
354
355 case $state in
356 cmnds)
357 commands=(
358 "adopt:Adopt an existing identity as your own."
359 "create:Create a new identity."
360 "ls:List identities."
361 )
362 _describe "command" commands
363 ;;
364 esac
365
366 case "$words[1]" in
367 adopt)
368 _git-bug_user_adopt
369 ;;
370 create)
371 _git-bug_user_create
372 ;;
373 ls)
374 _git-bug_user_ls
375 ;;
376 esac
377}
378
379function _git-bug_user_adopt {
380 _arguments
381}
382
383function _git-bug_user_create {
384 _arguments
385}
386
387function _git-bug_user_ls {
388 _arguments
389}
390
391function _git-bug_version {
392 _arguments \
393 '(-n --number)'{-n,--number}'[Only show the version number]' \
394 '(-c --commit)'{-c,--commit}'[Only show the commit hash]' \
395 '(-a --all)'{-a,--all}'[Show all version informations]'
396}
397
398function _git-bug_webui {
399 _arguments \
400 '--open[Automatically open the web UI in the default browser]' \
401 '--no-open[Prevent the automatic opening of the web UI in the default browser]' \
402 '(-p --port)'{-p,--port}'[Port to listen to (default is random)]:'
403}
404