From dda8608fd522b7a9d6b89be80a1f9874d655556d Mon Sep 17 00:00:00 2001 From: Csaba Nagy Date: Thu, 2 Jul 2015 13:22:13 +0200 Subject: [PATCH] + Add command line options dump-config and get-config --- src/App/Application.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 05cf9d72c2..8645ae9c10 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -1501,6 +1501,8 @@ void Application::ParseOptions(int ac, char ** av) ("help,h", "Prints help message") ("console,c", "Starts in console mode") ("response-file", value(),"Can be specified with '@name', too") + ("dump-config", "Dumps configuration") + ("get-config", value(), "Prints the value of the requested configuration key") ; // Declare a group of options that will be @@ -1740,6 +1742,25 @@ void Application::ParseOptions(int ac, char ** av) }; } + if (vm.count("dump-config")) { + std::stringstream str; + for (std::map::iterator it=mConfig.begin(); it != mConfig.end(); ++it) { + str << it->first << "=" << it->second << std::endl; + } + throw Base::ProgramInformation(str.str()); + } + + if (vm.count("get-config")) { + std::string configKey = vm["get-config"].as(); + std::stringstream str; + std::map::iterator pos; + pos = mConfig.find(configKey); + if (pos != mConfig.end()) { + str << pos->second; + } + str << std::endl; + throw Base::ProgramInformation(str.str()); + } } void Application::ExtractUserPath()