Skip to content

Commit aa43bfb

Browse files
authored
Update shell_integration.py to support spaces in script file path. (#525)
Currently, any space in a script file path will result in an invalid shell code when calling shellcode(..., argcomplete_script=<path containing a space>). Replacing any space with "_SPACE_" solves this issue.
1 parent 86eafb2 commit aa43bfb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

argcomplete/shell_integration.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ def shellcode(executables, use_defaults=True, shell="bash", complete_arguments=N
166166
executables_list = " ".join(quoted_executables)
167167
script = argcomplete_script
168168
if script:
169-
function_suffix = "_" + script
169+
# If the script path contain a space, this would generate an invalid function name.
170+
function_suffix = "_" + script.replace(" ", "_SPACE_")
170171
else:
171172
script = ""
172173
function_suffix = ""

0 commit comments

Comments
 (0)