Skip to content

Commit

Permalink
bash: fix subcommand completion
Browse files Browse the repository at this point in the history
  • Loading branch information
brentyi authored and casperdcl committed Oct 29, 2022
1 parent 13de419 commit cb81d71
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions shtab/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def complete_bash(parser, root_prefix=None, preamble="", choice_functions=None):
local current_action_compgen_var=${current_action}_COMPGEN
current_action_compgen="${!current_action_compgen_var}"
local current_action_choices_var="${current_action}_choices"
local current_action_choices_var="${current_action}_choices[@]"
current_action_choices="${!current_action_choices_var}"
local current_action_nargs_var="${current_action}_nargs"
Expand Down Expand Up @@ -420,8 +420,7 @@ def complete_bash(parser, root_prefix=None, preamble="", choice_functions=None):
COMPREPLY=( $(compgen -W "${current_option_strings[*]}" -- "${completing_word}") )
else
# use choices & compgen
local IFS=$'\\n'
COMPREPLY=( $(compgen -W "${current_action_choices}" -- "${completing_word}") \\
COMPREPLY=( $(compgen -W "${current_action_choices[*]}" -- "${completing_word}") \\
$([ -n "${current_action_compgen}" ] \\
&& "${current_action_compgen}" "${completing_word}") )
fi
Expand Down

0 comments on commit cb81d71

Please sign in to comment.