Skip to content

Commit cdcd768

Browse files
danbevcodebytere
authored andcommitted
src: add "missing" bash completion options
Currently, when using the bash completions for node the normal completions for filenames directories do not work. For example, after finding a node completion and then wanting to use tab completion for a filename in the test directory, it is only possible to get the name of the test directory completed, followed by a space. What is expected is to be able to continue with tab completion for directories. This commit adds options to the complete command to enable default bash completions. PR-URL: #33744 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Richard Lau <[email protected]>
1 parent 26a3cf0 commit cdcd768

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/node_options.cc

+2-1
Original file line numberDiff line numberDiff line change
@@ -829,7 +829,8 @@ std::string GetBashCompletion() {
829829
" return 0\n"
830830
" fi\n"
831831
"}\n"
832-
"complete -F _node_complete node node_g";
832+
"complete -o filenames -o nospace -o bashdefault "
833+
"-F _node_complete node node_g";
833834
return out.str();
834835
}
835836

test/parallel/test-bash-completion.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ const suffix = `' -- "\${cur_word}") )
2424
return 0
2525
fi
2626
}
27-
complete -F _node_complete node node_g`.replace(/\r/g, '');
27+
complete -o filenames -o nospace -o bashdefault -F _node_complete node node_g`
28+
.replace(/\r/g, '');
2829

2930
assert.ok(
3031
output.includes(prefix),

0 commit comments

Comments
 (0)