Skip to content

Commit

Permalink
+ Add command line options dump-config and get-config
Browse files Browse the repository at this point in the history
  • Loading branch information
ncsaba authored and wwmayer committed Jul 2, 2015
1 parent 0c93e0b commit 6b01685
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/App/Application.cpp
Expand Up @@ -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<string>(),"Can be specified with '@name', too")
("dump-config", "Dumps configuration")
("get-config", value<string>(), "Prints the value of the requested configuration key")
;

// Declare a group of options that will be
Expand Down Expand Up @@ -1740,6 +1742,25 @@ void Application::ParseOptions(int ac, char ** av)
};
}

if (vm.count("dump-config")) {
std::stringstream str;
for (std::map<std::string,std::string>::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<string>();
std::stringstream str;
std::map<std::string,std::string>::iterator pos;
pos = mConfig.find(configKey);
if (pos != mConfig.end()) {
str << pos->second;
}
str << std::endl;
throw Base::ProgramInformation(str.str());
}
}

void Application::ExtractUserPath()
Expand Down

0 comments on commit 6b01685

Please sign in to comment.