Skip to content
Snippets Groups Projects
Commit de4a1eee authored by Mark OLESEN's avatar Mark OLESEN
Browse files

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
parent 9bd7ea59
No related branches found
No related tags found
No related merge requests found
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
printHelp() { printHelp() {
cat<<USAGE cat<<USAGE
Usage: foamEtcFile [OPTION] fileName Usage: foamEtcFile [OPTION] fileName [-- args]
foamEtcFile [OPTION] [-list|-list-test] [fileName] foamEtcFile [OPTION] [-list|-list-test] [fileName]
options: options:
...@@ -270,6 +270,31 @@ done ...@@ -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" ] if [ -n "$optVersion" ]
then then
setVersion $optVersion setVersion $optVersion
...@@ -292,12 +317,6 @@ groupDir="${WM_PROJECT_SITE:-$prefixDir/site}" ...@@ -292,12 +317,6 @@ groupDir="${WM_PROJECT_SITE:-$prefixDir/site}"
# eval echo "$i=\$$i" 1>&2 # eval echo "$i=\$$i" 1>&2
# done # 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: # Define the various places to be searched:
unset dirList unset dirList
case "$optMode" in (*u*) # (U)ser case "$optMode" in (*u*) # (U)ser
...@@ -435,7 +454,12 @@ else ...@@ -435,7 +454,12 @@ else
echo "$verboseOutput$resolved" 1>&2 echo "$verboseOutput$resolved" 1>&2
fi fi
echo "$shellOutput$resolved" if [ -n "$shellOutput" ]
then
echo "$shellOutput$resolved $evalArgs"
else
echo "$resolved"
fi
[ -n "$optAll" ] || break [ -n "$optAll" ] || break
fi fi
done done
......
...@@ -153,7 +153,7 @@ _foamEtc -config settings ...@@ -153,7 +153,7 @@ _foamEtc -config settings
# Setup for third-party packages # Setup for third-party packages
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamEtc -config mpi _foamEtc -config mpi
_foamEtc -config paraview _foamEtc -config paraview -- $@ # Pass through for evaluation
_foamEtc -config vtk _foamEtc -config vtk
_foamEtc -config ensight _foamEtc -config ensight
_foamEtc -config gperftools _foamEtc -config gperftools
......
...@@ -196,7 +196,7 @@ _foamEtc -config settings ...@@ -196,7 +196,7 @@ _foamEtc -config settings
# Setup for third-party packages # Setup for third-party packages
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_foamEtc -config mpi _foamEtc -config mpi
_foamEtc -config paraview _foamEtc -config paraview -- "$FOAM_SETTINGS" # Pass through for evaluation
_foamEtc -config vtk _foamEtc -config vtk
_foamEtc -config ensight _foamEtc -config ensight
## _foamEtc -config ADIOS ## _foamEtc -config ADIOS
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment