openfoam/etc/config.csh/tcsh_completion
Mark Olesen 92d1d1f037 CONFIG: verify bash version for completion support
- the (global) associative array requires bash >= 4.2
2017-08-10 10:05:22 +02:00

48 lines
1.7 KiB
Bash

#----------------------------------*-sh-*--------------------------------------
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2017 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# This file is part of OpenFOAM, licensed under the GNU General Public License
# <http://www.gnu.org/licenses/>.
#
# File
# etc/config.csh/tcsh_completion
#
# Description
# Tcsh completions for OpenFOAM applications
# Using bash completion for the hard work
#
# Requires
# bash 4.2 or newer
#
#------------------------------------------------------------------------------
if ($?tcsh) then # tcsh only
# Remove old completions, which look like:
# complete APPNAME 'p,*,`bash $WM_PROJECT_DIR/etc/ ...
foreach appName (`complete | sed -ne '/WM_PROJECT/s/\t.*$//p'`)
uncomplete $appName
end
# Generate completions for predefined directories (if support is possible)
bash $WM_PROJECT_DIR/etc/config.csh/complete-wrapper -test
if ($status == 0) then
foreach dirName ("$FOAM_APPBIN")
if ( ! -d $dirName ) continue
foreach appName (`find $dirName -maxdepth 1 -executable -type f`)
# Pass explicitly
## complete $appName:t 'p,*,`bash $WM_PROJECT_DIR/etc/config.csh/complete-wrapper '$appName:t' "${COMMAND_LINE}"`,'
# Pass via environment
complete $appName:t 'p,*,`bash $WM_PROJECT_DIR/etc/config.csh/complete-wrapper '$appName:t'`,'
end
end
endif
endif
#------------------------------------------------------------------------------