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