diff options
author | Michael Muré <batolettre@gmail.com> | 2019-05-27 21:47:26 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2019-05-27 21:47:26 +0200 |
commit | 8bfc65df6c4db01e74e5793fb4da402078b37648 (patch) | |
tree | bf9ca09db5b46a90b5c270191b40f0ae4dbb42d5 /misc | |
parent | d564e37b317a2d59a9694d80b03b40e5d36f741f (diff) | |
download | git-bug-8bfc65df6c4db01e74e5793fb4da402078b37648.tar.gz |
commands: add flags/config to control the automatic opening in the default browser
Diffstat (limited to 'misc')
-rw-r--r-- | misc/bash_completion/git-bug | 33 | ||||
-rw-r--r-- | misc/zsh_completion/git-bug | 2 |
2 files changed, 32 insertions, 3 deletions
diff --git a/misc/bash_completion/git-bug b/misc/bash_completion/git-bug index 682df96d..51e30da0 100644 --- a/misc/bash_completion/git-bug +++ b/misc/bash_completion/git-bug @@ -107,7 +107,13 @@ __git-bug_handle_reply() fi if [[ ${#COMPREPLY[@]} -eq 0 ]]; then - declare -F __custom_func >/dev/null && __custom_func + if declare -F __git-bug_custom_func >/dev/null; then + # try command name qualified custom func + __git-bug_custom_func + else + # otherwise fall back to unqualified for compatibility + declare -F __custom_func >/dev/null && __custom_func + fi fi # available in bash-completion >= 2, not always present on macOS @@ -171,7 +177,8 @@ __git-bug_handle_flag() fi # skip the argument to a two word flag - if __git-bug_contains_word "${words[c]}" "${two_word_flags[@]}"; then + if [[ ${words[c]} != *"="* ]] && __git-bug_contains_word "${words[c]}" "${two_word_flags[@]}"; then + __git-bug_debug "${FUNCNAME[0]}: found a flag ${words[c]}, skip the next argument" c=$((c+1)) # if we are looking for a flags value, don't show commands if [[ $c -eq $cword ]]; then @@ -263,12 +270,15 @@ _git-bug_add() flags_completion=() flags+=("--title=") + two_word_flags+=("--title") two_word_flags+=("-t") local_nonpersistent_flags+=("--title=") flags+=("--message=") + two_word_flags+=("--message") two_word_flags+=("-m") local_nonpersistent_flags+=("--message=") flags+=("--file=") + two_word_flags+=("--file") two_word_flags+=("-F") local_nonpersistent_flags+=("--file=") @@ -398,9 +408,11 @@ _git-bug_comment_add() flags_completion=() flags+=("--file=") + two_word_flags+=("--file") two_word_flags+=("-F") local_nonpersistent_flags+=("--file=") flags+=("--message=") + two_word_flags+=("--message") two_word_flags+=("-m") local_nonpersistent_flags+=("--message=") @@ -527,30 +539,39 @@ _git-bug_ls() flags_completion=() flags+=("--status=") + two_word_flags+=("--status") two_word_flags+=("-s") local_nonpersistent_flags+=("--status=") flags+=("--author=") + two_word_flags+=("--author") two_word_flags+=("-a") local_nonpersistent_flags+=("--author=") flags+=("--participant=") + two_word_flags+=("--participant") two_word_flags+=("-p") local_nonpersistent_flags+=("--participant=") flags+=("--actor=") + two_word_flags+=("--actor") two_word_flags+=("-A") local_nonpersistent_flags+=("--actor=") flags+=("--label=") + two_word_flags+=("--label") two_word_flags+=("-l") local_nonpersistent_flags+=("--label=") flags+=("--title=") + two_word_flags+=("--title") two_word_flags+=("-t") local_nonpersistent_flags+=("--title=") flags+=("--no=") + two_word_flags+=("--no") two_word_flags+=("-n") local_nonpersistent_flags+=("--no=") flags+=("--by=") + two_word_flags+=("--by") two_word_flags+=("-b") local_nonpersistent_flags+=("--by=") flags+=("--direction=") + two_word_flags+=("--direction") two_word_flags+=("-d") local_nonpersistent_flags+=("--direction=") @@ -674,6 +695,7 @@ _git-bug_show() flags_completion=() flags+=("--field=") + two_word_flags+=("--field") two_word_flags+=("-f") local_nonpersistent_flags+=("--field=") @@ -779,6 +801,7 @@ _git-bug_title_edit() flags_completion=() flags+=("--title=") + two_word_flags+=("--title") two_word_flags+=("-t") local_nonpersistent_flags+=("--title=") @@ -886,6 +909,7 @@ _git-bug_user() flags_completion=() flags+=("--field=") + two_word_flags+=("--field") two_word_flags+=("-f") local_nonpersistent_flags+=("--field=") @@ -937,7 +961,12 @@ _git-bug_webui() flags_with_completion=() flags_completion=() + flags+=("--open") + local_nonpersistent_flags+=("--open") + flags+=("--no-open") + local_nonpersistent_flags+=("--no-open") flags+=("--port=") + two_word_flags+=("--port") two_word_flags+=("-p") local_nonpersistent_flags+=("--port=") diff --git a/misc/zsh_completion/git-bug b/misc/zsh_completion/git-bug index c2ed9872..52c242df 100644 --- a/misc/zsh_completion/git-bug +++ b/misc/zsh_completion/git-bug @@ -8,7 +8,7 @@ case $state in level1) case $words[1] in git-bug) - _arguments '1: :(add bridge commands comment deselect label ls ls-id ls-label pull push select show status termui title user version webui)' + _arguments '1: :(add bridge commands comment deselect export label ls ls-id ls-label pull push select show status termui title user version webui)' ;; *) _arguments '*: :_files' |