From 640d72f85c56dbf5bf72be9c2032fc465d885332 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sun, 28 Jan 2018 14:05:54 -0800 Subject: [PATCH] Check --init and remove --wait-for-input --- src/command_line.cc | 16 ++++++++-------- src/messages/initialize.cc | 1 - 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/command_line.cc b/src/command_line.cc index 4ec61fa4..4462de9f 100644 --- a/src/command_line.cc +++ b/src/command_line.cc @@ -100,7 +100,6 @@ Other command line options: Print stdin (requests) and stdout (responses) to stderr --log-file Logging file for diagnostics --log-all-to-stderr Write all log messages to STDERR. - --wait-for-input Wait for an '[Enter]' before exiting --help Print this help information. --ci Prevents tests from prompting the user for input. Used for continuous integration so it can fail faster instead of timing @@ -502,8 +501,14 @@ int main(int argc, char** argv) { << ")\n"; return 1; } - if (!reader.IsObject()) { - std::cerr << "--init must be a JSON object\n"; + JsonReader json_reader{&reader}; + try { + Config config; + Reflect(json_reader, config); + } catch (std::invalid_argument& e) { + std::cerr << "Fail to parse --init " + << static_cast(json_reader).GetPath() + << ", expected " << e.what() << "\n"; return 1; } } @@ -514,10 +519,5 @@ int main(int argc, char** argv) { &stdout_waiter); } - if (HasOption(options, "--wait-for-input")) { - std::cerr << std::endl << "[Enter] to exit" << std::endl; - getchar(); - } - return 0; } diff --git a/src/messages/initialize.cc b/src/messages/initialize.cc index 0f4572d1..ce519deb 100644 --- a/src/messages/initialize.cc +++ b/src/messages/initialize.cc @@ -14,7 +14,6 @@ // TODO Cleanup global variables extern std::string g_init_options; -extern bool g_index_builtin_types; extern int g_enable_comments; namespace {