mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-30 20:30:53 +00:00
Fixed: Return an error when a required argument is missing
This commit is contained in:
parent
970601bd6c
commit
cf05a2068b
1 changed files with 2 additions and 2 deletions
|
@ -141,7 +141,7 @@ bool CCmdArgs::needAdditionalArg() const
|
||||||
const TArg &arg = _Args[i];
|
const TArg &arg = _Args[i];
|
||||||
|
|
||||||
// they don't have any short or long name, but need a name in help
|
// they don't have any short or long name, but need a name in help
|
||||||
if (arg.shortName.empty() && arg.longName.empty() && !arg.helpName.empty() && arg.required)
|
if (arg.shortName.empty() && arg.longName.empty() && !arg.helpName.empty() && arg.required && !arg.found)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ bool CCmdArgs::parse(const std::vector<std::string> &argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
// process help if requested or if required arguments are missing
|
// process help if requested or if required arguments are missing
|
||||||
if (haveLongArg("help") || (needAdditionalArg() && !haveAdditionalArg()))
|
if (haveLongArg("help") || needAdditionalArg())
|
||||||
{
|
{
|
||||||
displayHelp();
|
displayHelp();
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in a new issue