statusweather: Simplify check for required options.
This commit is contained in:
parent
f5bef72217
commit
54381155cc
|
@ -104,10 +104,8 @@ std::tuple<std::string, std::string> get_options()
|
||||||
std::ifstream configfile(path);
|
std::ifstream configfile(path);
|
||||||
po::store(po::parse_config_file(configfile, options, true), vm);
|
po::store(po::parse_config_file(configfile, options, true), vm);
|
||||||
configfile.close();
|
configfile.close();
|
||||||
if ((vm.count("api_key") == 0) || (vm.count("city") == 0))
|
|
||||||
{
|
po::notify(vm);
|
||||||
throw std::runtime_error{"api_key or city not configured."};
|
|
||||||
}
|
|
||||||
|
|
||||||
return std::make_tuple(vm["api_key"].as<std::string>(),
|
return std::make_tuple(vm["api_key"].as<std::string>(),
|
||||||
vm["city"].as<std::string>());
|
vm["city"].as<std::string>());
|
||||||
|
|
Loading…
Reference in New Issue