mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Allow options to be selected in the GUI.
This commit is contained in:
48
lib/flags.cc
48
lib/flags.cc
@@ -55,31 +55,39 @@ static bool setFallbackFlag(
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const auto& configs : config.option())
|
||||
{
|
||||
if (path == configs.name())
|
||||
{
|
||||
if (configs.config().option_size() > 0)
|
||||
Error() << fmt::format(
|
||||
"option '{}' has an option inside it, which isn't "
|
||||
"allowed",
|
||||
path);
|
||||
if (configs.config().include_size() > 0)
|
||||
Error() << fmt::format(
|
||||
"option '{}' is trying to include something, which "
|
||||
"isn't allowed",
|
||||
path);
|
||||
|
||||
Logger() << fmt::format("OPTION: {}", configs.message());
|
||||
config.MergeFrom(configs.config());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (FlagGroup::applyOption(path))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Error() << "unrecognised flag; try --help";
|
||||
}
|
||||
|
||||
bool FlagGroup::applyOption(const std::string& option)
|
||||
{
|
||||
for (const auto& configs : config.option())
|
||||
{
|
||||
if (option == configs.name())
|
||||
{
|
||||
if (configs.config().option_size() > 0)
|
||||
Error() << fmt::format(
|
||||
"option '{}' has an option inside it, which isn't "
|
||||
"allowed",
|
||||
option);
|
||||
if (configs.config().include_size() > 0)
|
||||
Error() << fmt::format(
|
||||
"option '{}' is trying to include something, which "
|
||||
"isn't allowed",
|
||||
option);
|
||||
|
||||
Logger() << fmt::format("OPTION: {}", configs.message());
|
||||
config.MergeFrom(configs.config());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<std::string> FlagGroup::parseFlagsWithFilenames(int argc,
|
||||
const char* argv[],
|
||||
std::function<bool(const std::string&)> callback)
|
||||
|
||||
Reference in New Issue
Block a user