mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
ENH: add argList option ignoring for compatibility upgrades
- can be used to handle when options become redundant, but it is
undesirable to treat its presence as an error. Can now tag it as
being ignored.
argList::ignoreOptionCompat({"oldOption", 1706}, true);
argList::ignoreOptionCompat({"oldBoolOpttion", 1706}, false);
command -oldOption xyz -oldBoolOpttion
This commit is contained in:
@ -57,6 +57,15 @@ int main(int argc, char *argv[])
|
||||
// Fake a future option...
|
||||
argList::addOptionCompat("label", {"parse-label", 2112});
|
||||
|
||||
// Ignore an old bool option
|
||||
argList::ignoreOptionCompat({"xml", 1700}, false);
|
||||
|
||||
// Ignore an old option with arg. Specified version=0 to suppress warnings
|
||||
argList::ignoreOptionCompat({"format", 0}, true);
|
||||
|
||||
// Ignore a future option? Fairly pointless
|
||||
argList::ignoreOptionCompat({"ascii", 2112}, false);
|
||||
|
||||
argList::addArgument("label");
|
||||
argList::addArgument("...");
|
||||
argList::addArgument("label");
|
||||
@ -64,6 +73,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
argList args(argc, argv, false, true);
|
||||
|
||||
|
||||
Info<<"have: "
|
||||
<<args.count({"label", "scalar"}) << " options" << nl;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user