From 5c607bb80160e29947a091c4958440cd5c7ec0bb Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Thu, 14 Dec 2017 12:50:59 +0100 Subject: [PATCH] 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 --- bin/paraFoam | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/bin/paraFoam b/bin/paraFoam index 6f1e2fe6043..913ffa5bcf1 100755 --- a/bin/paraFoam +++ b/bin/paraFoam @@ -4,37 +4,24 @@ # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox # \\ / O peration | # \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation -# \\/ M anipulation | Copyright (C) 2016 OpenCFD Ltd. +# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd. #------------------------------------------------------------------------------- # License -# This file is part of OpenFOAM. -# -# 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/>. +# This file is part of OpenFOAM, licensed under GNU General Public License +# <http://www.gnu.org/licenses/>. # # Script # paraFoam # # Description -# Start paraview with the OpenFOAM libraries and reader modules. +# Start paraview with OpenFOAM libraries and reader modules. # # Note -# Combining -block or -builtin options with -region option yields +# Combining -block, -vtk, -builtin options with -region option yields # undefined behaviour #------------------------------------------------------------------------------ -usage() { - exec 1>&2 - while [ "$#" -ge 1 ]; do echo "$1"; shift; done +printHelp() { + # Print usage to stdout so that it can be captured for bash completion cat<<USAGE Usage: ${0##*/} [OPTION] [--] [PARAVIEW_OPTION] @@ -47,7 +34,7 @@ options: create .blockMesh, .foam, .OpenFOAM files (for all regions) -touch-proc same as '-touch' but for each processor -vtk | -builtin use VTK builtin OpenFOAM reader (uses .foam extension) - -help print the usage + -help |-help-full print the usage --help paraview help 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) USAGE - exit 1 + exit 0 # A clean exit } # Report error and exit @@ -91,8 +78,8 @@ unset regionName optTouch while [ "$#" -gt 0 ] do case "$1" in - -h | -help*) - usage + -h | -help-*) + printHelp ;; -block*) extension=blockMesh -- GitLab