From cdcd76810e921028d7d8add4c63875351c8b8662 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Fri, 5 Jun 2020 14:17:13 +0200 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/33744 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Richard Lau --- src/node_options.cc | 3 ++- test/parallel/test-bash-completion.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/node_options.cc b/src/node_options.cc index cb812f6ccfc1ab..f4d6e75acd9d07 100644 --- a/src/node_options.cc +++ b/src/node_options.cc @@ -829,7 +829,8 @@ std::string GetBashCompletion() { " return 0\n" " fi\n" "}\n" - "complete -F _node_complete node node_g"; + "complete -o filenames -o nospace -o bashdefault " + "-F _node_complete node node_g"; return out.str(); } diff --git a/test/parallel/test-bash-completion.js b/test/parallel/test-bash-completion.js index 4492c2f85c470f..c0b284153a7058 100644 --- a/test/parallel/test-bash-completion.js +++ b/test/parallel/test-bash-completion.js @@ -24,7 +24,8 @@ const suffix = `' -- "\${cur_word}") ) return 0 fi } -complete -F _node_complete node node_g`.replace(/\r/g, ''); +complete -o filenames -o nospace -o bashdefault -F _node_complete node node_g` + .replace(/\r/g, ''); assert.ok( output.includes(prefix),