mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-26 01:12:39 +00:00
Handle case where a command line flag is not allowed in the config file
This commit is contained in:
parent
99be9a044f
commit
ad80f1b357
1 changed files with 13 additions and 0 deletions
|
@ -219,6 +219,19 @@ int main(int argc, char const * argv[])
|
||||||
{
|
{
|
||||||
po::store(po::parse_config_file<char>(config_path.string<std::string>().c_str(), core_settings), vm);
|
po::store(po::parse_config_file<char>(config_path.string<std::string>().c_str(), core_settings), vm);
|
||||||
}
|
}
|
||||||
|
catch (const po::unknown_option &e)
|
||||||
|
{
|
||||||
|
std::string unrecognized_option = e.get_option_name();
|
||||||
|
if (all_options.find_nothrow(unrecognized_option, false))
|
||||||
|
{
|
||||||
|
std::cerr << "Option '" << unrecognized_option << "' is not allowed in the config file, please use it as a command line flag." << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cerr << "Unrecognized option '" << unrecognized_option << "' in config file." << std::endl;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
catch (const std::exception &e)
|
catch (const std::exception &e)
|
||||||
{
|
{
|
||||||
// log system isn't initialized yet
|
// log system isn't initialized yet
|
||||||
|
|
Loading…
Reference in a new issue