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 flags+=("--login=")
309 two_word_flags+=("--login")
310 two_word_flags+=("-l")
311 local_nonpersistent_flags+=("--login=")
312 flags+=("--user=")
313 two_word_flags+=("--user")
314 two_word_flags+=("-u")
315 local_nonpersistent_flags+=("--user=")
316
317 must_have_one_flag=()
318 must_have_one_noun=()
319 noun_aliases=()
320}
321
322_git-bug_bridge_auth_rm()
323{
324 last_command="git-bug_bridge_auth_rm"
325
326 command_aliases=()
327
328 commands=()
329
330 flags=()
331 two_word_flags=()
332 local_nonpersistent_flags=()
333 flags_with_completion=()
334 flags_completion=()
335
336
337 must_have_one_flag=()
338 must_have_one_noun=()
339 noun_aliases=()
340}
341
342_git-bug_bridge_auth_show()
343{
344 last_command="git-bug_bridge_auth_show"
345
346 command_aliases=()
347
348 commands=()
349
350 flags=()
351 two_word_flags=()
352 local_nonpersistent_flags=()
353 flags_with_completion=()
354 flags_completion=()
355
356
357 must_have_one_flag=()
358 must_have_one_noun=()
359 noun_aliases=()
360}
361
362_git-bug_bridge_auth()
363{
364 last_command="git-bug_bridge_auth"
365
366 command_aliases=()
367
368 commands=()
369 commands+=("add-token")
370 commands+=("rm")
371 commands+=("show")
372
373 flags=()
374 two_word_flags=()
375 local_nonpersistent_flags=()
376 flags_with_completion=()
377 flags_completion=()
378
379
380 must_have_one_flag=()
381 must_have_one_noun=()
382 noun_aliases=()
383}
384
385_git-bug_bridge_configure()
386{
387 last_command="git-bug_bridge_configure"
388
389 command_aliases=()
390
391 commands=()
392
393 flags=()
394 two_word_flags=()
395 local_nonpersistent_flags=()
396 flags_with_completion=()
397 flags_completion=()
398
399 flags+=("--name=")
400 two_word_flags+=("--name")
401 two_word_flags+=("-n")
402 local_nonpersistent_flags+=("--name=")
403 flags+=("--target=")
404 two_word_flags+=("--target")
405 two_word_flags+=("-t")
406 local_nonpersistent_flags+=("--target=")
407 flags+=("--url=")
408 two_word_flags+=("--url")
409 two_word_flags+=("-u")
410 local_nonpersistent_flags+=("--url=")
411 flags+=("--base-url=")
412 two_word_flags+=("--base-url")
413 two_word_flags+=("-b")
414 local_nonpersistent_flags+=("--base-url=")
415 flags+=("--login=")
416 two_word_flags+=("--login")
417 two_word_flags+=("-l")
418 local_nonpersistent_flags+=("--login=")
419 flags+=("--credential=")
420 two_word_flags+=("--credential")
421 two_word_flags+=("-c")
422 local_nonpersistent_flags+=("--credential=")
423 flags+=("--token=")
424 two_word_flags+=("--token")
425 local_nonpersistent_flags+=("--token=")
426 flags+=("--token-stdin")
427 local_nonpersistent_flags+=("--token-stdin")
428 flags+=("--owner=")
429 two_word_flags+=("--owner")
430 two_word_flags+=("-o")
431 local_nonpersistent_flags+=("--owner=")
432 flags+=("--project=")
433 two_word_flags+=("--project")
434 two_word_flags+=("-p")
435 local_nonpersistent_flags+=("--project=")
436
437 must_have_one_flag=()
438 must_have_one_noun=()
439 noun_aliases=()
440}
441
442_git-bug_bridge_pull()
443{
444 last_command="git-bug_bridge_pull"
445
446 command_aliases=()
447
448 commands=()
449
450 flags=()
451 two_word_flags=()
452 local_nonpersistent_flags=()
453 flags_with_completion=()
454 flags_completion=()
455
456 flags+=("--no-resume")
457 flags+=("-n")
458 local_nonpersistent_flags+=("--no-resume")
459 flags+=("--since=")
460 two_word_flags+=("--since")
461 two_word_flags+=("-s")
462 local_nonpersistent_flags+=("--since=")
463
464 must_have_one_flag=()
465 must_have_one_noun=()
466 noun_aliases=()
467}
468
469_git-bug_bridge_push()
470{
471 last_command="git-bug_bridge_push"
472
473 command_aliases=()
474
475 commands=()
476
477 flags=()
478 two_word_flags=()
479 local_nonpersistent_flags=()
480 flags_with_completion=()
481 flags_completion=()
482
483
484 must_have_one_flag=()
485 must_have_one_noun=()
486 noun_aliases=()
487}
488
489_git-bug_bridge_rm()
490{
491 last_command="git-bug_bridge_rm"
492
493 command_aliases=()
494
495 commands=()
496
497 flags=()
498 two_word_flags=()
499 local_nonpersistent_flags=()
500 flags_with_completion=()
501 flags_completion=()
502
503
504 must_have_one_flag=()
505 must_have_one_noun=()
506 noun_aliases=()
507}
508
509_git-bug_bridge()
510{
511 last_command="git-bug_bridge"
512
513 command_aliases=()
514
515 commands=()
516 commands+=("auth")
517 commands+=("configure")
518 commands+=("pull")
519 commands+=("push")
520 commands+=("rm")
521
522 flags=()
523 two_word_flags=()
524 local_nonpersistent_flags=()
525 flags_with_completion=()
526 flags_completion=()
527
528
529 must_have_one_flag=()
530 must_have_one_noun=()
531 noun_aliases=()
532}
533
534_git-bug_commands()
535{
536 last_command="git-bug_commands"
537
538 command_aliases=()
539
540 commands=()
541
542 flags=()
543 two_word_flags=()
544 local_nonpersistent_flags=()
545 flags_with_completion=()
546 flags_completion=()
547
548 flags+=("--pretty")
549 flags+=("-p")
550 local_nonpersistent_flags+=("--pretty")
551
552 must_have_one_flag=()
553 must_have_one_noun=()
554 noun_aliases=()
555}
556
557_git-bug_comment_add()
558{
559 last_command="git-bug_comment_add"
560
561 command_aliases=()
562
563 commands=()
564
565 flags=()
566 two_word_flags=()
567 local_nonpersistent_flags=()
568 flags_with_completion=()
569 flags_completion=()
570
571 flags+=("--file=")
572 two_word_flags+=("--file")
573 two_word_flags+=("-F")
574 local_nonpersistent_flags+=("--file=")
575 flags+=("--message=")
576 two_word_flags+=("--message")
577 two_word_flags+=("-m")
578 local_nonpersistent_flags+=("--message=")
579
580 must_have_one_flag=()
581 must_have_one_noun=()
582 noun_aliases=()
583}
584
585_git-bug_comment()
586{
587 last_command="git-bug_comment"
588
589 command_aliases=()
590
591 commands=()
592 commands+=("add")
593
594 flags=()
595 two_word_flags=()
596 local_nonpersistent_flags=()
597 flags_with_completion=()
598 flags_completion=()
599
600
601 must_have_one_flag=()
602 must_have_one_noun=()
603 noun_aliases=()
604}
605
606_git-bug_deselect()
607{
608 last_command="git-bug_deselect"
609
610 command_aliases=()
611
612 commands=()
613
614 flags=()
615 two_word_flags=()
616 local_nonpersistent_flags=()
617 flags_with_completion=()
618 flags_completion=()
619
620
621 must_have_one_flag=()
622 must_have_one_noun=()
623 noun_aliases=()
624}
625
626_git-bug_label_add()
627{
628 last_command="git-bug_label_add"
629
630 command_aliases=()
631
632 commands=()
633
634 flags=()
635 two_word_flags=()
636 local_nonpersistent_flags=()
637 flags_with_completion=()
638 flags_completion=()
639
640
641 must_have_one_flag=()
642 must_have_one_noun=()
643 noun_aliases=()
644}
645
646_git-bug_label_rm()
647{
648 last_command="git-bug_label_rm"
649
650 command_aliases=()
651
652 commands=()
653
654 flags=()
655 two_word_flags=()
656 local_nonpersistent_flags=()
657 flags_with_completion=()
658 flags_completion=()
659
660
661 must_have_one_flag=()
662 must_have_one_noun=()
663 noun_aliases=()
664}
665
666_git-bug_label()
667{
668 last_command="git-bug_label"
669
670 command_aliases=()
671
672 commands=()
673 commands+=("add")
674 commands+=("rm")
675
676 flags=()
677 two_word_flags=()
678 local_nonpersistent_flags=()
679 flags_with_completion=()
680 flags_completion=()
681
682
683 must_have_one_flag=()
684 must_have_one_noun=()
685 noun_aliases=()
686}
687
688_git-bug_ls()
689{
690 last_command="git-bug_ls"
691
692 command_aliases=()
693
694 commands=()
695
696 flags=()
697 two_word_flags=()
698 local_nonpersistent_flags=()
699 flags_with_completion=()
700 flags_completion=()
701
702 flags+=("--status=")
703 two_word_flags+=("--status")
704 two_word_flags+=("-s")
705 local_nonpersistent_flags+=("--status=")
706 flags+=("--author=")
707 two_word_flags+=("--author")
708 two_word_flags+=("-a")
709 local_nonpersistent_flags+=("--author=")
710 flags+=("--participant=")
711 two_word_flags+=("--participant")
712 two_word_flags+=("-p")
713 local_nonpersistent_flags+=("--participant=")
714 flags+=("--actor=")
715 two_word_flags+=("--actor")
716 two_word_flags+=("-A")
717 local_nonpersistent_flags+=("--actor=")
718 flags+=("--label=")
719 two_word_flags+=("--label")
720 two_word_flags+=("-l")
721 local_nonpersistent_flags+=("--label=")
722 flags+=("--title=")
723 two_word_flags+=("--title")
724 two_word_flags+=("-t")
725 local_nonpersistent_flags+=("--title=")
726 flags+=("--no=")
727 two_word_flags+=("--no")
728 two_word_flags+=("-n")
729 local_nonpersistent_flags+=("--no=")
730 flags+=("--by=")
731 two_word_flags+=("--by")
732 two_word_flags+=("-b")
733 local_nonpersistent_flags+=("--by=")
734 flags+=("--direction=")
735 two_word_flags+=("--direction")
736 two_word_flags+=("-d")
737 local_nonpersistent_flags+=("--direction=")
738
739 must_have_one_flag=()
740 must_have_one_noun=()
741 noun_aliases=()
742}
743
744_git-bug_ls-id()
745{
746 last_command="git-bug_ls-id"
747
748 command_aliases=()
749
750 commands=()
751
752 flags=()
753 two_word_flags=()
754 local_nonpersistent_flags=()
755 flags_with_completion=()
756 flags_completion=()
757
758
759 must_have_one_flag=()
760 must_have_one_noun=()
761 noun_aliases=()
762}
763
764_git-bug_ls-label()
765{
766 last_command="git-bug_ls-label"
767
768 command_aliases=()
769
770 commands=()
771
772 flags=()
773 two_word_flags=()
774 local_nonpersistent_flags=()
775 flags_with_completion=()
776 flags_completion=()
777
778
779 must_have_one_flag=()
780 must_have_one_noun=()
781 noun_aliases=()
782}
783
784_git-bug_pull()
785{
786 last_command="git-bug_pull"
787
788 command_aliases=()
789
790 commands=()
791
792 flags=()
793 two_word_flags=()
794 local_nonpersistent_flags=()
795 flags_with_completion=()
796 flags_completion=()
797
798
799 must_have_one_flag=()
800 must_have_one_noun=()
801 noun_aliases=()
802}
803
804_git-bug_push()
805{
806 last_command="git-bug_push"
807
808 command_aliases=()
809
810 commands=()
811
812 flags=()
813 two_word_flags=()
814 local_nonpersistent_flags=()
815 flags_with_completion=()
816 flags_completion=()
817
818
819 must_have_one_flag=()
820 must_have_one_noun=()
821 noun_aliases=()
822}
823
824_git-bug_select()
825{
826 last_command="git-bug_select"
827
828 command_aliases=()
829
830 commands=()
831
832 flags=()
833 two_word_flags=()
834 local_nonpersistent_flags=()
835 flags_with_completion=()
836 flags_completion=()
837
838
839 must_have_one_flag=()
840 must_have_one_noun=()
841 noun_aliases=()
842}
843
844_git-bug_show()
845{
846 last_command="git-bug_show"
847
848 command_aliases=()
849
850 commands=()
851
852 flags=()
853 two_word_flags=()
854 local_nonpersistent_flags=()
855 flags_with_completion=()
856 flags_completion=()
857
858 flags+=("--field=")
859 two_word_flags+=("--field")
860 two_word_flags+=("-f")
861 local_nonpersistent_flags+=("--field=")
862
863 must_have_one_flag=()
864 must_have_one_noun=()
865 noun_aliases=()
866}
867
868_git-bug_status_close()
869{
870 last_command="git-bug_status_close"
871
872 command_aliases=()
873
874 commands=()
875
876 flags=()
877 two_word_flags=()
878 local_nonpersistent_flags=()
879 flags_with_completion=()
880 flags_completion=()
881
882
883 must_have_one_flag=()
884 must_have_one_noun=()
885 noun_aliases=()
886}
887
888_git-bug_status_open()
889{
890 last_command="git-bug_status_open"
891
892 command_aliases=()
893
894 commands=()
895
896 flags=()
897 two_word_flags=()
898 local_nonpersistent_flags=()
899 flags_with_completion=()
900 flags_completion=()
901
902
903 must_have_one_flag=()
904 must_have_one_noun=()
905 noun_aliases=()
906}
907
908_git-bug_status()
909{
910 last_command="git-bug_status"
911
912 command_aliases=()
913
914 commands=()
915 commands+=("close")
916 commands+=("open")
917
918 flags=()
919 two_word_flags=()
920 local_nonpersistent_flags=()
921 flags_with_completion=()
922 flags_completion=()
923
924
925 must_have_one_flag=()
926 must_have_one_noun=()
927 noun_aliases=()
928}
929
930_git-bug_termui()
931{
932 last_command="git-bug_termui"
933
934 command_aliases=()
935
936 commands=()
937
938 flags=()
939 two_word_flags=()
940 local_nonpersistent_flags=()
941 flags_with_completion=()
942 flags_completion=()
943
944
945 must_have_one_flag=()
946 must_have_one_noun=()
947 noun_aliases=()
948}
949
950_git-bug_title_edit()
951{
952 last_command="git-bug_title_edit"
953
954 command_aliases=()
955
956 commands=()
957
958 flags=()
959 two_word_flags=()
960 local_nonpersistent_flags=()
961 flags_with_completion=()
962 flags_completion=()
963
964 flags+=("--title=")
965 two_word_flags+=("--title")
966 two_word_flags+=("-t")
967 local_nonpersistent_flags+=("--title=")
968
969 must_have_one_flag=()
970 must_have_one_noun=()
971 noun_aliases=()
972}
973
974_git-bug_title()
975{
976 last_command="git-bug_title"
977
978 command_aliases=()
979
980 commands=()
981 commands+=("edit")
982
983 flags=()
984 two_word_flags=()
985 local_nonpersistent_flags=()
986 flags_with_completion=()
987 flags_completion=()
988
989
990 must_have_one_flag=()
991 must_have_one_noun=()
992 noun_aliases=()
993}
994
995_git-bug_user_adopt()
996{
997 last_command="git-bug_user_adopt"
998
999 command_aliases=()
1000
1001 commands=()
1002
1003 flags=()
1004 two_word_flags=()
1005 local_nonpersistent_flags=()
1006 flags_with_completion=()
1007 flags_completion=()
1008
1009
1010 must_have_one_flag=()
1011 must_have_one_noun=()
1012 noun_aliases=()
1013}
1014
1015_git-bug_user_create()
1016{
1017 last_command="git-bug_user_create"
1018
1019 command_aliases=()
1020
1021 commands=()
1022
1023 flags=()
1024 two_word_flags=()
1025 local_nonpersistent_flags=()
1026 flags_with_completion=()
1027 flags_completion=()
1028
1029
1030 must_have_one_flag=()
1031 must_have_one_noun=()
1032 noun_aliases=()
1033}
1034
1035_git-bug_user_ls()
1036{
1037 last_command="git-bug_user_ls"
1038
1039 command_aliases=()
1040
1041 commands=()
1042
1043 flags=()
1044 two_word_flags=()
1045 local_nonpersistent_flags=()
1046 flags_with_completion=()
1047 flags_completion=()
1048
1049
1050 must_have_one_flag=()
1051 must_have_one_noun=()
1052 noun_aliases=()
1053}
1054
1055_git-bug_user()
1056{
1057 last_command="git-bug_user"
1058
1059 command_aliases=()
1060
1061 commands=()
1062 commands+=("adopt")
1063 commands+=("create")
1064 commands+=("ls")
1065
1066 flags=()
1067 two_word_flags=()
1068 local_nonpersistent_flags=()
1069 flags_with_completion=()
1070 flags_completion=()
1071
1072 flags+=("--field=")
1073 two_word_flags+=("--field")
1074 two_word_flags+=("-f")
1075 local_nonpersistent_flags+=("--field=")
1076
1077 must_have_one_flag=()
1078 must_have_one_noun=()
1079 noun_aliases=()
1080}
1081
1082_git-bug_version()
1083{
1084 last_command="git-bug_version"
1085
1086 command_aliases=()
1087
1088 commands=()
1089
1090 flags=()
1091 two_word_flags=()
1092 local_nonpersistent_flags=()
1093 flags_with_completion=()
1094 flags_completion=()
1095
1096 flags+=("--number")
1097 flags+=("-n")
1098 local_nonpersistent_flags+=("--number")
1099 flags+=("--commit")
1100 flags+=("-c")
1101 local_nonpersistent_flags+=("--commit")
1102 flags+=("--all")
1103 flags+=("-a")
1104 local_nonpersistent_flags+=("--all")
1105
1106 must_have_one_flag=()
1107 must_have_one_noun=()
1108 noun_aliases=()
1109}
1110
1111_git-bug_webui()
1112{
1113 last_command="git-bug_webui"
1114
1115 command_aliases=()
1116
1117 commands=()
1118
1119 flags=()
1120 two_word_flags=()
1121 local_nonpersistent_flags=()
1122 flags_with_completion=()
1123 flags_completion=()
1124
1125 flags+=("--open")
1126 local_nonpersistent_flags+=("--open")
1127 flags+=("--no-open")
1128 local_nonpersistent_flags+=("--no-open")
1129 flags+=("--port=")
1130 two_word_flags+=("--port")
1131 two_word_flags+=("-p")
1132 local_nonpersistent_flags+=("--port=")
1133
1134 must_have_one_flag=()
1135 must_have_one_noun=()
1136 noun_aliases=()
1137}
1138
1139_git-bug_root_command()
1140{
1141 last_command="git-bug"
1142
1143 command_aliases=()
1144
1145 commands=()
1146 commands+=("add")
1147 commands+=("bridge")
1148 commands+=("commands")
1149 commands+=("comment")
1150 commands+=("deselect")
1151 commands+=("label")
1152 commands+=("ls")
1153 commands+=("ls-id")
1154 commands+=("ls-label")
1155 commands+=("pull")
1156 commands+=("push")
1157 commands+=("select")
1158 commands+=("show")
1159 commands+=("status")
1160 commands+=("termui")
1161 if [[ -z "${BASH_VERSION}" || "${BASH_VERSINFO[0]}" -gt 3 ]]; then
1162 command_aliases+=("tui")
1163 aliashash["tui"]="termui"
1164 fi
1165 commands+=("title")
1166 commands+=("user")
1167 commands+=("version")
1168 commands+=("webui")
1169
1170 flags=()
1171 two_word_flags=()
1172 local_nonpersistent_flags=()
1173 flags_with_completion=()
1174 flags_completion=()
1175
1176
1177 must_have_one_flag=()
1178 must_have_one_noun=()
1179 noun_aliases=()
1180}
1181
1182__start_git-bug()
1183{
1184 local cur prev words cword
1185 declare -A flaghash 2>/dev/null || :
1186 declare -A aliashash 2>/dev/null || :
1187 if declare -F _init_completion >/dev/null 2>&1; then
1188 _init_completion -s || return
1189 else
1190 __git-bug_init_completion -n "=" || return
1191 fi
1192
1193 local c=0
1194 local flags=()
1195 local two_word_flags=()
1196 local local_nonpersistent_flags=()
1197 local flags_with_completion=()
1198 local flags_completion=()
1199 local commands=("git-bug")
1200 local must_have_one_flag=()
1201 local must_have_one_noun=()
1202 local last_command
1203 local nouns=()
1204
1205 __git-bug_handle_word
1206}
1207
1208if [[ $(type -t compopt) = "builtin" ]]; then
1209 complete -o default -F __start_git-bug git-bug
1210else
1211 complete -o default -o nospace -F __start_git-bug git-bug
1212fi
1213
1214# ex: ts=4 sw=4 et filetype=sh