Skip to content

Commit cbec6e8

Browse files
committed
Dynamically enable filename completion in BASH instead of calling _filedir
`_filedir` is a function provided by the bash-completion project, not by BASH itself. I was seeing inconsistent completion results with multi-word/escaped results as the completer was returning filenames, but wasn't in `filenames` mode. I went to enable filename completion mode to get better completion behaviour for paths from `_filedir`, but it turns out the completion hook function can just be switched to BASH's default file/dir completion behaviour instead.
1 parent 0240a08 commit cbec6e8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/HookFactory.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ function %%function_name%% {
5757
# Check if shell provided path completion is requested
5858
# @see Completion\ShellPathCompletion
5959
if [ $STATUS -eq 200 ]; then
60-
_filedir;
60+
# Turn file/dir completion on temporarily and give control back to BASH
61+
compopt -o default;
6162
return 0;
6263
6364
# Bail out if PHP didn't exit cleanly

0 commit comments

Comments
 (0)