git-bug

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