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