mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: support usage descriptions for command arguments
This commit is contained in:
@ -350,7 +350,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "addOverwriteOption.H"
|
||||
|
||||
argList::addArgument("featureAngle [0..180]");
|
||||
argList::addArgument
|
||||
(
|
||||
"featureAngle",
|
||||
"in degrees [0-180]"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"concaveAngle",
|
||||
@ -360,7 +364,7 @@ int main(int argc, char *argv[])
|
||||
argList::addBoolOption
|
||||
(
|
||||
"meshQuality",
|
||||
"Read user-defined mesh quality criterions from system/meshQualityDict"
|
||||
"Read user-defined mesh quality criteria from system/meshQualityDict"
|
||||
);
|
||||
|
||||
argList::noFunctionObjects(); // Never use function objects
|
||||
@ -411,7 +415,7 @@ int main(int argc, char *argv[])
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ Description
|
||||
Refine cells next to specified patches.
|
||||
|
||||
Arguments:
|
||||
1: List of patch name regular expressions
|
||||
1: List of patch names or regular expressions
|
||||
2: The size of the refined cells as a fraction of the edge-length.
|
||||
|
||||
Examples:
|
||||
@ -63,13 +63,21 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addNote
|
||||
(
|
||||
"Refine cells next to specified patches.\n"
|
||||
"The list of patches may contain regular expressions.\n"
|
||||
"Refine cells next to specified patches."
|
||||
);
|
||||
|
||||
#include "addOverwriteOption.H"
|
||||
argList::addArgument("patches");
|
||||
argList::addArgument("edgeFraction");
|
||||
argList::addArgument
|
||||
(
|
||||
"patches",
|
||||
"The list of patch names or regex - Eg, '(top \"Wall.\")'"
|
||||
);
|
||||
argList::addArgument
|
||||
(
|
||||
"edgeFraction",
|
||||
"The size of the refined cells as a fraction of the edge-length"
|
||||
" on a (0,1) interval"
|
||||
);
|
||||
|
||||
argList::addOption
|
||||
(
|
||||
|
||||
@ -526,7 +526,11 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
#include "addOverwriteOption.H"
|
||||
argList::noParallel();
|
||||
argList::addArgument("edgeAngle [0..360]");
|
||||
argList::addArgument
|
||||
(
|
||||
"edgeAngle",
|
||||
"in degrees [0-360]"
|
||||
);
|
||||
|
||||
argList::addOption
|
||||
(
|
||||
|
||||
@ -99,7 +99,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
argList::addArgument("ccmMesh");
|
||||
argList::addArgument("ccm-file", "The input .ccm or .ccmg file");
|
||||
argList::addBoolOption
|
||||
(
|
||||
"ascii",
|
||||
|
||||
@ -64,7 +64,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
argList::addArgument("firePolyMesh");
|
||||
argList::addArgument("firePolyMesh", "The input FIRE mesh");
|
||||
argList::addBoolOption
|
||||
(
|
||||
"ascii",
|
||||
|
||||
@ -61,7 +61,8 @@ int main(int argc, char *argv[])
|
||||
"Extract boundaries from an OpenFOAM mesh and write in a surface format"
|
||||
);
|
||||
argList::noParallel();
|
||||
argList::addArgument("outputFile.ext");
|
||||
argList::addArgument("output", "The output surface file");
|
||||
|
||||
timeSelector::addOptions();
|
||||
|
||||
argList::addOption
|
||||
|
||||
@ -70,7 +70,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
argList::addArgument("PROSTAR prefix");
|
||||
argList::addArgument("prefix", "The prefix for the input PROSTAR files");
|
||||
argList::addBoolOption
|
||||
(
|
||||
"ascii",
|
||||
|
||||
@ -106,7 +106,7 @@ int main(int argc, char *argv[])
|
||||
"Convert tetgen .ele and .node and .face files to an OpenFOAM mesh"
|
||||
);
|
||||
|
||||
argList::addArgument("file prefix");
|
||||
argList::addArgument("prefix", "The prefix for the input tetgen files");
|
||||
argList::addBoolOption
|
||||
(
|
||||
"noFaceFile",
|
||||
|
||||
@ -58,7 +58,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
argList::addArgument(".vtk ascii file");
|
||||
argList::addArgument("vtk-file", "The input legacy ascii vtk file");
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
@ -369,7 +369,7 @@ int main(int argc, char *argv[])
|
||||
"Re-sample surfaces used in foamyHexMesh operation"
|
||||
);
|
||||
|
||||
argList::addArgument("outputName");
|
||||
argList::addArgument("output", "The output triSurface/ file");
|
||||
|
||||
argList::noFunctionObjects(); // Never use function objects
|
||||
|
||||
|
||||
@ -53,8 +53,8 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
"Re-sample surfaces used in foamyHexMesh operation"
|
||||
);
|
||||
argList::addArgument("(nx ny nz)");
|
||||
argList::addArgument("outputName");
|
||||
argList::addArgument("(nx ny nz)", "The resampling interval");
|
||||
argList::addArgument("output", "The output triSurface/ file");
|
||||
|
||||
argList::noFunctionObjects(); // Never use function objects
|
||||
|
||||
|
||||
@ -83,7 +83,7 @@ int main(int argc, char *argv[])
|
||||
argList::noParallel();
|
||||
argList::noFunctionObjects(); // Never use function objects
|
||||
|
||||
argList::addArgument("feature angle[0-180]");
|
||||
argList::addArgument("featureAngle", "in degrees [0-180]");
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
@ -50,7 +50,7 @@ int main(int argc, char *argv[])
|
||||
" supplied as an argument"
|
||||
);
|
||||
|
||||
argList::addArgument("scaling factor");
|
||||
argList::addArgument("factor", "The deformation scaling factor");
|
||||
|
||||
#include "setRootCase.H"
|
||||
|
||||
|
||||
@ -116,8 +116,8 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
argList::addArgument("OBJ file");
|
||||
argList::addArgument("output VTK file");
|
||||
argList::addArgument("obj-file", "The input obj line file");
|
||||
argList::addArgument("vtk-file", "The output vtk file");
|
||||
argList args(argc, argv);
|
||||
|
||||
const fileName objName = args[1];
|
||||
|
||||
@ -28,7 +28,7 @@ Group
|
||||
grpMeshManipulationUtilities
|
||||
|
||||
Description
|
||||
Corrects teh orientation of faceZone.
|
||||
Corrects the orientation of faceZone.
|
||||
|
||||
- correct in parallel - excludes coupled faceZones from walk
|
||||
- correct for non-manifold faceZones - restarts walk
|
||||
@ -55,7 +55,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
#include "addRegionOption.H"
|
||||
argList::addArgument("faceZone");
|
||||
argList::addArgument("outsidePoint");
|
||||
argList::addArgument("point", "A point outside of the mesh");
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
@ -368,7 +368,12 @@ int main(int argc, char *argv[])
|
||||
#include "addOverwriteOption.H"
|
||||
argList::noParallel();
|
||||
|
||||
argList::addArgument("featureAngle [0-180]");
|
||||
argList::addArgument
|
||||
(
|
||||
"featureAngle",
|
||||
"in degrees [0-180]"
|
||||
);
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
"splitAllFaces",
|
||||
|
||||
@ -72,13 +72,13 @@ int main(int argc, char *argv[])
|
||||
argList::addNote
|
||||
(
|
||||
"Rotate mesh points and vector/tensor fields\n"
|
||||
"Rotation from the <n1> vector to the <n2> vector"
|
||||
"Rotation from the <from> vector to the <to> vector"
|
||||
);
|
||||
|
||||
timeSelector::addOptions();
|
||||
|
||||
argList::addArgument("n1");
|
||||
argList::addArgument("n2");
|
||||
argList::addArgument("from", "The vector to rotate from");
|
||||
argList::addArgument("to", "The vector to rotate to");
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
@ -123,9 +123,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "addOverwriteOption.H"
|
||||
|
||||
argList::addArgument("faceSet");
|
||||
argList::addArgument("masterPatch");
|
||||
argList::addArgument("slavePatch");
|
||||
argList::addArgument("faceSet", "The faces used for splitting");
|
||||
argList::addArgument("master", "The master patch name");
|
||||
argList::addArgument("slave", "The slave patch name");
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
@ -145,8 +145,16 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
// The arguments are non-mandatory when using dictionary mode
|
||||
argList::addArgument("masterPatch");
|
||||
argList::addArgument("slavePatch");
|
||||
argList::addArgument
|
||||
(
|
||||
"master",
|
||||
"The master patch name (non-dictionary mode)"
|
||||
);
|
||||
argList::addArgument
|
||||
(
|
||||
"slave",
|
||||
"The slave patch name (non-dictionary mode)"
|
||||
);
|
||||
|
||||
#include "setRootCaseNonMandatoryArgs.H"
|
||||
|
||||
|
||||
@ -269,7 +269,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
argList::noBanner();
|
||||
argList::noJobInfo();
|
||||
argList::addArgument("dictionary");
|
||||
argList::addArgument("dict", "The dictionary file to process");
|
||||
argList::addBoolOption("keywords", "List keywords");
|
||||
argList::addOption("entry", "name", "Report/select the named entry");
|
||||
argList::addBoolOption
|
||||
|
||||
@ -56,9 +56,9 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
argList::addArgument("surfaceFile");
|
||||
argList::addArgument("surfaceFile");
|
||||
argList::addArgument("output surfaceFile");
|
||||
argList::addArgument("surface1", "The input surface file 1");
|
||||
argList::addArgument("surface2", "The input surface file 2");
|
||||
argList::addArgument("output", "The output surface file");
|
||||
|
||||
argList::addOption
|
||||
(
|
||||
|
||||
@ -1509,14 +1509,18 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
argList::addNote
|
||||
(
|
||||
"Generates the extendedFeatureEdgeMesh for the interface between"
|
||||
"Generates the extendedFeatureEdgeMesh for the interface created by"
|
||||
" a boolean operation on two surfaces."
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
argList::addArgument("action");
|
||||
argList::addArgument("surfaceFile1");
|
||||
argList::addArgument("surfaceFile2");
|
||||
argList::addArgument
|
||||
(
|
||||
"action",
|
||||
"One of (intersection | union | difference)"
|
||||
);
|
||||
argList::addArgument("surface1", "The input surface file 1");
|
||||
argList::addArgument("surface2", "The input surface file 2");
|
||||
|
||||
argList::addOption
|
||||
(
|
||||
@ -1560,12 +1564,6 @@ int main(int argc, char *argv[])
|
||||
" 'mixed' (keep all)"
|
||||
);
|
||||
|
||||
argList::addNote
|
||||
(
|
||||
"Valid actions: \"intersection\", \"union\", \"difference\""
|
||||
);
|
||||
|
||||
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
|
||||
|
||||
@ -323,7 +323,8 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
argList::addArgument("surfaceFile");
|
||||
argList::addArgument("input", "The input surface file");
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
"checkSelfIntersection",
|
||||
|
||||
@ -59,10 +59,11 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
argList::addArgument("surfaceFile");
|
||||
argList::addArgument("min length");
|
||||
argList::addArgument("min quality");
|
||||
argList::addArgument("output surfaceFile");
|
||||
argList::addArgument("input", "The input surface file");
|
||||
argList::addArgument("length", "The min length");
|
||||
argList::addArgument("quality", "The min quality");
|
||||
argList::addArgument("output", "The output surface file");
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
"noClean",
|
||||
|
||||
@ -77,9 +77,9 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
argList::addArgument("surfaceFile");
|
||||
argList::addArgument("reductionFactor");
|
||||
argList::addArgument("output surfaceFile");
|
||||
argList::addArgument("input", "The input surface file");
|
||||
argList::addArgument("factor", "The reduction factor [0,1)");
|
||||
argList::addArgument("output", "The output surface file");
|
||||
argList::addOption
|
||||
(
|
||||
"scale",
|
||||
|
||||
@ -68,8 +68,8 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
argList::addArgument("inputFile");
|
||||
argList::addArgument("outputFile");
|
||||
argList::addArgument("input", "The input surface file");
|
||||
argList::addArgument("output", "The output surface file");
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
|
||||
@ -49,8 +49,8 @@ int main(int argc, char *argv[])
|
||||
"Convert between edgeMesh formats"
|
||||
);
|
||||
argList::noParallel();
|
||||
argList::addArgument("inputFile");
|
||||
argList::addArgument("outputFile");
|
||||
argList::addArgument("input", "The input edge file");
|
||||
argList::addArgument("output", "The output edge file");
|
||||
argList::addOption
|
||||
(
|
||||
"scale",
|
||||
|
||||
@ -52,7 +52,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
argList::addArgument("surfaceFile");
|
||||
argList::addArgument("input", "The input surface file");
|
||||
argList::addOption("x", "X", "The point x-coordinate (if non-zero)");
|
||||
argList::addOption("y", "Y", "The point y-coordinate (if non-zero)");
|
||||
argList::addOption("z", "Z", "The point y-coordinate (if non-zero)");
|
||||
|
||||
@ -273,7 +273,7 @@ int main(int argc, char *argv[])
|
||||
" boundary edges to match other surface boundary edges"
|
||||
);
|
||||
argList::noParallel();
|
||||
argList::addArgument("hookTolerance");
|
||||
argList::addArgument("hookTolerance", "The point merge tolerance");
|
||||
|
||||
#include "addDictOption.H"
|
||||
|
||||
|
||||
@ -60,7 +60,8 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
argList::addArgument("surfaceFile");
|
||||
argList::addArgument("input", "The input surface file");
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
"shellProperties",
|
||||
|
||||
@ -597,9 +597,9 @@ int main(int argc, char *argv[])
|
||||
"Switch on additional debug information"
|
||||
);
|
||||
|
||||
argList::addArgument("inputFile");
|
||||
argList::addArgument("distance");
|
||||
argList::addArgument("safety factor [1..]");
|
||||
argList::addArgument("input", "The input surface file");
|
||||
argList::addArgument("distance", "The inflate distance");
|
||||
argList::addArgument("factor", "The extend safety factor [1,10]");
|
||||
|
||||
argList::noFunctionObjects(); // Never use function objects
|
||||
|
||||
|
||||
@ -140,11 +140,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
argList::noParallel();
|
||||
argList::validOptions.clear();
|
||||
argList::addArgument("surfaceFile");
|
||||
argList::addArgument("lambda (0..1)");
|
||||
argList::addArgument("mu (0..1)");
|
||||
argList::addArgument("iterations");
|
||||
argList::addArgument("output surfaceFile");
|
||||
argList::addArgument("input", "The input surface file");
|
||||
argList::addArgument("lambda", "On the interval [0,1]");
|
||||
argList::addArgument("mu", "On the interval [0,1]");
|
||||
argList::addArgument("iterations", "The number of iterations to perform");
|
||||
argList::addArgument("output", "The output surface file");
|
||||
|
||||
argList::addOption
|
||||
(
|
||||
"featureFile",
|
||||
|
||||
@ -80,8 +80,8 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
argList::addArgument("inputFile");
|
||||
argList::addArgument("outputFile");
|
||||
argList::addArgument("input", "The input surface file");
|
||||
argList::addArgument("output", "The output surface file");
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
|
||||
@ -81,7 +81,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
argList::addArgument("outputFile");
|
||||
argList::addArgument("output", "The output surface file");
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
|
||||
@ -81,7 +81,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
argList::addArgument("inputFile");
|
||||
argList::addArgument("surface", "The input surface file");
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
|
||||
@ -81,7 +81,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
argList::noBanner();
|
||||
argList::noParallel();
|
||||
argList::addArgument("surfaceFile");
|
||||
argList::addArgument("surface", "The input surface file");
|
||||
|
||||
argList::addOption
|
||||
(
|
||||
|
||||
@ -66,7 +66,8 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
timeSelector::addOptions();
|
||||
|
||||
argList::addArgument("output file");
|
||||
argList::addArgument("output", "The output surface file");
|
||||
|
||||
#include "addRegionOption.H"
|
||||
argList::addBoolOption
|
||||
(
|
||||
|
||||
@ -50,9 +50,10 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
argList::addArgument("surfaceFile");
|
||||
argList::addArgument("visiblePoint");
|
||||
argList::addArgument("output surfaceFile");
|
||||
argList::addArgument("input", "The input surface file");
|
||||
argList::addArgument("point", "The visible 'outside' point");
|
||||
argList::addArgument("output", "The output surface file");
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
"inside",
|
||||
|
||||
@ -51,9 +51,9 @@ int main(int argc, char *argv[])
|
||||
"Merge points on surface if they are within absolute distance [m]."
|
||||
);
|
||||
argList::noParallel();
|
||||
argList::addArgument("surfaceFile");
|
||||
argList::addArgument("merge distance");
|
||||
argList::addArgument("output surfaceFile");
|
||||
argList::addArgument("input", "The input surface file");
|
||||
argList::addArgument("distance", "The merge distance");
|
||||
argList::addArgument("output", "The output surface file");
|
||||
|
||||
argList::addOption
|
||||
(
|
||||
|
||||
@ -59,8 +59,8 @@ int main(int argc, char *argv[])
|
||||
"Refine by splitting all three edges of triangle"
|
||||
);
|
||||
argList::noParallel();
|
||||
argList::addArgument("surfaceFile");
|
||||
argList::addArgument("output surfaceFile");
|
||||
argList::addArgument("input", "The input surface file");
|
||||
argList::addArgument("output", "The output surface file");
|
||||
argList args(argc, argv);
|
||||
|
||||
const fileName surfFileName = args[1];
|
||||
|
||||
@ -47,7 +47,7 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
argList::addArgument("input surfaceFile");
|
||||
argList::addArgument("input", "The input surface file");
|
||||
argList args(argc, argv);
|
||||
|
||||
const fileName surfName = args[1];
|
||||
|
||||
@ -53,8 +53,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
argList::noParallel();
|
||||
argList::validOptions.clear();
|
||||
argList::addArgument("input surface file");
|
||||
argList::addArgument("output surface file");
|
||||
argList::addArgument("input", "The input surface file");
|
||||
argList::addArgument("output", "The output surface file");
|
||||
argList args(argc, argv);
|
||||
|
||||
fileName surfFileName(args[1]);
|
||||
|
||||
@ -681,8 +681,8 @@ int main(int argc, char *argv[])
|
||||
"Split multiply connected surface edges by duplicating points"
|
||||
);
|
||||
argList::noParallel();
|
||||
argList::addArgument("surfaceFile");
|
||||
argList::addArgument("output surfaceFile");
|
||||
argList::addArgument("input", "The input surface file");
|
||||
argList::addArgument("output", "The output surface file");
|
||||
argList::addBoolOption
|
||||
(
|
||||
"debug",
|
||||
|
||||
@ -58,9 +58,9 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
argList::noParallel();
|
||||
argList::addArgument("surfaceSubsetDict");
|
||||
argList::addArgument("surfaceFile");
|
||||
argList::addArgument("output surfaceFile");
|
||||
argList::addArgument("dict", "The surfaceSubsetDict");
|
||||
argList::addArgument("input", "The input surface file");
|
||||
argList::addArgument("output", "The output surface file");
|
||||
argList args(argc, argv);
|
||||
|
||||
Info<< "Reading dictionary " << args[1] << " ..." << endl;
|
||||
|
||||
@ -66,8 +66,8 @@ int main(int argc, char *argv[])
|
||||
"Note: roll=rotate about x, pitch=rotate about y, yaw=rotate about z"
|
||||
);
|
||||
argList::noParallel();
|
||||
argList::addArgument("surfaceFile");
|
||||
argList::addArgument("output surfaceFile");
|
||||
argList::addArgument("input", "The input surface file");
|
||||
argList::addArgument("output", "The output surface file");
|
||||
argList::addOption
|
||||
(
|
||||
"translate",
|
||||
|
||||
@ -55,6 +55,8 @@ Foam::SLList<Foam::string> Foam::argList::validArgs;
|
||||
Foam::HashSet<Foam::string> Foam::argList::advancedOptions;
|
||||
Foam::HashTable<Foam::string> Foam::argList::validOptions;
|
||||
Foam::HashTable<Foam::string> Foam::argList::validParOptions;
|
||||
Foam::HashTable<Foam::string, Foam::label, Foam::Hash<Foam::label>>
|
||||
Foam::argList::argUsage;
|
||||
Foam::HashTable<Foam::string> Foam::argList::optionUsage;
|
||||
Foam::HashTable<std::pair<Foam::word,int>> Foam::argList::validOptionsCompat;
|
||||
Foam::HashTable<std::pair<bool,int>> Foam::argList::ignoreOptionsCompat;
|
||||
@ -68,32 +70,44 @@ Foam::argList::initValidTables::initValidTables()
|
||||
{
|
||||
argList::addOption
|
||||
(
|
||||
"case", "dir",
|
||||
"case",
|
||||
"dir",
|
||||
"Specify case directory to use (instead of the cwd)"
|
||||
);
|
||||
argList::addBoolOption("parallel", "Run in parallel");
|
||||
validParOptions.set("parallel", "");
|
||||
argList::addOption
|
||||
(
|
||||
"roots", "(dir1 .. dirN)",
|
||||
"roots",
|
||||
"(dir1 .. dirN)",
|
||||
"Slave root directories for distributed running",
|
||||
true // advanced option
|
||||
);
|
||||
validParOptions.set("roots", "(dir1 .. dirN)");
|
||||
validParOptions.set
|
||||
(
|
||||
"roots",
|
||||
"(dir1 .. dirN)"
|
||||
);
|
||||
|
||||
argList::addOption
|
||||
(
|
||||
"decomposeParDict", "file",
|
||||
"decomposeParDict",
|
||||
"file",
|
||||
"Use specified file for decomposePar dictionary"
|
||||
);
|
||||
argList::addOption
|
||||
(
|
||||
"hostRoots", "(((host1 dir1) .. (hostN dirN))",
|
||||
"hostRoots",
|
||||
"(((host1 dir1) .. (hostN dirN))",
|
||||
"slave root directories (per host) for distributed running. "
|
||||
"The host specification can use a regex.",
|
||||
true // advanced option
|
||||
);
|
||||
validParOptions.set("hostRoots", "((host1 dir1) .. (hostN dirN))");
|
||||
validParOptions.set
|
||||
(
|
||||
"hostRoots",
|
||||
"((host1 dir1) .. (hostN dirN))"
|
||||
);
|
||||
|
||||
argList::addBoolOption
|
||||
(
|
||||
@ -103,7 +117,8 @@ Foam::argList::initValidTables::initValidTables()
|
||||
|
||||
argList::addOption
|
||||
(
|
||||
"fileHandler", "handler",
|
||||
"fileHandler",
|
||||
"handler",
|
||||
"Override the file handler type",
|
||||
true // advanced option
|
||||
);
|
||||
@ -229,9 +244,26 @@ void Foam::argList::checkITstream(const ITstream& is, const word& optName)
|
||||
}
|
||||
|
||||
|
||||
void Foam::argList::addArgument(const string& argName)
|
||||
void Foam::argList::addArgument
|
||||
(
|
||||
const string& argName,
|
||||
const string& usage
|
||||
)
|
||||
{
|
||||
validArgs.append(argName);
|
||||
|
||||
// The first program argument starts at 1 - obtain index after the append
|
||||
|
||||
const label index = validArgs.size();
|
||||
|
||||
if (usage.empty())
|
||||
{
|
||||
argUsage.erase(index);
|
||||
}
|
||||
else
|
||||
{
|
||||
argUsage.set(index, usage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -212,16 +212,19 @@ public:
|
||||
// Stored as (option = bool, version)
|
||||
static HashTable<std::pair<bool,int>> ignoreOptionsCompat;
|
||||
|
||||
//- Short usage information for validOptions
|
||||
//- Short description for program arguments
|
||||
static HashTable<string, label, Hash<label>> argUsage;
|
||||
|
||||
//- Short description for validOptions
|
||||
static HashTable<string> optionUsage;
|
||||
|
||||
//- Additional notes for usage
|
||||
//- General usage notes
|
||||
static SLList<string> notes;
|
||||
|
||||
//- Min offset for displaying usage (default: 20)
|
||||
//- Min indentation when displaying usage (default: 20)
|
||||
static std::string::size_type usageMin;
|
||||
|
||||
//- Max screen width for displaying usage (default: 80)
|
||||
//- Max screen width when displaying usage (default: 80)
|
||||
static std::string::size_type usageMax;
|
||||
|
||||
//- Standard name for the post-processing option
|
||||
@ -341,11 +344,16 @@ public:
|
||||
//- Return an input stream from the named option
|
||||
inline ITstream lookup(const word& optName) const;
|
||||
|
||||
//- Read a value from the named option
|
||||
//- Get a value from the named option
|
||||
// The default template parameter is string (ie, no conversion).
|
||||
template<class T=string>
|
||||
inline T opt(const word& optName) const;
|
||||
|
||||
//- Get a value from the named option if present, or return default.
|
||||
// Identical to lookupOrDefault().
|
||||
template<class T>
|
||||
inline T opt(const word& optName, const T& deflt) const;
|
||||
|
||||
//- Read a value from the named option if present.
|
||||
// \return true if the named option was found.
|
||||
template<class T>
|
||||
@ -362,8 +370,7 @@ public:
|
||||
const T& deflt
|
||||
) const;
|
||||
|
||||
//- Read a value from the named option if present.
|
||||
// Return supplied default otherwise.
|
||||
//- Get a value from the named option if present, or return default.
|
||||
template<class T>
|
||||
inline T lookupOrDefault
|
||||
(
|
||||
@ -389,7 +396,11 @@ public:
|
||||
// Edit
|
||||
|
||||
//- Append a (mandatory) argument to validArgs
|
||||
static void addArgument(const string& argName);
|
||||
static void addArgument
|
||||
(
|
||||
const string& argName,
|
||||
const string& usage = ""
|
||||
);
|
||||
|
||||
//- Add a bool option to validOptions with usage information
|
||||
static void addBoolOption
|
||||
|
||||
@ -240,6 +240,35 @@ void Foam::argList::printMan() const
|
||||
}
|
||||
|
||||
|
||||
// Arguments output
|
||||
if (validArgs.size())
|
||||
{
|
||||
// .SH "ARGUMENTS"
|
||||
Info<< ".SH \"ARGUMENTS\"" << nl;
|
||||
|
||||
label argIndex = 0;
|
||||
for (const std::string& argName : validArgs)
|
||||
{
|
||||
++argIndex;
|
||||
|
||||
Info<< ".TP\n\\fI" << argName.c_str() << "\\fR";
|
||||
Info<< nl;
|
||||
|
||||
// Arg has usage information?
|
||||
|
||||
const auto usageIter = argList::argUsage.cfind(argIndex);
|
||||
if (usageIter.found())
|
||||
{
|
||||
stringOps::writeWrapped(Info, *usageIter, usageMax, 0, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< nl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// .SH "OPTIONS"
|
||||
Info<< ".SH \"OPTIONS\"" << nl;
|
||||
|
||||
@ -320,6 +349,34 @@ void Foam::argList::printUsage(bool full) const
|
||||
}
|
||||
Info<< nl;
|
||||
|
||||
// Arguments output
|
||||
// Currently only if there is also usage information, but may wish to
|
||||
// change this to remind developers to add some description.
|
||||
if (validArgs.size() && argUsage.size())
|
||||
{
|
||||
Info<< "Arguments:\n";
|
||||
|
||||
label argIndex = 0;
|
||||
for (const std::string& argName : validArgs)
|
||||
{
|
||||
++argIndex;
|
||||
|
||||
Info<< " <" << argName.c_str() << '>';
|
||||
|
||||
const auto usageIter = argList::argUsage.cfind(argIndex);
|
||||
if (usageIter.found())
|
||||
{
|
||||
const label len = argName.size() + 4;
|
||||
|
||||
printOptionUsage(len, usageIter());
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< nl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Options:\n";
|
||||
|
||||
for (const word& optName : validOptions.sortedToc())
|
||||
|
||||
@ -256,6 +256,18 @@ inline T Foam::argList::opt(const word& optName) const
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline T Foam::argList::opt(const word& optName, const T& deflt) const
|
||||
{
|
||||
if (found(optName))
|
||||
{
|
||||
return opt<T>(optName);
|
||||
}
|
||||
|
||||
return deflt;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline bool Foam::argList::readIfPresent
|
||||
(
|
||||
|
||||
Reference in New Issue
Block a user