ENH: print paraFoam -help and -help-full to stdout

- this makes it possible to use "foamAddCompletion paraFoam" and have
  bash completions for paraFoam as well
This commit is contained in:
Mark Olesen
2017-12-14 12:50:59 +01:00
parent a820e2d2b7
commit 5c607bb801

View File

@ -4,37 +4,24 @@
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration | # \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. # \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM. # This file is part of OpenFOAM, licensed under GNU General Public License
# # <http://www.gnu.org/licenses/>.
# OpenFOAM is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public License
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
# #
# Script # Script
# paraFoam # paraFoam
# #
# Description # Description
# Start paraview with the OpenFOAM libraries and reader modules. # Start paraview with OpenFOAM libraries and reader modules.
# #
# Note # Note
# Combining -block or -builtin options with -region option yields # Combining -block, -vtk, -builtin options with -region option yields
# undefined behaviour # undefined behaviour
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
usage() { printHelp() {
exec 1>&2 # Print usage to stdout so that it can be captured for bash completion
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
cat<<USAGE cat<<USAGE
Usage: ${0##*/} [OPTION] [--] [PARAVIEW_OPTION] Usage: ${0##*/} [OPTION] [--] [PARAVIEW_OPTION]
@ -47,7 +34,7 @@ options:
create .blockMesh, .foam, .OpenFOAM files (for all regions) create .blockMesh, .foam, .OpenFOAM files (for all regions)
-touch-proc same as '-touch' but for each processor -touch-proc same as '-touch' but for each processor
-vtk | -builtin use VTK builtin OpenFOAM reader (uses .foam extension) -vtk | -builtin use VTK builtin OpenFOAM reader (uses .foam extension)
-help print the usage -help |-help-full print the usage
--help paraview help --help paraview help
Start paraview with the OpenFOAM libraries and reader modules. Start paraview with the OpenFOAM libraries and reader modules.
@ -56,7 +43,7 @@ Note that paraview options begin with double dashes.
paraview=$(command -v paraview) paraview=$(command -v paraview)
USAGE USAGE
exit 1 exit 0 # A clean exit
} }
# Report error and exit # Report error and exit
@ -91,8 +78,8 @@ unset regionName optTouch
while [ "$#" -gt 0 ] while [ "$#" -gt 0 ]
do do
case "$1" in case "$1" in
-h | -help*) -h | -help-*)
usage printHelp
;; ;;
-block*) -block*)
extension=blockMesh extension=blockMesh