Skip to content

Commit 813368c

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 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 7f8e977 commit 813368c

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

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)