Skip to content

Commit 43a48d3

Browse files
committed
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 using 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.
1 parent 111d1e5 commit 43a48d3

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/node_options.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,8 @@ std::string GetBashCompletion() {
831831
" return 0\n"
832832
" fi\n"
833833
"}\n"
834-
"complete -F _node_complete node node_g";
834+
"complete -o filenames -o nospace -o bashdefault "
835+
"-F _node_complete node node_g";
835836
return out.str();
836837
}
837838

test/parallel/test-bash-completion.js

Lines changed: 2 additions & 1 deletion
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)