@@ -5,26 +5,44 @@ give_comps() {
55 echo $' # completely (https://github.com/dannyben/completely)'
66 echo $' # Modifying it manually is not recommended'
77 echo $' '
8+ echo $' _mygit_completions_filter() {'
9+ echo $' local words="$1"'
10+ echo $' local cur=${COMP_WORDS[COMP_CWORD]}'
11+ echo $' local result=()'
12+ echo $' '
13+ echo $' if [[ "${cur:0:1}" == "-" ]]; then'
14+ echo $' echo "$words"'
15+ echo $' '
16+ echo $' else'
17+ echo $' for word in $words; do'
18+ echo $' [[ "${word:0:1}" != "-" ]] && result+=("$word")'
19+ echo $' done'
20+ echo $' '
21+ echo $' echo "${result[*]}"'
22+ echo $' '
23+ echo $' fi'
24+ echo $' }'
25+ echo $' '
826 echo $' _mygit_completions() {'
927 echo $' local cur=${COMP_WORDS[COMP_CWORD]}'
1028 echo $' local compwords=("${COMP_WORDS[@]:1:$COMP_CWORD-1}")'
1129 echo $' local compline="${compwords[*]}"'
1230 echo $' '
1331 echo $' case "$compline" in'
1432 echo $' \' status\' *)'
15- echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "--help --verbose --branch $(git branch 2> /dev/null)" -- "$cur" )'
33+ echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_mygit_completions_filter " --help --verbose --branch $(git branch 2> /dev/null)" )" -- "$cur" )'
1634 echo $' ;;'
1735 echo $' '
1836 echo $' \' commit\' *)'
19- echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -W "--help --message --all -a --quiet -q" -- "$cur" )'
37+ echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A file -W "$(_mygit_completions_filter " --help --message --all -a --quiet -q") " -- "$cur" )'
2038 echo $' ;;'
2139 echo $' '
2240 echo $' \' init\' *)'
23- echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -W "--bare" -- "$cur" )'
41+ echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -A directory -W "$(_mygit_completions_filter " --bare") " -- "$cur" )'
2442 echo $' ;;'
2543 echo $' '
2644 echo $' *)'
27- echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "--help --version status init commit" -- "$cur" )'
45+ echo $' while read -r; do COMPREPLY+=( "$REPLY" ); done < <( compgen -W "$(_mygit_completions_filter " --help --version status init commit") " -- "$cur" )'
2846 echo $' ;;'
2947 echo $' '
3048 echo $' esac'
0 commit comments