From 9bfda44735463fb552b41099420a4e7bd118a674 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Sat, 29 Oct 2022 15:12:19 +0100 Subject: [PATCH] fix #74 again --- shtab/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/shtab/__init__.py b/shtab/__init__.py index 45a13a2..159c62f 100644 --- a/shtab/__init__.py +++ b/shtab/__init__.py @@ -420,9 +420,11 @@ def complete_bash(parser, root_prefix=None, preamble="", choice_functions=None): COMPREPLY=( $(compgen -W "${current_option_strings[*]}" -- "${completing_word}") ) else # use choices & compgen - COMPREPLY=( $(compgen -W "${current_action_choices[*]}" -- "${completing_word}") \\ - $([ -n "${current_action_compgen}" ] \\ + local IFS=$'\\n' # items may contain spaces, so delimit using newline + COMPREPLY=( $([ -n "${current_action_compgen}" ] \\ && "${current_action_compgen}" "${completing_word}") ) + unset IFS + COMPREPLY+=( $(compgen -W "${current_action_choices[*]}" -- "${completing_word}") ) fi return 0