Skip to content
Myr

Support different bash completion options (#1509)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

https://github.com/spf13/cobra/issues/1508 Based on the documentation found here https://www.gnu.org/software/bash/manual/html_node/Commands-For-Completion.html we remove descriptions for the following completion types: - menu-complete - menu-complete-backward - insert-completions

authored by Marc Khouzam · committed by GitHub · parent 507caf5 · Browse files · 1 file+30 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>

Diff stats

1 file+30 added−1 removed

  • other:+30 added−1 removed

1 file+30 added−1 removed

modified:bash_completionsV2.go+30 added-1 removed
136 unmodified lines
137 __%[1]s_debug "Listing directories in ."138 _filedir -d139 fi140 else141 __%[1]s_handle_standard_completion_case141 __%[1]s_handle_completion_types142 fi143144 __%[1]s_handle_special_char "$cur" :145 __%[1]s_handle_special_char "$cur" =146}147148__%[1]s_handle_completion_types() {149 __%[1]s_debug "__%[1]s_handle_completion_types: COMP_TYPE is $COMP_TYPE"150151 case $COMP_TYPE in152 37|42)153 # Type: menu-complete/menu-complete-backward and insert-completions154 # If the user requested inserting one completion at a time, or all155 # completions at once on the command-line we must remove the descriptions.156 # https://github.com/spf13/cobra/issues/1508157 local tab comp158 tab=$(printf '\t')159 while IFS='' read -r comp; do160 # Strip any description161 comp=${comp%%%%$tab*}162 # Only consider the completions that match163 comp=$(compgen -W "$comp" -- "$cur")164 if [ -n "$comp" ]; then165 COMPREPLY+=("$comp")166 fi167 done < <(printf "%%s\n" "${out[@]}")168 ;;169170 *)171 # Type: complete (normal completion)172 __%[1]s_handle_standard_completion_case173 ;;174 esac175}176177__%[1]s_handle_standard_completion_case() {178 local tab comp179 tab=$(printf '\t')180
151 unmodified lines