ENH: argList improvements

- argList::envExecutable() static method.
  This is identical to getEnv("FOAM_EXECUTABLE"), where the name of
  the executable has typically been set from the argList construction.

  Provides a singleton access to this value from locations that
  do not have knowledge of the originating command args (argList).
  This is a similar rationale as for the argList::envGlobalPath() static.

- additional argList::envRelativePath() static method.

- make -dry-run handling more central and easier to use by adding into
  argList itself.

STYLE: drop handling of -srcDoc (v1706 option)

- replaced with -doc-source for 1712 and never used much anyhow
This commit is contained in:
Mark Olesen
2021-11-01 11:31:56 +01:00
parent a19f03a5cb
commit b364a9e72c
23 changed files with 226 additions and 123 deletions

View File

@ -756,9 +756,8 @@ int main(int argc, char *argv[])
"checkGeometry",
"Check all surface geometry for quality"
);
argList::addBoolOption
argList::addDryRunOption
(
"dry-run",
"Check case set-up only using a single time step"
);
argList::addOption
@ -789,7 +788,7 @@ int main(int argc, char *argv[])
const bool overwrite = args.found("overwrite");
const bool checkGeometry = args.found("checkGeometry");
const bool surfaceSimplify = args.found("surfaceSimplify");
const bool dryRun = args.found("dry-run");
const bool dryRun = args.dryRun();
if (dryRun)
{

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2020 OpenCFD Ltd.
Copyright (C) 2018-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -228,9 +228,8 @@ int main(int argc, char *argv[])
"In serial mode use times from processor0/ directory, but operate on "
"processor\\d+ directories"
);
argList::addBoolOption
argList::addDryRunOption
(
"dry-run",
"Report action without moving/renaming"
);
argList::addBoolOption
@ -247,7 +246,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
dryrun = args.found("dry-run");
dryrun = args.dryRun();
verbose = args.found("verbose");

View File

@ -325,9 +325,8 @@ int main(int argc, char *argv[])
#include "addAllRegionOptions.H"
argList::addBoolOption
argList::addDryRunOption
(
"dry-run",
"Test without writing the decomposition. "
"Changes -cellDist to only write VTK output."
);
@ -410,7 +409,7 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
const bool dryrun = args.found("dry-run");
const bool dryrun = args.dryRun();
const bool writeCellDist = args.found("cellDist");
const bool verbose = args.found("verbose");

View File

@ -2488,9 +2488,8 @@ int main(int argc, char *argv[])
#include "addOverwriteOption.H"
argList::addBoolOption("decompose", "Decompose case");
argList::addBoolOption("reconstruct", "Reconstruct case");
argList::addBoolOption
argList::addDryRunOption
(
"dry-run",
"Test without writing the decomposition. "
"Changes -cellDist to only write volScalarField."
);
@ -2555,7 +2554,7 @@ int main(int argc, char *argv[])
const bool reconstruct = args.found("reconstruct");
const bool writeCellDist = args.found("cellDist");
const bool dryrun = args.found("dry-run");
const bool dryrun = args.dryRun();
const bool newTimes = args.found("newTimes");
bool decompose = args.found("decompose");

View File

@ -119,9 +119,8 @@ int main(int argc, char *argv[])
"len",
"Visualization length for planes (visualized as triangles)"
);
argList::addBoolOption
argList::addDryRunOption
(
"dry-run",
"Test movement without a mesh"
);
argList::addBoolOption
@ -142,7 +141,7 @@ int main(int argc, char *argv[])
const label span = Foam::max(1, args.getOrDefault<label>("span", 1));
// Control parameters
const bool dryrun = args.found("dry-run");
const bool dryrun = args.dryRun();
const bool slave = args.found("slave");
const bool removeLock = args.found("removeLock");

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016-2020 OpenCFD Ltd.
Copyright (C) 2016-2021 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -55,9 +55,8 @@ int main(int argc, char *argv[])
argList::noFunctionObjects(); // Never use function objects
argList::addBoolOption
argList::addDryRunOption
(
"dry-run",
"Test initial lumped points state without a mesh"
);
argList::addOption
@ -85,15 +84,13 @@ int main(int argc, char *argv[])
const bool noInterpolate = args.found("no-interpolate");
const bool dryrun = args.found("dry-run");
// const bool verbose = args.found("verbose");
args.readIfPresent("visual-length", lumpedPointState::visLength);
#include "createTime.H"
if (dryrun)
if (args.dryRun())
{
// Create without a mesh
autoPtr<lumpedPointIOMovement> movement =

View File

@ -74,9 +74,8 @@ int main(int argc, char* argv[])
"Force use of legacy obstacles table"
);
argList::addBoolOption
argList::addDryRunOption
(
"dry-run",
"Read obstacles and write VTK only"
);
@ -90,8 +89,6 @@ int main(int argc, char* argv[])
IOdictionary setFieldsDict(dictIO);
const bool dryrun = args.found("dry-run");
const fileName& casepath = runTime.globalPath();
pars.timeName = "0";
@ -181,7 +178,7 @@ int main(int argc, char* argv[])
PDRobstacle::generateVtk(casepath/"VTK", obstacles, cylinders);
if (dryrun)
if (args.dryRun())
{
Info<< nl
<< "dry-run: stopping after reading/writing obstacles" << nl

View File

@ -404,9 +404,8 @@ int main(int argc, char *argv[])
timeSelector::addOptions();
argList::addOptionCompat("dry-run", {"test", 1806});
argList::addBoolOption
argList::addDryRunOption
(
"dry-run",
"Test only do not change any files"
);
argList::addBoolOption

View File

@ -91,16 +91,15 @@ int main(int argc, char *argv[])
"Preserve sub-entry as .backup",
true // Advanced
);
argList::addBoolOption
argList::addDryRunOption
(
"dry-run",
"Evaluate but do not write"
);
#include "addRegionOption.H"
#include "setRootCase.H"
const bool dryrun = args.found("dry-run");
const bool dryrun = args.dryRun();
const bool backup = args.found("backup");
const bool cacheFields = args.found("cache-fields");

View File

@ -549,9 +549,8 @@ int main(int argc, char *argv[])
"file",
"Alternative dictionary for setExprFieldsDict"
);
argList::addBoolOption
argList::addDryRunOption
(
"dry-run",
"Evaluate but do not write"
);
argList::addBoolOption
@ -663,7 +662,7 @@ int main(int argc, char *argv[])
#include "createTime.H"
const bool dryrun = args.found("dry-run");
const bool dryrun = args.dryRun();
const bool verbose = args.found("verbose");
const word dictName("setExprFieldsDict");