Skip to content

Commit

Permalink
bump version, merge pull request #23 from iterative/devel
Browse files Browse the repository at this point in the history
fix bash>=4.4 bad substitution
  • Loading branch information
casperdcl authored Sep 30, 2020
2 parents f5693b8 + af45175 commit a01e2b5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions shtab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,11 @@ def complete_bash(
echo $1 | sed 's/-/_/g'
}
# $1=COMP_WORDS[1]
_shtab_replace_nonword() {
echo "${1//[^[:word:]]/_}"
}
# $1=COMP_WORDS[1]
{root_prefix}_compgen_root_() {
local args_gen="{root_prefix}_COMPGEN"
Expand All @@ -316,7 +321,7 @@ def complete_bash(
# $1=COMP_WORDS[1]
{root_prefix}_compgen_command_() {
local flags_list="{root_prefix}_$(_shtab_replace_hyphen $1)"
local flags_list="{root_prefix}_$(_shtab_replace_nonword $1)"
local args_gen="${flags_list}_COMPGEN"
COMPREPLY=( $(compgen -W "${!flags_list}" -- "$word"; \
[ -n "${!args_gen}" ] && ${!args_gen} "$word") )
Expand All @@ -325,8 +330,7 @@ def complete_bash(
# $1=COMP_WORDS[1]
# $2=COMP_WORDS[2]
{root_prefix}_compgen_subcommand_() {
local flags_list="{root_prefix}_$(\
_shtab_replace_hyphen $1)_$(_shtab_replace_hyphen $2)"
local flags_list="{root_prefix}_$(_shtab_replace_nonword "${1}_${2}")"
local args_gen="${flags_list}_COMPGEN"
[ -n "${!args_gen}" ] && local opts_more="$(${!args_gen} "$word")"
local opts="${!flags_list}"
Expand Down

0 comments on commit a01e2b5

Please sign in to comment.