You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is an issue which was only slightly mentioned in #903, so I will describe this specific case here in more details.
Basic example:
auto CliApp = new CLI::App("myapp");
auto sub1 = CliApp->add_subcommand("sub1");
std::filesystem::path someFile = "";
sub1->add_option("-f,--file", someFile)->envname("SOME_FILE")->required()->expected(1)->check(CLI::ExistingFile);
try
{
CliApp->parse(argsCount, args);
}
catch (const CLI::ParseError& e)
{
return CliApp->exit(e);
}
Make sure %SOME_FILE% env var is defined as invalid/non-existing file path.
Then call the app like that: myapp.exe sub1 -h:
-Normally it should only display the help about sub1 expectations & requirements and exit, as that's a completely separate control flow path for the app, just like displaying the app version with -v.
-Actually it fails CLI::ExistingFile validator check, suggesting to Run with --help for more information.. But it's impossible to call for help.