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

CONFIG: update completion_cache (for csh users)

- now consider options '-hostRoots', '-roots' to be advanced options
  that don't need to be in the cache
parent bff16a0d
Branches
Tags
No related merge requests found
......@@ -27,11 +27,12 @@ usage() {
Usage: ${0##*/} [OPTION] [appName .. [appNameN]]
options:
-d dir | -dir dir Directory to process
-u | -user Add \$FOAM_USER_APPBIN to the search directories
-no-header Suppress header generation
-o FILE Write to alternative output
-h | -help Print the usage
-dir DIR Directory to process
-user Add \$FOAM_USER_APPBIN to the search directories
-no-header Suppress header generation
-output FILE, -o FILE
Write to alternative output
-h | -help Print the usage
Create cache of bash completion values for OpenFOAM applications.
The cached values are typically used by the tcsh completion wrapper.
......@@ -68,13 +69,13 @@ do
-h | -help*)
usage
;;
-d | -dir)
-dir)
[ "$#" -ge 2 ] || die "'$1' option requires an argument"
searchDirs="$2"
[ -d "$searchDirs" ] || die "directory not found '$searchDirs'"
shift
;;
-u | -user)
-user)
searchDirs="$searchDirs $FOAM_USER_APPBIN"
;;
-no-head*)
......@@ -116,8 +117,8 @@ echo 1>&2
# Header not disabled
[ "$optHeader" = true ] && cat << HEADER
#----------------------------------*-sh-*--------------------------------------
# Cached options for bash completion of OpenFOAM applications, primarily for
# use with the tcsh completion mechanism.
# Cached options for bash completion of OpenFOAM applications,
# primarily for use with the tcsh completion mechanism.
# These are the values expected by the '_of_complete_' function
#
# Recreate with "${0##*/}"
......@@ -140,7 +141,12 @@ HEADER
# -opt1 descrip
# -opt2 <arg> descrip
# -help-full
# Ignore -help-man (internal option).
#
# Ignores
# -help-man Internal option
# -hostRoots Advanced distributed run option
# -roots Advanced distributed run option
#
# Terminate parsing on first appearance of -help-full.
# - options with '=' (eg, -mode=ugo) are not handled very well at all.
# - alternatives (eg, -a, -all) are not handled nicely either,
......@@ -150,6 +156,7 @@ extractOptions()
local appName="$1"
local helpText=$($appName -help-full 2>/dev/null | \
sed -ne 's/^ *//; /^$/d; /^[^-]/d; /^--/d; /^-help-man/d;' \
-e '/^-hostRoots /d; /^-roots /d;' \
-e 'y/,/ /; s/=.*$/=/;' \
-e '/^-[^ ]* </{ s/^\(-[^ ]* <\).*$/\1/; p; d }' \
-e 's/^\(-[^ ]*\).*$/\1/; p; /^-help-full/q;' \
......
This diff is collapsed.
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