Skip to content

Commit 449d9ec

Browse files
danbevcodebytere
authored andcommittedJul 10, 2020
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 <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com>
1 parent abf04b2 commit 449d9ec

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
@@ -833,7 +833,8 @@ std::string GetBashCompletion() {
833833
" return 0\n"
834834
" fi\n"
835835
"}\n"
836-
"complete -F _node_complete node node_g";
836+
"complete -o filenames -o nospace -o bashdefault "
837+
"-F _node_complete node node_g";
837838
return out.str();
838839
}
839840

‎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)