Commit 19c3875a authored by Mark OLESEN's avatar Mark OLESEN
Browse files

CONFIG: update tcsh completion_cache to include finiteArea and cfmesh

- include bash completion for paraFoam, and provision for using
  foamEtcFile as well.
parent b51b6e20
......@@ -7,34 +7,28 @@
# \\/ M anipulation | Copyright (C) 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
# foamEtcFile
#
# Description
# Locate user/group/other files with semantics similar to the
# ~OpenFOAM/fileName expansion.
# Locate user/group/other file as per '#includeEtc'.
#
# The -mode option can be used to allow chaining from
# personal settings to site-wide settings.
# The -mode option can be used to allow chaining from personal settings
# to site-wide settings.
#
# For example, within the user ~/.OpenFOAM/<VER>/config.sh/compiler:
# \code
# eval $(foamEtcFile -sh -mode=go config.sh/compiler)
# \endcode
#
# For example, within the user ~/.OpenFOAM/<VER>/prefs.sh:
# The -mode option is similarly used within etc/{bashrc,cshrc} to ensure
# that system prefs are respected:
# \code
# eval $(foamEtcFile -sh -mode=go prefs.sh)
# eval $(foamEtcFile -sh -mode=o prefs.sh)
# eval $(foamEtcFile -sh -mode=ug prefs.sh)
# \endcode
#
# Environment
......@@ -49,37 +43,34 @@
# - $WM_PROJECT_INST_DIR/openfoam<VERSION>/bin (debian version)
#
#-------------------------------------------------------------------------------
unset optQuiet optSilent
usage() {
[ "${optQuiet:-$optSilent}" = true ] && exit 1
exec 1>&2
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
printHelp() {
cat<<USAGE
Usage: foamEtcFile [OPTION] fileName
foamEtcFile [OPTION] [-list|-list-test] [fileName]
options:
-a, -all Return all files (otherwise stop after the first match)
-l, -list List directories or files to be checked
-all (-a) Return all files (otherwise stop after the first match)
-list (-l) List directories or files to be checked
-list-test List (existing) directories or files to be checked
-mode=MODE Any combination of u(user), g(group), o(other)
-prefix=DIR Specify an alternative installation prefix
-version=VER Specify alternative OpenFOAM version (eg, 3.0, 1612, ...)
-csh | -sh Produce output suitable for a csh or sh 'eval'
-csh-verbose | -sh-verbose
As per -csh | -sh, with additional verbosity
-q, -quiet Suppress all normal output
-s, -silent Suppress stderr, except -csh-verbose, -sh-verbose output
-csh Produce output suitable for a csh or sh 'eval'
-csh-verbose As per -csh with additional verbosity
-sh Produce output suitable for a csh or sh 'eval'
-sh-verbose As per -sh with additional verbosity
-quiet (-q) Suppress all normal output
-silent (-s) Suppress stderr, except -csh-verbose, -sh-verbose output
-help Print the usage
Locate user/group/other file with semantics similar to the
~OpenFOAM/fileName expansion.
Locate user/group/other file as per '#includeEtc'
Single character options must not be grouped. Equivalent options:
-mode=MODE, -mode MODE, -m MODE
-prefix=DIR, -prefix DIR, -p DIR
-version=VER, -version VER, -v VER
Do not group single character options.
Equivalent options:
| -mode=MODE | -mode MODE | -m MODE
| -prefix=DIR | -prefix DIR | -p DIR
| -version=VER | -version VER | -v VER
Exit status
0 when the file is found. Print resolved path to stdout.
......@@ -87,9 +78,11 @@ Exit status
2 when the file is not found.
USAGE
exit 1
exit 0 # A clean exit
}
unset optQuiet optSilent
# Report error and exit
die()
{
......@@ -197,7 +190,7 @@ while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help*)
usage
printHelp
;;
-a | -all)
optAll=true
......
......@@ -78,7 +78,7 @@ unset regionName optTouch
while [ "$#" -gt 0 ]
do
case "$1" in
-h | -help-*)
-h | -help*)
printHelp
;;
-block*)
......
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# 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/>.
#
# Script
# rmcore
#
# Description
# remove all core files
#------------------------------------------------------------------------------
case "$1" in
-h | -help*)
exec 1>&2
echo "Usage: ${0##*/} [dir1] .. [dirN]"
echo " remove all core files"
exit 1
;;
esac
# Default is pwd
[ "$#" -gt 0 ] || set -- .
for i
do
if [ -d "$i" ]
then
echo "removing all core files: $i" 1>&2
find $i \( -name core -o -name 'core.[1-9]*' -o -name 'vgcore.*' \) -type f -delete
else
echo "no directory: $i" 1>&2
fi
done
#------------------------------------------------------------------------------
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# 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/>.
#
# Script
# rm~all
#
# Description
# remove all *~ files
#------------------------------------------------------------------------------
case "$1" in
-h | -help*)
exec 1>&2
echo "Usage: ${0##*/} [dir1] .. [dirN]"
echo " remove all *~ files"
exit 1
;;
esac
# default is pwd
[ "$#" -gt 0 ] || set -- .
for i
do
if [ -d "$i" ]
then
echo "removing all *~ files: $i" 1>&2
find $i \( -name '*~' -o -name '.*~' \) -type f -delete -print
else
echo "no directory: $i" 1>&2
fi
done
#------------------------------------------------------------------------------
......@@ -7,20 +7,8 @@
# \\/ M anipulation |
#------------------------------------------------------------------------------
# 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
# foamCreateCompletionCache
......@@ -150,7 +138,8 @@ HEADER
extractOptions()
{
local appName="$1"
local helpText=$($appName -help 2>/dev/null | sed -ne '/^ *-/p')
local helpText=$($appName -help-full 2>/dev/null | \
sed -n -e 's/,/ /g' -e 's/=.*$/=/' -e '/^ *-/p')
[ -n "$helpText" ] || {
echo "Error calling $appName" 1>&2
......@@ -169,7 +158,8 @@ extractOptions()
}
#------------------------------------------------------------------------------
[ "$#" -gt 0 ] || set -- ${searchDirs}
# Default to standard search directories and a few scripts from bin/
[ "$#" -gt 0 ] || set -- ${searchDirs} paraFoam
for item
do
......
......@@ -41,8 +41,8 @@ then
fi
# Add completion for command or directory of commands
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Add completion for commands, directories of commands
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
unset -f foamAddCompletion 2>/dev/null
foamAddCompletion()
{
......@@ -134,7 +134,10 @@ _of_complete_()
# Not in cache, obtain by parsing application -help-full
if [ -z "$choices" ]
then
local helpText=$($appName -help-full 2>/dev/null | sed -ne '/^ *-/p')
# Treat ',' like space so '-a, -all' parses like '-a | -all'
# Options with '=' (Eg, -mode=ugo) are not handled very well.
local helpText=$($appName -help-full 2>/dev/null | \
sed -n -e 's/,/ /g' -e 's/=.*$/=/' -e '/^ *-/p')
if [ -n "$helpText" ]
then
......@@ -206,6 +209,8 @@ then
# Generate completions for predefined directories
foamAddCompletion $FOAM_APPBIN
# And a few scripts from bin/
foamAddCompletion paraFoam
fi
else
# Bash version is too old.
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment