Simplify, readd --wait-for-input

This commit is contained in:
Jacob Dufault 2018-01-29 15:43:22 -08:00
parent 09d7da2893
commit 55338e7481

View File

@ -74,8 +74,8 @@ bool ShouldDisplayIpcTiming(IpcId id) {
REGISTER_IPC_MESSAGE(Ipc_CancelRequest); REGISTER_IPC_MESSAGE(Ipc_CancelRequest);
void PrintHelp(std::ostream& os) { void PrintHelp() {
os << R"help(cquery is a low-latency C/C++/Objective-C language server. std::cout << R"help(cquery is a low-latency C/C++/Objective-C language server.
Mode: Mode:
--clang-sanity-check --clang-sanity-check
@ -100,6 +100,7 @@ Other command line options:
Print stdin (requests) and stdout (responses) to stderr Print stdin (requests) and stdout (responses) to stderr
--log-file <path> Logging file for diagnostics --log-file <path> Logging file for diagnostics
--log-all-to-stderr Write all log messages to STDERR. --log-all-to-stderr Write all log messages to STDERR.
--wait-for-input Wait for an '[Enter]' before exiting
--help Print this help information. --help Print this help information.
--ci Prevents tests from prompting the user for input. Used for --ci Prevents tests from prompting the user for input. Used for
continuous integration so it can fail faster instead of timing continuous integration so it can fail faster instead of timing
@ -107,7 +108,6 @@ Other command line options:
See more on https://github.com/cquery-project/cquery/wiki See more on https://github.com/cquery-project/cquery/wiki
)help"; )help";
exit(&os == &std::cout ? 0 : 1);
} }
} // namespace } // namespace
@ -439,8 +439,10 @@ int main(int argc, char** argv) {
std::unordered_map<std::string, std::string> options = std::unordered_map<std::string, std::string> options =
ParseOptions(argc, argv); ParseOptions(argc, argv);
if (HasOption(options, "-h") || HasOption(options, "--help")) if (HasOption(options, "-h") || HasOption(options, "--help")) {
PrintHelp(std::cout); PrintHelp();
return 0;
}
if (!HasOption(options, "--log-all-to-stderr")) if (!HasOption(options, "--log-all-to-stderr"))
loguru::g_stderr_verbosity = loguru::Verbosity_WARNING; loguru::g_stderr_verbosity = loguru::Verbosity_WARNING;
@ -485,7 +487,7 @@ int main(int argc, char** argv) {
g_debug = true; g_debug = true;
language_server = false; language_server = false;
if (!RunIndexTests(options["--test-index"], !HasOption(options, "--ci"))) if (!RunIndexTests(options["--test-index"], !HasOption(options, "--ci")))
return -1; return 1;
} }
if (language_server) { if (language_server) {
@ -519,5 +521,10 @@ int main(int argc, char** argv) {
&stdout_waiter); &stdout_waiter);
} }
if (HasOption(options, "--wait-for-input")) {
std::cerr << std::endl << "[Enter] to exit" << std::endl;
getchar();
}
return 0; return 0;
} }