File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -303,6 +303,11 @@ def complete_bash(
303303 echo $1 | sed 's/-/_/g'
304304}
305305
306+ # $1=COMP_WORDS[1]
307+ _shtab_replace_nonword() {
308+ echo "${1//[^[:word:]]/_}"
309+ }
310+
306311# $1=COMP_WORDS[1]
307312{root_prefix}_compgen_root_() {
308313 local args_gen="{root_prefix}_COMPGEN"
@@ -316,7 +321,7 @@ def complete_bash(
316321
317322# $1=COMP_WORDS[1]
318323{root_prefix}_compgen_command_() {
319- local flags_list="{root_prefix}_$(_shtab_replace_hyphen $1)"
324+ local flags_list="{root_prefix}_$(_shtab_replace_nonword $1)"
320325 local args_gen="${flags_list}_COMPGEN"
321326 COMPREPLY=( $(compgen -W "${!flags_list}" -- "$word"; \
322327 [ -n "${!args_gen}" ] && ${!args_gen} "$word") )
@@ -325,8 +330,7 @@ def complete_bash(
325330# $1=COMP_WORDS[1]
326331# $2=COMP_WORDS[2]
327332{root_prefix}_compgen_subcommand_() {
328- local flags_list="{root_prefix}_$(\
329- _shtab_replace_hyphen $1)_$(_shtab_replace_hyphen $2)"
333+ local flags_list="{root_prefix}_$(_shtab_replace_nonword "${1}_${2}")"
330334 local args_gen="${flags_list}_COMPGEN"
331335 [ -n "${!args_gen}" ] && local opts_more="$(${!args_gen} "$word")"
332336 local opts="${!flags_list}"
You can’t perform that action at this time.
0 commit comments