diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2019-02-03 06:47:26 +0300 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2020-01-03 18:21:42 +0300 |
commit | 80732cdf9c4a6beb19226d720ffb20cb505bc6e4 (patch) | |
tree | eddfc0cdb57461fbdcd57d91ee6339e9a6b069f6 /src/node.cc | |
parent | 1357c97a70e4b1552575079ae806573557bcb509 (diff) |
src: port --bash-completion to C++
So that it gets handle earlier and faster during the bootstrap
process.
Drive-by fixes:
- Remove `[has_eval_string]` and `[ssl_openssl_cert_store]` from
the completion output
- Set `kProfProcess` execution mode for `--prof-process` instead
of `kPrintBashProcess` which is removed in this patch.
- Append new line to the end of the output of --bash-completion
PR-URL: https://github.com/nodejs/node/pull/25901
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node.cc')
-rw-r--r-- | src/node.cc | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/node.cc b/src/node.cc index 9599b3625a5..35f5249e341 100644 --- a/src/node.cc +++ b/src/node.cc @@ -438,9 +438,6 @@ MaybeLocal<Value> StartMainThreadExecution(Environment* env) { return StartExecution(env, "internal/main/print_help"); } - if (per_process::cli_options->print_bash_completion) { - return StartExecution(env, "internal/main/print_bash_completion"); - } if (env->options()->prof_process) { return StartExecution(env, "internal/main/prof_process"); @@ -974,6 +971,12 @@ void Init(int* argc, exit(0); } + if (per_process::cli_options->print_bash_completion) { + std::string completion = options_parser::GetBashCompletion(); + printf("%s\n", completion.c_str()); + exit(0); + } + if (per_process::cli_options->print_v8_help) { // Doesn't return. V8::SetFlagsFromString("--help", static_cast<size_t>(6)); @@ -1044,6 +1047,12 @@ InitializationResult InitializeOncePerProcess(int argc, char** argv) { return result; } + if (per_process::cli_options->print_bash_completion) { + std::string completion = options_parser::GetBashCompletion(); + printf("%s\n", completion.c_str()); + exit(0); + } + if (per_process::cli_options->print_v8_help) { // Doesn't return. V8::SetFlagsFromString("--help", static_cast<size_t>(6)); |