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