1# bash completion for git-bug -*- shell-script -*-
2
3__git-bug_debug()
4{
5 if [[ -n ${BASH_COMP_DEBUG_FILE} ]]; then
6 echo "$*" >> "${BASH_COMP_DEBUG_FILE}"
7 fi
8}
9
10# Homebrew on Macs have version 1.3 of bash-completion which doesn't include
11# _init_completion. This is a very minimal version of that function.
12__git-bug_init_completion()
13{
14 COMPREPLY=()
15 _get_comp_words_by_ref "$@" cur prev words cword
16}
17
18__git-bug_index_of_word()
19{
20 local w word=$1
21 shift
22 index=0
23 for w in "$@"; do
24 [[ $w = "$word" ]] && return
25 index=$((index+1))
26 done
27 index=-1
28}
29
30__git-bug_contains_word()
31{
32 local w word=$1; shift
33 for w in "$@"; do
34 [[ $w = "$word" ]] && return
35 done
36 return 1
37}
38
39__git-bug_handle_reply()
40{
41 __git-bug_debug "${FUNCNAME[0]}"
42 case $cur in
43 -*)
44 if [[ $(type -t compopt) = "builtin" ]]; then
45 compopt -o nospace
46 fi
47 local allflags
48 if [ ${#must_have_one_flag[@]} -ne 0 ]; then
49 allflags=("${must_have_one_flag[@]}")
50 else
51 allflags=("${flags[*]} ${two_word_flags[*]}")
52 fi
53 COMPREPLY=( $(compgen -W "${allflags[*]}" -- "$cur") )
54 if [[ $(type -t compopt) = "builtin" ]]; then
55 [[ "${COMPREPLY[0]}" == *= ]] || compopt +o nospace
56 fi
57
58 # complete after --flag=abc
59 if [[ $cur == *=* ]]; then
60 if [[ $(type -t compopt) = "builtin" ]]; then
61 compopt +o nospace
62 fi
63
64 local index flag
65 flag="${cur%=*}"
66 __git-bug_index_of_word "${flag}" "${flags_with_completion[@]}"
67 COMPREPLY=()
68 if [[ ${index} -ge 0 ]]; then
69 PREFIX=""
70 cur="${cur#*=}"
71 ${flags_completion[${index}]}
72 if [ -n "${ZSH_VERSION}" ]; then
73 # zsh completion needs --flag= prefix
74 eval "COMPREPLY=( \"\${COMPREPLY[@]/#/${flag}=}\" )"
75 fi
76 fi
77 fi
78 return 0;
79 ;;
80 esac
81
82 # check if we are handling a flag with special work handling
83 local index
84 __git-bug_index_of_word "${prev}" "${flags_with_completion[@]}"
85 if [[ ${index} -ge 0 ]]; then
86 ${flags_completion[${index}]}
87 return
88 fi
89
90 # we are parsing a flag and don't have a special handler, no completion
91 if [[ ${cur} != "${words[cword]}" ]]; then
92 return
93 fi
94
95 local completions
96 completions=("${commands[@]}")
97 if [[ ${#must_have_one_noun[@]} -ne 0 ]]; then
98 completions=("${must_have_one_noun[@]}")
99 fi
100 if [[ ${#must_have_one_flag[@]} -ne 0 ]]; then
101 completions+=("${must_have_one_flag[@]}")
102 fi
103 COMPREPLY=( $(compgen -W "${completions[*]}" -- "$cur") )
104
105 if [[ ${#COMPREPLY[@]} -eq 0 && ${#noun_aliases[@]} -gt 0 && ${#must_have_one_noun[@]} -ne 0 ]]; then
106 COMPREPLY=( $(compgen -W "${noun_aliases[*]}" -- "$cur") )
107 fi
108
109 if [[ ${#COMPREPLY[@]} -eq 0 ]]; then
110 if declare -F __git-bug_custom_func >/dev/null; then
111 # try command name qualified custom func
112 __git-bug_custom_func
113 else
114 # otherwise fall back to unqualified for compatibility
115 declare -F __custom_func >/dev/null && __custom_func
116 fi
117 fi
118
119 # available in bash-completion >= 2, not always present on macOS
120 if declare -F __ltrim_colon_completions >/dev/null; then
121 __ltrim_colon_completions "$cur"
122 fi
123
124 # If there is only 1 completion and it is a flag with an = it will be completed
125 # but we don't want a space after the =
126 if [[ "${#COMPREPLY[@]}" -eq "1" ]] && [[ $(type -t compopt) = "builtin" ]] && [[ "${COMPREPLY[0]}" == --*= ]]; then
127 compopt -o nospace
128 fi
129}
130
131# The arguments should be in the form "ext1|ext2|extn"
132__git-bug_handle_filename_extension_flag()
133{
134 local ext="$1"
135 _filedir "@(${ext})"
136}
137
138__git-bug_handle_subdirs_in_dir_flag()
139{
140 local dir="$1"
141 pushd "${dir}" >/dev/null 2>&1 && _filedir -d && popd >/dev/null 2>&1
142}
143
144__git-bug_handle_flag()
145{
146 __git-bug_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
147
148 # if a command required a flag, and we found it, unset must_have_one_flag()
149 local flagname=${words[c]}
150 local flagvalue
151 # if the word contained an =
152 if [[ ${words[c]} == *"="* ]]; then
153 flagvalue=${flagname#*=} # take in as flagvalue after the =
154 flagname=${flagname%=*} # strip everything after the =
155 flagname="${flagname}=" # but put the = back
156 fi
157 __git-bug_debug "${FUNCNAME[0]}: looking for ${flagname}"
158 if __git-bug_contains_word "${flagname}" "${must_have_one_flag[@]}"; then
159 must_have_one_flag=()
160 fi
161
162 # if you set a flag which only applies to this command, don't show subcommands
163 if __git-bug_contains_word "${flagname}" "${local_nonpersistent_flags[@]}"; then
164 commands=()
165 fi
166
167 # keep flag value with flagname as flaghash
168 # flaghash variable is an associative array which is only supported in bash > 3.
169 if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then
170 if [ -n "${flagvalue}" ] ; then
171 flaghash[${flagname}]=${flagvalue}
172 elif [ -n "${words[ $((c+1)) ]}" ] ; then
173 flaghash[${flagname}]=${words[ $((c+1)) ]}
174 else
175 flaghash[${flagname}]="true" # pad "true" for bool flag
176 fi
177 fi
178
179 # skip the argument to a two word flag
180 if [[ ${words[c]} != *"="* ]] && __git-bug_contains_word "${words[c]}" "${two_word_flags[@]}"; then
181 __git-bug_debug "${FUNCNAME[0]}: found a flag ${words[c]}, skip the next argument"
182 c=$((c+1))
183 # if we are looking for a flags value, don't show commands
184 if [[ $c -eq $cword ]]; then
185 commands=()
186 fi
187 fi
188
189 c=$((c+1))
190
191}
192
193__git-bug_handle_noun()
194{
195 __git-bug_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
196
197 if __git-bug_contains_word "${words[c]}" "${must_have_one_noun[@]}"; then
198 must_have_one_noun=()
199 elif __git-bug_contains_word "${words[c]}" "${noun_aliases[@]}"; then
200 must_have_one_noun=()
201 fi
202
203 nouns+=("${words[c]}")
204 c=$((c+1))
205}
206
207__git-bug_handle_command()
208{
209 __git-bug_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
210
211 local next_command
212 if [[ -n ${last_command} ]]; then
213 next_command="_${last_command}_${words[c]//:/__}"
214 else
215 if [[ $c -eq 0 ]]; then
216 next_command="_git-bug_root_command"
217 else
218 next_command="_${words[c]//:/__}"
219 fi
220 fi
221 c=$((c+1))
222 __git-bug_debug "${FUNCNAME[0]}: looking for ${next_command}"
223 declare -F "$next_command" >/dev/null && $next_command
224}
225
226__git-bug_handle_word()
227{
228 if [[ $c -ge $cword ]]; then
229 __git-bug_handle_reply
230 return
231 fi
232 __git-bug_debug "${FUNCNAME[0]}: c is $c words[c] is ${words[c]}"
233 if [[ "${words[c]}" == -* ]]; then
234 __git-bug_handle_flag
235 elif __git-bug_contains_word "${words[c]}" "${commands[@]}"; then
236 __git-bug_handle_command
237 elif [[ $c -eq 0 ]]; then
238 __git-bug_handle_command
239 elif __git-bug_contains_word "${words[c]}" "${command_aliases[@]}"; then
240 # aliashash variable is an associative array which is only supported in bash > 3.
241 if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then
242 words[c]=${aliashash[${words[c]}]}
243 __git-bug_handle_command
244 else
245 __git-bug_handle_noun
246 fi
247 else
248 __git-bug_handle_noun
249 fi
250 __git-bug_handle_word
251}
252
253
254_git_bug() {
255 __start_git-bug "$@"
256}
257
258_git-bug_add()
259{
260 last_command="git-bug_add"
261
262 command_aliases=()
263
264 commands=()
265
266 flags=()
267 two_word_flags=()
268 local_nonpersistent_flags=()
269 flags_with_completion=()
270 flags_completion=()
271
272 flags+=("--title=")
273 two_word_flags+=("--title")
274 two_word_flags+=("-t")
275 local_nonpersistent_flags+=("--title=")
276 flags+=("--message=")
277 two_word_flags+=("--message")
278 two_word_flags+=("-m")
279 local_nonpersistent_flags+=("--message=")
280 flags+=("--file=")
281 two_word_flags+=("--file")
282 two_word_flags+=("-F")
283 local_nonpersistent_flags+=("--file=")
284
285 must_have_one_flag=()
286 must_have_one_noun=()
287 noun_aliases=()
288}
289
290_git-bug_bridge_auth_add-token()
291{
292 last_command="git-bug_bridge_auth_add-token"
293
294 command_aliases=()
295
296 commands=()
297
298 flags=()
299 two_word_flags=()
300 local_nonpersistent_flags=()
301 flags_with_completion=()
302 flags_completion=()
303
304 flags+=("--target=")
305 two_word_flags+=("--target")
306 two_word_flags+=("-t")
307 local_nonpersistent_flags+=("--target=")
308
309 must_have_one_flag=()
310 must_have_one_noun=()
311 noun_aliases=()
312}
313
314_git-bug_bridge_auth_rm()
315{
316 last_command="git-bug_bridge_auth_rm"
317
318 command_aliases=()
319
320 commands=()
321
322 flags=()
323 two_word_flags=()
324 local_nonpersistent_flags=()
325 flags_with_completion=()
326 flags_completion=()
327
328
329 must_have_one_flag=()
330 must_have_one_noun=()
331 noun_aliases=()
332}
333
334_git-bug_bridge_auth_show()
335{
336 last_command="git-bug_bridge_auth_show"
337
338 command_aliases=()
339
340 commands=()
341
342 flags=()
343 two_word_flags=()
344 local_nonpersistent_flags=()
345 flags_with_completion=()
346 flags_completion=()
347
348
349 must_have_one_flag=()
350 must_have_one_noun=()
351 noun_aliases=()
352}
353
354_git-bug_bridge_auth()
355{
356 last_command="git-bug_bridge_auth"
357
358 command_aliases=()
359
360 commands=()
361 commands+=("add-token")
362 commands+=("rm")
363 commands+=("show")
364
365 flags=()
366 two_word_flags=()
367 local_nonpersistent_flags=()
368 flags_with_completion=()
369 flags_completion=()
370
371
372 must_have_one_flag=()
373 must_have_one_noun=()
374 noun_aliases=()
375}
376
377_git-bug_bridge_configure()
378{
379 last_command="git-bug_bridge_configure"
380
381 command_aliases=()
382
383 commands=()
384
385 flags=()
386 two_word_flags=()
387 local_nonpersistent_flags=()
388 flags_with_completion=()
389 flags_completion=()
390
391 flags+=("--name=")
392 two_word_flags+=("--name")
393 two_word_flags+=("-n")
394 local_nonpersistent_flags+=("--name=")
395 flags+=("--target=")
396 two_word_flags+=("--target")
397 two_word_flags+=("-t")
398 local_nonpersistent_flags+=("--target=")
399 flags+=("--url=")
400 two_word_flags+=("--url")
401 two_word_flags+=("-u")
402 local_nonpersistent_flags+=("--url=")
403 flags+=("--base-url=")
404 two_word_flags+=("--base-url")
405 two_word_flags+=("-b")
406 local_nonpersistent_flags+=("--base-url=")
407 flags+=("--owner=")
408 two_word_flags+=("--owner")
409 two_word_flags+=("-o")
410 local_nonpersistent_flags+=("--owner=")
411 flags+=("--credential=")
412 two_word_flags+=("--credential")
413 two_word_flags+=("-c")
414 local_nonpersistent_flags+=("--credential=")
415 flags+=("--token=")
416 two_word_flags+=("--token")
417 local_nonpersistent_flags+=("--token=")
418 flags+=("--token-stdin")
419 local_nonpersistent_flags+=("--token-stdin")
420 flags+=("--project=")
421 two_word_flags+=("--project")
422 two_word_flags+=("-p")
423 local_nonpersistent_flags+=("--project=")
424
425 must_have_one_flag=()
426 must_have_one_noun=()
427 noun_aliases=()
428}
429
430_git-bug_bridge_pull()
431{
432 last_command="git-bug_bridge_pull"
433
434 command_aliases=()
435
436 commands=()
437
438 flags=()
439 two_word_flags=()
440 local_nonpersistent_flags=()
441 flags_with_completion=()
442 flags_completion=()
443
444 flags+=("--no-resume")
445 flags+=("-n")
446 local_nonpersistent_flags+=("--no-resume")
447 flags+=("--since=")
448 two_word_flags+=("--since")
449 two_word_flags+=("-s")
450 local_nonpersistent_flags+=("--since=")
451
452 must_have_one_flag=()
453 must_have_one_noun=()
454 noun_aliases=()
455}
456
457_git-bug_bridge_push()
458{
459 last_command="git-bug_bridge_push"
460
461 command_aliases=()
462
463 commands=()
464
465 flags=()
466 two_word_flags=()
467 local_nonpersistent_flags=()
468 flags_with_completion=()
469 flags_completion=()
470
471
472 must_have_one_flag=()
473 must_have_one_noun=()
474 noun_aliases=()
475}
476
477_git-bug_bridge_rm()
478{
479 last_command="git-bug_bridge_rm"
480
481 command_aliases=()
482
483 commands=()
484
485 flags=()
486 two_word_flags=()
487 local_nonpersistent_flags=()
488 flags_with_completion=()
489 flags_completion=()
490
491
492 must_have_one_flag=()
493 must_have_one_noun=()
494 noun_aliases=()
495}
496
497_git-bug_bridge()
498{
499 last_command="git-bug_bridge"
500
501 command_aliases=()
502
503 commands=()
504 commands+=("auth")
505 commands+=("configure")
506 commands+=("pull")
507 commands+=("push")
508 commands+=("rm")
509
510 flags=()
511 two_word_flags=()
512 local_nonpersistent_flags=()
513 flags_with_completion=()
514 flags_completion=()
515
516
517 must_have_one_flag=()
518 must_have_one_noun=()
519 noun_aliases=()
520}
521
522_git-bug_commands()
523{
524 last_command="git-bug_commands"
525
526 command_aliases=()
527
528 commands=()
529
530 flags=()
531 two_word_flags=()
532 local_nonpersistent_flags=()
533 flags_with_completion=()
534 flags_completion=()
535
536 flags+=("--pretty")
537 flags+=("-p")
538 local_nonpersistent_flags+=("--pretty")
539
540 must_have_one_flag=()
541 must_have_one_noun=()
542 noun_aliases=()
543}
544
545_git-bug_comment_add()
546{
547 last_command="git-bug_comment_add"
548
549 command_aliases=()
550
551 commands=()
552
553 flags=()
554 two_word_flags=()
555 local_nonpersistent_flags=()
556 flags_with_completion=()
557 flags_completion=()
558
559 flags+=("--file=")
560 two_word_flags+=("--file")
561 two_word_flags+=("-F")
562 local_nonpersistent_flags+=("--file=")
563 flags+=("--message=")
564 two_word_flags+=("--message")
565 two_word_flags+=("-m")
566 local_nonpersistent_flags+=("--message=")
567
568 must_have_one_flag=()
569 must_have_one_noun=()
570 noun_aliases=()
571}
572
573_git-bug_comment()
574{
575 last_command="git-bug_comment"
576
577 command_aliases=()
578
579 commands=()
580 commands+=("add")
581
582 flags=()
583 two_word_flags=()
584 local_nonpersistent_flags=()
585 flags_with_completion=()
586 flags_completion=()
587
588
589 must_have_one_flag=()
590 must_have_one_noun=()
591 noun_aliases=()
592}
593
594_git-bug_deselect()
595{
596 last_command="git-bug_deselect"
597
598 command_aliases=()
599
600 commands=()
601
602 flags=()
603 two_word_flags=()
604 local_nonpersistent_flags=()
605 flags_with_completion=()
606 flags_completion=()
607
608
609 must_have_one_flag=()
610 must_have_one_noun=()
611 noun_aliases=()
612}
613
614_git-bug_label_add()
615{
616 last_command="git-bug_label_add"
617
618 command_aliases=()
619
620 commands=()
621
622 flags=()
623 two_word_flags=()
624 local_nonpersistent_flags=()
625 flags_with_completion=()
626 flags_completion=()
627
628
629 must_have_one_flag=()
630 must_have_one_noun=()
631 noun_aliases=()
632}
633
634_git-bug_label_rm()
635{
636 last_command="git-bug_label_rm"
637
638 command_aliases=()
639
640 commands=()
641
642 flags=()
643 two_word_flags=()
644 local_nonpersistent_flags=()
645 flags_with_completion=()
646 flags_completion=()
647
648
649 must_have_one_flag=()
650 must_have_one_noun=()
651 noun_aliases=()
652}
653
654_git-bug_label()
655{
656 last_command="git-bug_label"
657
658 command_aliases=()
659
660 commands=()
661 commands+=("add")
662 commands+=("rm")
663
664 flags=()
665 two_word_flags=()
666 local_nonpersistent_flags=()
667 flags_with_completion=()
668 flags_completion=()
669
670
671 must_have_one_flag=()
672 must_have_one_noun=()
673 noun_aliases=()
674}
675
676_git-bug_ls()
677{
678 last_command="git-bug_ls"
679
680 command_aliases=()
681
682 commands=()
683
684 flags=()
685 two_word_flags=()
686 local_nonpersistent_flags=()
687 flags_with_completion=()
688 flags_completion=()
689
690 flags+=("--status=")
691 two_word_flags+=("--status")
692 two_word_flags+=("-s")
693 local_nonpersistent_flags+=("--status=")
694 flags+=("--author=")
695 two_word_flags+=("--author")
696 two_word_flags+=("-a")
697 local_nonpersistent_flags+=("--author=")
698 flags+=("--participant=")
699 two_word_flags+=("--participant")
700 two_word_flags+=("-p")
701 local_nonpersistent_flags+=("--participant=")
702 flags+=("--actor=")
703 two_word_flags+=("--actor")
704 two_word_flags+=("-A")
705 local_nonpersistent_flags+=("--actor=")
706 flags+=("--label=")
707 two_word_flags+=("--label")
708 two_word_flags+=("-l")
709 local_nonpersistent_flags+=("--label=")
710 flags+=("--title=")
711 two_word_flags+=("--title")
712 two_word_flags+=("-t")
713 local_nonpersistent_flags+=("--title=")
714 flags+=("--no=")
715 two_word_flags+=("--no")
716 two_word_flags+=("-n")
717 local_nonpersistent_flags+=("--no=")
718 flags+=("--by=")
719 two_word_flags+=("--by")
720 two_word_flags+=("-b")
721 local_nonpersistent_flags+=("--by=")
722 flags+=("--direction=")
723 two_word_flags+=("--direction")
724 two_word_flags+=("-d")
725 local_nonpersistent_flags+=("--direction=")
726
727 must_have_one_flag=()
728 must_have_one_noun=()
729 noun_aliases=()
730}
731
732_git-bug_ls-id()
733{
734 last_command="git-bug_ls-id"
735
736 command_aliases=()
737
738 commands=()
739
740 flags=()
741 two_word_flags=()
742 local_nonpersistent_flags=()
743 flags_with_completion=()
744 flags_completion=()
745
746
747 must_have_one_flag=()
748 must_have_one_noun=()
749 noun_aliases=()
750}
751
752_git-bug_ls-label()
753{
754 last_command="git-bug_ls-label"
755
756 command_aliases=()
757
758 commands=()
759
760 flags=()
761 two_word_flags=()
762 local_nonpersistent_flags=()
763 flags_with_completion=()
764 flags_completion=()
765
766
767 must_have_one_flag=()
768 must_have_one_noun=()
769 noun_aliases=()
770}
771
772_git-bug_pull()
773{
774 last_command="git-bug_pull"
775
776 command_aliases=()
777
778 commands=()
779
780 flags=()
781 two_word_flags=()
782 local_nonpersistent_flags=()
783 flags_with_completion=()
784 flags_completion=()
785
786
787 must_have_one_flag=()
788 must_have_one_noun=()
789 noun_aliases=()
790}
791
792_git-bug_push()
793{
794 last_command="git-bug_push"
795
796 command_aliases=()
797
798 commands=()
799
800 flags=()
801 two_word_flags=()
802 local_nonpersistent_flags=()
803 flags_with_completion=()
804 flags_completion=()
805
806
807 must_have_one_flag=()
808 must_have_one_noun=()
809 noun_aliases=()
810}
811
812_git-bug_select()
813{
814 last_command="git-bug_select"
815
816 command_aliases=()
817
818 commands=()
819
820 flags=()
821 two_word_flags=()
822 local_nonpersistent_flags=()
823 flags_with_completion=()
824 flags_completion=()
825
826
827 must_have_one_flag=()
828 must_have_one_noun=()
829 noun_aliases=()
830}
831
832_git-bug_show()
833{
834 last_command="git-bug_show"
835
836 command_aliases=()
837
838 commands=()
839
840 flags=()
841 two_word_flags=()
842 local_nonpersistent_flags=()
843 flags_with_completion=()
844 flags_completion=()
845
846 flags+=("--field=")
847 two_word_flags+=("--field")
848 two_word_flags+=("-f")
849 local_nonpersistent_flags+=("--field=")
850
851 must_have_one_flag=()
852 must_have_one_noun=()
853 noun_aliases=()
854}
855
856_git-bug_status_close()
857{
858 last_command="git-bug_status_close"
859
860 command_aliases=()
861
862 commands=()
863
864 flags=()
865 two_word_flags=()
866 local_nonpersistent_flags=()
867 flags_with_completion=()
868 flags_completion=()
869
870
871 must_have_one_flag=()
872 must_have_one_noun=()
873 noun_aliases=()
874}
875
876_git-bug_status_open()
877{
878 last_command="git-bug_status_open"
879
880 command_aliases=()
881
882 commands=()
883
884 flags=()
885 two_word_flags=()
886 local_nonpersistent_flags=()
887 flags_with_completion=()
888 flags_completion=()
889
890
891 must_have_one_flag=()
892 must_have_one_noun=()
893 noun_aliases=()
894}
895
896_git-bug_status()
897{
898 last_command="git-bug_status"
899
900 command_aliases=()
901
902 commands=()
903 commands+=("close")
904 commands+=("open")
905
906 flags=()
907 two_word_flags=()
908 local_nonpersistent_flags=()
909 flags_with_completion=()
910 flags_completion=()
911
912
913 must_have_one_flag=()
914 must_have_one_noun=()
915 noun_aliases=()
916}
917
918_git-bug_termui()
919{
920 last_command="git-bug_termui"
921
922 command_aliases=()
923
924 commands=()
925
926 flags=()
927 two_word_flags=()
928 local_nonpersistent_flags=()
929 flags_with_completion=()
930 flags_completion=()
931
932
933 must_have_one_flag=()
934 must_have_one_noun=()
935 noun_aliases=()
936}
937
938_git-bug_title_edit()
939{
940 last_command="git-bug_title_edit"
941
942 command_aliases=()
943
944 commands=()
945
946 flags=()
947 two_word_flags=()
948 local_nonpersistent_flags=()
949 flags_with_completion=()
950 flags_completion=()
951
952 flags+=("--title=")
953 two_word_flags+=("--title")
954 two_word_flags+=("-t")
955 local_nonpersistent_flags+=("--title=")
956
957 must_have_one_flag=()
958 must_have_one_noun=()
959 noun_aliases=()
960}
961
962_git-bug_title()
963{
964 last_command="git-bug_title"
965
966 command_aliases=()
967
968 commands=()
969 commands+=("edit")
970
971 flags=()
972 two_word_flags=()
973 local_nonpersistent_flags=()
974 flags_with_completion=()
975 flags_completion=()
976
977
978 must_have_one_flag=()
979 must_have_one_noun=()
980 noun_aliases=()
981}
982
983_git-bug_user_adopt()
984{
985 last_command="git-bug_user_adopt"
986
987 command_aliases=()
988
989 commands=()
990
991 flags=()
992 two_word_flags=()
993 local_nonpersistent_flags=()
994 flags_with_completion=()
995 flags_completion=()
996
997
998 must_have_one_flag=()
999 must_have_one_noun=()
1000 noun_aliases=()
1001}
1002
1003_git-bug_user_create()
1004{
1005 last_command="git-bug_user_create"
1006
1007 command_aliases=()
1008
1009 commands=()
1010
1011 flags=()
1012 two_word_flags=()
1013 local_nonpersistent_flags=()
1014 flags_with_completion=()
1015 flags_completion=()
1016
1017
1018 must_have_one_flag=()
1019 must_have_one_noun=()
1020 noun_aliases=()
1021}
1022
1023_git-bug_user_ls()
1024{
1025 last_command="git-bug_user_ls"
1026
1027 command_aliases=()
1028
1029 commands=()
1030
1031 flags=()
1032 two_word_flags=()
1033 local_nonpersistent_flags=()
1034 flags_with_completion=()
1035 flags_completion=()
1036
1037
1038 must_have_one_flag=()
1039 must_have_one_noun=()
1040 noun_aliases=()
1041}
1042
1043_git-bug_user()
1044{
1045 last_command="git-bug_user"
1046
1047 command_aliases=()
1048
1049 commands=()
1050 commands+=("adopt")
1051 commands+=("create")
1052 commands+=("ls")
1053
1054 flags=()
1055 two_word_flags=()
1056 local_nonpersistent_flags=()
1057 flags_with_completion=()
1058 flags_completion=()
1059
1060 flags+=("--field=")
1061 two_word_flags+=("--field")
1062 two_word_flags+=("-f")
1063 local_nonpersistent_flags+=("--field=")
1064
1065 must_have_one_flag=()
1066 must_have_one_noun=()
1067 noun_aliases=()
1068}
1069
1070_git-bug_version()
1071{
1072 last_command="git-bug_version"
1073
1074 command_aliases=()
1075
1076 commands=()
1077
1078 flags=()
1079 two_word_flags=()
1080 local_nonpersistent_flags=()
1081 flags_with_completion=()
1082 flags_completion=()
1083
1084 flags+=("--number")
1085 flags+=("-n")
1086 local_nonpersistent_flags+=("--number")
1087 flags+=("--commit")
1088 flags+=("-c")
1089 local_nonpersistent_flags+=("--commit")
1090 flags+=("--all")
1091 flags+=("-a")
1092 local_nonpersistent_flags+=("--all")
1093
1094 must_have_one_flag=()
1095 must_have_one_noun=()
1096 noun_aliases=()
1097}
1098
1099_git-bug_webui()
1100{
1101 last_command="git-bug_webui"
1102
1103 command_aliases=()
1104
1105 commands=()
1106
1107 flags=()
1108 two_word_flags=()
1109 local_nonpersistent_flags=()
1110 flags_with_completion=()
1111 flags_completion=()
1112
1113 flags+=("--open")
1114 local_nonpersistent_flags+=("--open")
1115 flags+=("--no-open")
1116 local_nonpersistent_flags+=("--no-open")
1117 flags+=("--port=")
1118 two_word_flags+=("--port")
1119 two_word_flags+=("-p")
1120 local_nonpersistent_flags+=("--port=")
1121
1122 must_have_one_flag=()
1123 must_have_one_noun=()
1124 noun_aliases=()
1125}
1126
1127_git-bug_root_command()
1128{
1129 last_command="git-bug"
1130
1131 command_aliases=()
1132
1133 commands=()
1134 commands+=("add")
1135 commands+=("bridge")
1136 commands+=("commands")
1137 commands+=("comment")
1138 commands+=("deselect")
1139 commands+=("label")
1140 commands+=("ls")
1141 commands+=("ls-id")
1142 commands+=("ls-label")
1143 commands+=("pull")
1144 commands+=("push")
1145 commands+=("select")
1146 commands+=("show")
1147 commands+=("status")
1148 commands+=("termui")
1149 if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then
1150 command_aliases+=("tui")
1151 aliashash["tui"]="termui"
1152 fi
1153 commands+=("title")
1154 commands+=("user")
1155 commands+=("version")
1156 commands+=("webui")
1157
1158 flags=()
1159 two_word_flags=()
1160 local_nonpersistent_flags=()
1161 flags_with_completion=()
1162 flags_completion=()
1163
1164
1165 must_have_one_flag=()
1166 must_have_one_noun=()
1167 noun_aliases=()
1168}
1169
1170__start_git-bug()
1171{
1172 local cur prev words cword
1173 declare -A flaghash 2>/dev/null || :
1174 declare -A aliashash 2>/dev/null || :
1175 if declare -F _init_completion >/dev/null 2>&1; then
1176 _init_completion -s || return
1177 else
1178 __git-bug_init_completion -n "=" || return
1179 fi
1180
1181 local c=0
1182 local flags=()
1183 local two_word_flags=()
1184 local local_nonpersistent_flags=()
1185 local flags_with_completion=()
1186 local flags_completion=()
1187 local commands=("git-bug")
1188 local must_have_one_flag=()
1189 local must_have_one_noun=()
1190 local last_command
1191 local nouns=()
1192
1193 __git-bug_handle_word
1194}
1195
1196if [[ $(type -t compopt) = "builtin" ]]; then
1197 complete -o default -F __start_git-bug git-bug
1198else
1199 complete -o default -o nospace -F __start_git-bug git-bug
1200fi
1201
1202# ex: ts=4 sw=4 et filetype=sh