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