From f65d6ea0d7ca7de7a6c7538612731b11889086fb Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Sat, 4 Jan 2020 21:12:06 +0200 Subject: Fix configuration not being read unless explicitly specified --- src/main.cpp | 35 ++++++----------------------------- 1 file changed, 6 insertions(+), 29 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index f6a5b17..be6a559 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -38,14 +38,6 @@ inline std::string join_keys(const command_map &map, const std::string sep = ", return k; } -#if defined(CONFIG_USEPLASMA) && !defined(PLASMA) -#error "You have enabled Plasma integration, but Frameworks was not found." -#endif - -#if defined(CONFIG_USEBREAKPAD) && !defined(BREAKPAD) -#error "You have enabled Breakpad integration, but Breakpad was not found." -#endif - int main(int argc, char **argv) { // change log pattern @@ -54,20 +46,14 @@ int main(int argc, char **argv) spdlog::set_level(spdlog::level::debug); // Set global log level to debug #endif - const std::vector args(argv + 1, argv + argc); - args::ArgumentParser parser("smolbote: yet another no-frills browser", -#ifdef Q_OS_UNIX - "For more information on usage, refer to the manual page." -#else - "For more information on usage, refer to the manual." -#endif - ); - parser.Prog(argv[0]); - const command_map commands{ { "configuration", builtins::configuration } }; + const std::vector args(argv + 1, argv + argc); + args::ArgumentParser parser("smolbote: yet another no-frills browser", "Subcommands: " + join_keys(commands)); + parser.Prog(argv[0]); + args::HelpFlag cmd_help(parser, "help", "Display this help message.", { 'h', "help" }); args::Flag cmd_version(parser, "version", "Display version information.", { 'v', "version" }); args::Flag cmd_build(parser, "build", "Display build commit.", { 'b', "build" }); @@ -91,7 +77,7 @@ int main(int argc, char **argv) return builtins::build(); // create and load configuration - init_conf(args::get(cmd_config)); + spdlog::info("Loading configuration {}", init_conf(args::get(cmd_config))); if(cmd_args) { const auto front = args::get(cmd_args).front(); @@ -101,10 +87,8 @@ int main(int argc, char **argv) } } - } catch(args::Help &e) { + } catch(args::Help &) { std::cout << parser; - Q_UNUSED(e); - std::cout << "Available subcommands: " << join_keys(commands) << std::endl; return 0; } catch(args::Error &e) { @@ -113,13 +97,6 @@ int main(int argc, char **argv) return -1; } - // Disable Chromium's crash handler so breakpad can capture crashes instead. - // This has to be done before QtWebEngine gets initialized. - const auto chromiumFlags = qgetenv("QTWEBENGINE_CHROMIUM_FLAGS"); - if(!chromiumFlags.contains("disable-in-process-stack-traces")) { - qputenv("QTWEBENGINE_CHROMIUM_FLAGS", chromiumFlags + " --disable-in-process-stack-traces"); - } - QVector plugins; CommandHash_t pluginCommands; -- cgit v1.2.1