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,jira,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,jira,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    '(-f --format)'{-f,--format}'[Select the output formatting style. Valid values are [default,plain,json,org-mode]]:'
308}
309
310function _git-bug_ls-id {
311  _arguments
312}
313
314function _git-bug_ls-label {
315  _arguments
316}
317
318function _git-bug_pull {
319  _arguments
320}
321
322function _git-bug_push {
323  _arguments
324}
325
326function _git-bug_select {
327  _arguments
328}
329
330function _git-bug_show {
331  _arguments \
332    '--field[Select field to display. Valid values are [author,authorEmail,createTime,lastEdit,humanId,id,labels,shortId,status,title,actors,participants]]:' \
333    '(-f --format)'{-f,--format}'[Select the output formatting style. Valid values are [default,json,org-mode]]:'
334}
335
336
337function _git-bug_status {
338  local -a commands
339
340  _arguments -C \
341    "1: :->cmnds" \
342    "*::arg:->args"
343
344  case $state in
345  cmnds)
346    commands=(
347      "close:Mark a bug as closed."
348      "open:Mark a bug as open."
349    )
350    _describe "command" commands
351    ;;
352  esac
353
354  case "$words[1]" in
355  close)
356    _git-bug_status_close
357    ;;
358  open)
359    _git-bug_status_open
360    ;;
361  esac
362}
363
364function _git-bug_status_close {
365  _arguments
366}
367
368function _git-bug_status_open {
369  _arguments
370}
371
372function _git-bug_termui {
373  _arguments
374}
375
376
377function _git-bug_title {
378  local -a commands
379
380  _arguments -C \
381    "1: :->cmnds" \
382    "*::arg:->args"
383
384  case $state in
385  cmnds)
386    commands=(
387      "edit:Edit a title of a bug."
388    )
389    _describe "command" commands
390    ;;
391  esac
392
393  case "$words[1]" in
394  edit)
395    _git-bug_title_edit
396    ;;
397  esac
398}
399
400function _git-bug_title_edit {
401  _arguments \
402    '(-t --title)'{-t,--title}'[Provide a title to describe the issue]:'
403}
404
405
406function _git-bug_user {
407  local -a commands
408
409  _arguments -C \
410    '(-f --field)'{-f,--field}'[Select field to display. Valid values are [email,humanId,id,lastModification,lastModificationLamport,login,metadata,name]]:' \
411    "1: :->cmnds" \
412    "*::arg:->args"
413
414  case $state in
415  cmnds)
416    commands=(
417      "adopt:Adopt an existing identity as your own."
418      "create:Create a new identity."
419      "ls:List identities."
420    )
421    _describe "command" commands
422    ;;
423  esac
424
425  case "$words[1]" in
426  adopt)
427    _git-bug_user_adopt
428    ;;
429  create)
430    _git-bug_user_create
431    ;;
432  ls)
433    _git-bug_user_ls
434    ;;
435  esac
436}
437
438function _git-bug_user_adopt {
439  _arguments
440}
441
442function _git-bug_user_create {
443  _arguments
444}
445
446function _git-bug_user_ls {
447  _arguments \
448    '(-f --format)'{-f,--format}'[Select the output formatting style. Valid values are [default,json]]:'
449}
450
451function _git-bug_version {
452  _arguments \
453    '(-n --number)'{-n,--number}'[Only show the version number]' \
454    '(-c --commit)'{-c,--commit}'[Only show the commit hash]' \
455    '(-a --all)'{-a,--all}'[Show all version information]'
456}
457
458function _git-bug_webui {
459  _arguments \
460    '--open[Automatically open the web UI in the default browser]' \
461    '--no-open[Prevent the automatic opening of the web UI in the default browser]' \
462    '(-p --port)'{-p,--port}'[Port to listen to (default is random)]:' \
463    '--read-only[Whether to run the web UI in read-only mode]'
464}
465