CONFIG: improve evaluation of arguments for foamEtcFile

- forward command-line arguments for paraview, where they may also be
  evaluated (cshrc, POSIX shell)
  Eg,
      . etc/bashrc ParaView_VERSION=5.4.1-mpipy
      source etc/cshrc ParaView_VERSION=5.4.1-mpipy
This commit is contained in:
Mark Olesen
2018-01-24 12:15:09 +01:00
parent 9bd7ea593e
commit de4a1eeedb
3 changed files with 34 additions and 10 deletions

View File

@ -46,7 +46,7 @@
printHelp() {
cat<<USAGE
Usage: foamEtcFile [OPTION] fileName
Usage: foamEtcFile [OPTION] fileName [-- args]
foamEtcFile [OPTION] [-list|-list-test] [fileName]
options:
@ -270,6 +270,31 @@ done
#-------------------------------------------------------------------------------
# Split arguments into filename (for searching) and trailing bits for shell eval
# Silently remove leading ~OpenFOAM/ (as per Foam::findEtcFile)
nArgs=$#
fileName="${1#~OpenFOAM/}"
unset evalArgs
if [ "$nArgs" -eq 1 ]
then
if [ "$1" = "--" ]
then
nArgs=0
unset fileName
fi
elif [ "$nArgs" -ge 2 ]
then
if [ "$2" = "--" ]
then
nArgs=1
shift 2
evalArgs="$@"
fi
fi
# Get version information
if [ -n "$optVersion" ]
then
setVersion $optVersion
@ -292,12 +317,6 @@ groupDir="${WM_PROJECT_SITE:-$prefixDir/site}"
# eval echo "$i=\$$i" 1>&2
# done
# Save the essential bits of information
# silently remove leading ~OpenFOAM/ (used in Foam::findEtcFile)
nArgs=$#
fileName="${1#~OpenFOAM/}"
# Define the various places to be searched:
unset dirList
case "$optMode" in (*u*) # (U)ser
@ -435,7 +454,12 @@ else
echo "$verboseOutput$resolved" 1>&2
fi
echo "$shellOutput$resolved"
if [ -n "$shellOutput" ]
then
echo "$shellOutput$resolved $evalArgs"
else
echo "$resolved"
fi
[ -n "$optAll" ] || break
fi
done

View File

@ -153,7 +153,7 @@ _foamEtc -config settings
# Setup for third-party packages
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamEtc -config mpi
_foamEtc -config paraview
_foamEtc -config paraview -- $@ # Pass through for evaluation
_foamEtc -config vtk
_foamEtc -config ensight
_foamEtc -config gperftools

View File

@ -196,7 +196,7 @@ _foamEtc -config settings
# Setup for third-party packages
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamEtc -config mpi
_foamEtc -config paraview
_foamEtc -config paraview -- "$FOAM_SETTINGS" # Pass through for evaluation
_foamEtc -config vtk
_foamEtc -config ensight
## _foamEtc -config ADIOS