diff --git a/bin/tools/foamCreateBashCompletions b/bin/tools/foamCreateBashCompletions
deleted file mode 100755
index 5df15841d395de3f8eb44db6033ab92e1626cacc..0000000000000000000000000000000000000000
--- a/bin/tools/foamCreateBashCompletions
+++ /dev/null
@@ -1,274 +0,0 @@
-#!/bin/sh
-#------------------------------------------------------------------------------
-# =========                 |
-# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
-#  \\    /   O peration     |
-#   \\  /    A nd           | Copyright (C) 2017 OpenCFD Ltd.
-#    \\/     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
-#     foamCreateBashCompletions
-#
-# Description
-#     Create bash completions for OpenFOAM applications
-#
-#------------------------------------------------------------------------------
-usage() {
-    exec 1>&2
-    while [ "$#" -ge 1 ]; do echo "$1"; shift; done
-    cat<<USAGE
-
-Usage: ${0##*/} [OPTION] [appName .. [appNameN]]
-options:
-  -d dir | -dir dir       Directory to process
-  -u | -user              Add \$FOAM_USER_APPBIN to the search directories
-  -head | -header         Generate header
-  -h | -help              Print the usage
-
-Create bash completions for OpenFOAM applications and write to stdout.
-By default searches \$FOAM_APPBIN only.
-Alternatively, scan the output from individual applications for single completion
-commands (using the '_of_complete_' backend).
-
-USAGE
-    exit 1
-}
-
-
-#-------------------------------------------------------------------------------
-
-searchDirs="$FOAM_APPBIN"
-unset optHeader
-while [ "$#" -gt 0 ]
-do
-    case "$1" in
-        -h | -help)
-            usage
-            ;;
-        -d | -dir)
-            searchDirs="$2"
-            [ -d $searchDirs ] || usage "directory not found '$searchDirs'"
-            shift
-            ;;
-        -u | -user)
-            searchDirs="$searchDirs $FOAM_USER_APPBIN"
-            ;;
-        -head | -header)
-            optHeader=true
-            ;;
-        -*)
-            usage "unknown option: '$1'"
-            ;;
-        *)
-            break
-            ;;
-    esac
-    shift
-done
-
-# No applications given, then always generate a header
-if [ "$#" -eq 0 ]
-then
-    optHeader=true
-fi
-
-# Header requested or required
-[ "$optHeader" = true ] && cat << HEADER
-#----------------------------------*-sh-*--------------------------------------
-# Bash completions for OpenFOAM applications
-# Recreate with "${0##*/}"
-#
-# Formatted as "complete ... -F _of_APPNAME APPNAME
-
-#
-# Generic completion handler for OpenFOAM applications
-# - arg1 = command-name
-# - arg2 = current word
-# - arg3 = previous word
-# - arg4 = options with args
-# - arg5 = boolean options
-#
-unset -f _of_complete_ 2>/dev/null
-_of_complete_()
-{
-    # Unused: local cmd=\$1
-    local cur=\$2
-    local prev=\$3
-    local optsWithArgs="\$4 "   # Trailing space added for easier matching
-    local opts="\$5 "
-    local choices
-
-    case \${prev} in
-    -help|-doc|-srcDoc)
-        # These options are usage and we can stop here.
-        COMPREPLY=()
-        return 0
-        ;;
-    -case)
-        COMPREPLY=(\$(compgen -d -- \${cur}))
-        ;;
-    -time)
-        # Could use "foamListTimes -withZero", but still doesn't address ranges
-        COMPREPLY=(\$(compgen -d -X '![-0-9]*' -- \${cur}))
-        ;;
-    -region)
-        choices=\$(\ls -d system/*/ 2>/dev/null | sed -e 's#/\$##' -e 's#^.*/##')
-        COMPREPLY=(\$(compgen -W "\$choices" -- \${cur}))
-        ;;
-    -fileHandler)
-        choices="collated uncollated masterUncollated"
-        COMPREPLY=(\$(compgen -W "\$choices" -- \${cur}))
-        ;;
-    *Dict)
-        # local dirs=\$(\ls -d s*/)
-        # local files=\$(\ls -f | grep Dict)
-        # COMPREPLY=(\$(compgen -W \"\$dirs \$files\" -- \${cur}))
-        COMPREPLY=(\$(compgen -f -- \${cur}))
-        ;;
-    *)
-        if [ "\${optsWithArgs/\${prev} /}" != "\${optsWithArgs}" ]
-        then
-            # Option with unknown type of arg - set to files.
-            # Not always correct but can still navigate path if needed...
-            COMPREPLY=(\$(compgen -f -- \${cur}))
-        elif [ -n "\$cur" -a "\${cur#-}" = "\${cur}" ]
-        then
-            # Already started a (non-empty) word that isn't an option,
-            # use files in which case revert to filenames.
-            COMPREPLY=(\$(compgen -f -- \${cur}))
-        else
-            # Catchall
-            # - Present remaining options (not already seen in \$COMP_LINE)
-            choices=\$(
-                for o in \${opts} \${optsWithArgs}
-                do
-                    [ "\${COMP_LINE/\$o/}" = "\${COMP_LINE}" ] && echo \$o
-                done
-            )
-            COMPREPLY=(\$(compgen -W "\$choices" -- \${cur}))
-        fi
-        ;;
-    esac
-
-    return 0
-}
-
-#------------------------------------------------------------------------------
-
-HEADER
-
-#-------------------------------------------------------------------------------
-
-# Scans the output of the application -help to detect options with/without
-# arguments.  Dispatch via _of_complete_
-#
-generateCompletion()
-{
-    local fullName="$1"
-    local appName="${1##*/}"
-    local appHelp
-
-    [ -f "$fullName" -a -x "$fullName" ] || {
-        echo "skip $fullName" 1>&2
-        return 1
-    }
-    if [ "$appName" = "complete_" ]
-    then
-        echo "skip $appName ... reserved name?" 1>&2
-        return 1
-    fi
-
-    appHelp=$($fullName -help) || {
-        echo "error calling $fullName" 1>&2
-        return 1
-    }
-
-    # Options with args - as array
-    local optsWithArgs=($(awk '/^ {0,4}-[a-z]/ && /</ {print $1}' <<< "$appHelp"))
-
-    # Options without args - as array
-    local opts=($(awk '/^ {0,4}-[a-z]/ && !/</ {print $1}' <<< "$appHelp"))
-
-    # See bash(1) for some details. Completion functions are called with
-    # arg1 = command-name, arg2 = current word, arg3 = previous word
-    #
-    # Append known option types and dispatch to _of_complete_
-    echo "    $appName" 1>&2
-    cat << COMPLETION
-
-# [$appName]
-unset -f _of_${appName} 2>/dev/null
-_of_${appName}() {
-    _of_complete_ "\$@" \\
-    "${optsWithArgs[@]}" \\
-    "${opts[@]}"
-}
-complete -o filenames -F _of_${appName} $appName
-
-COMPLETION
-}
-#------------------------------------------------------------------------------
-
-
-if [ "$#" -eq 0 ]
-then
-
-    for dir in ${searchDirs}
-    do
-        if [ -d "$dir" ]
-        then
-            echo "Processing directory $dir" 1>&2
-        else
-            echo "No such directory: $dir" 1>&2
-            continue
-        fi
-
-        # Sort with ignore-case
-        set -- $(\ls $dir | sort -f)
-        for appName
-        do
-            generateCompletion "$dir/$appName"
-        done
-    done
-
-else
-
-    for appName
-    do
-        if [ -f "$appName" -a -x "$appName" ]
-        then
-            generateCompletion "$appName"
-        elif fullName=$(command -v $appName 2>/dev/null)
-        then
-            generateCompletion "$fullName"
-        else
-            echo "No application found: $appName" 1>&2
-        fi
-    done
-
-fi
-
-
-# Generate footer
-[ "$optHeader" = true ] && cat << FOOTER
-
-#------------------------------------------------------------------------------
-FOOTER
-
-#------------------------------------------------------------------------------
diff --git a/bin/tools/foamCreateCompletionCache b/bin/tools/foamCreateCompletionCache
new file mode 100755
index 0000000000000000000000000000000000000000..48f1e3449a4dee43b40aae0129890c013a2c2a03
--- /dev/null
+++ b/bin/tools/foamCreateCompletionCache
@@ -0,0 +1,199 @@
+#!/bin/bash
+#------------------------------------------------------------------------------
+# =========                 |
+# \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
+#  \\    /   O peration     |
+#   \\  /    A nd           | Copyright (C) 2017 OpenCFD Ltd.
+#    \\/     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
+#     foamCreateCompletionCache
+#
+# Description
+#     Create cache of bash completion values for OpenFOAM applications
+#     The cached values are typically used by the tcsh completion wrapper.
+#
+#------------------------------------------------------------------------------
+defaultOutputFile="$WM_PROJECT_DIR/etc/config.sh/completion_cache"
+
+usage() {
+    exec 1>&2
+    while [ "$#" -ge 1 ]; do echo "$1"; shift; done
+    cat<<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
+
+Create cache of bash completion values for OpenFOAM applications.
+The cached values are typically used by the tcsh completion wrapper.
+Default search: \$FOAM_APPBIN only.
+Default output: $defaultOutputFile
+
+Uses the search directory if applications are specified.
+
+USAGE
+    exit 1
+}
+
+# Report error and exit
+die()
+{
+    exec 1>&2
+    echo
+    echo "Error encountered:"
+    while [ "$#" -ge 1 ]; do echo "    $1"; shift; done
+    echo
+    echo "See '${0##*/} -help' for usage"
+    echo
+    exit 1
+}
+
+#-------------------------------------------------------------------------------
+
+searchDirs="$FOAM_APPBIN"
+optHeader=true
+unset outputFile
+while [ "$#" -gt 0 ]
+do
+    case "$1" in
+    -h | -help)
+        usage
+        ;;
+    -d | -dir)
+        [ "$#" -ge 2 ] || die "'$1' option requires an argument"
+        searchDirs="$2"
+        [ -d "$searchDirs" ] || die "directory not found '$searchDirs'"
+        shift
+        ;;
+    -u | -user)
+        searchDirs="$searchDirs $FOAM_USER_APPBIN"
+        ;;
+    -no-head*)
+        optHeader=false
+        ;;
+    -o | -output)
+        [ "$#" -ge 2 ] || die "'$1' option requires an argument"
+        outputFile="$2"
+        shift
+        ;;
+    -*)
+        usage "unknown option: '$1'"
+        ;;
+    *)
+        break
+        ;;
+    esac
+    shift
+done
+
+: ${outputFile:=$defaultOutputFile}
+
+# Verify that output is writeable
+if [ -e "$outputFile" ]
+then
+    [ -f "$outputFile" ] || \
+        die "Cannot overwrite $outputFile" "Not a file"
+    [ -w "$outputFile" ] || \
+        die "Cannot overwrite $outputFile" "No permission?"
+else
+    [ -w "$(dirname $outputFile)" ] || \
+        die "Cannot write $outputFile" "directory is not writeble"
+fi
+
+exec 1>| $outputFile || exit $?
+echo "Writing $outputFile" 1>&2
+echo 1>&2
+
+# Header not disabled
+[ "$optHeader" = true ] && cat << HEADER
+#----------------------------------*-sh-*--------------------------------------
+# Cached options for bash completion of OpenFOAM applications.
+# These are the values expected by the '_of_complete_' function
+#
+# Recreate with "${0##*/}"
+
+# Global associative array (cached options for OpenFOAM applications)
+declare -gA _of_complete_cache_;
+
+# Clear existing cache.
+_of_complete_cache_=()
+
+#------------------------------------------------------------------------------
+HEADER
+
+#-------------------------------------------------------------------------------
+
+# Scans the output of the application -help to detect options with/without
+# arguments.  Dispatch via _of_complete_
+#
+extractOptions()
+{
+    local appName="$1"
+    local helpText=$($appName -help 2>/dev/null | sed -ne '/^  *-/p')
+
+    [ -n "$helpText" ] || {
+        echo "Error calling $appName" 1>&2
+        return 1
+    }
+
+    # Array of options with args
+    local argOpts=($(awk '/^ {0,4}-[a-z]/ && /</ {print $1}' <<< "$helpText"))
+
+    # Array of options without args
+    local boolOpts=($(awk '/^ {0,4}-[a-z]/ && !/</ {print $1}' <<< "$helpText"))
+
+    appName="${appName##*/}"
+    echo "$appName" 1>&2
+    echo "_of_complete_cache_[${appName}]=\"${argOpts[@]} | ${boolOpts[@]}\""
+}
+#------------------------------------------------------------------------------
+
+[ "$#" -gt 0 ] || set -- ${searchDirs}
+
+for item
+do
+    if [ -d "$item" ]
+    then
+        # Process directory for applications - sort with ignore-case
+        echo "[directory] $item" 1>&2
+        choices="$(find $item -maxdepth 1 -executable -type f | sort -f 2>/dev/null)"
+        for appName in $choices
+        do
+            extractOptions $appName
+        done
+    elif command -v "$item" > /dev/null 2>&1
+    then
+        extractOptions $item
+    else
+        echo "No such file or directory: $item" 1>&2
+    fi
+done
+
+# Generate footer
+[ "$optHeader" = true ] && cat << FOOTER
+
+#------------------------------------------------------------------------------
+FOOTER
+
+#------------------------------------------------------------------------------
diff --git a/etc/config.csh/complete b/etc/config.csh/complete
deleted file mode 100644
index 88bd4facd852885eaff4f0a511b03ed1dc715e44..0000000000000000000000000000000000000000
--- a/etc/config.csh/complete
+++ /dev/null
@@ -1,59 +0,0 @@
-#!bash
-# A bash -*- sh -*- adapter for re-using OpenFOAM bash completions with tcsh
-#
-# Called with appName and COMMAND_LINE
-#
-# Source the bash completions
-. $WM_PROJECT_DIR/etc/config.sh/bash_completion
-
-appName=$1
-
-# Ensure COMP_LINE is available for bash function
-if [ "$#" -eq 2 ]
-then
-    COMP_LINE=$2
-else
-    COMP_LINE=$COMMAND_LINE
-fi
-
-# Remove the colon as a completion separator because tcsh cannot handle it
-COMP_WORDBREAKS=${COMP_WORDBREAKS//:}
-
-# Set COMP_WORDS in a way that can be handled by the bash script.
-COMP_WORDS=($COMP_LINE)
-
-# The cursor is at the end of parameter #1.
-# We must check for a space as the last character which will
-# tell us that the previous word is complete and the cursor
-# is on the next word.
-if [ "${COMP_LINE: -1}" = " " ]
-then
-    # The last character is a space, so our location is at the end
-    # of the command-line array
-    COMP_CWORD=${#COMP_WORDS[@]}
-else
-    # The last character is not a space, so our location is on the
-    # last word of the command-line array, so we must decrement the
-    # count by 1
-    COMP_CWORD=$((${#COMP_WORDS[@]}-1))
-fi
-
-# bash completions are "complete ... -F _of_APPNAME APPNAME
-_of_${appName} \
-    "$appName" "${COMP_WORDS[COMP_CWORD]}" "${COMP_WORDS[COMP_CWORD-1]}"
-
-# Need slash on the end of directories for tcsh
-reply=($(for i in ${COMPREPLY[@]}
-    do
-        if [ -d "$i" -a "${i#/}" = "$i" ]
-        then
-            echo "$i/"
-        else
-            echo "$i"
-        fi
-    done
-))
-
-echo ${reply[@]}
-
-#------------------------------------------------------------------------------
diff --git a/etc/config.csh/complete-wrapper b/etc/config.csh/complete-wrapper
new file mode 100644
index 0000000000000000000000000000000000000000..d74e64975d9bf9fadacc88b88113cfc5f495c351
--- /dev/null
+++ b/etc/config.csh/complete-wrapper
@@ -0,0 +1,93 @@
+#!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/complete-wrapper
+#
+# Description
+#     A wrapper for using OpenFOAM bash completions with tcsh.
+#
+# Arguments
+#     appName = the application name
+#
+# Environment
+#     The tcsh COMMAND_LINE is passed in via the environment.
+#     This corresponds to the bash COMP_LINE variable
+#
+#------------------------------------------------------------------------------
+[ "$#" -ge 1 ] || exit 1
+
+# Preload completion cache
+if [ -f $WM_PROJECT_DIR/etc/config.sh/completion_cache ]
+then  . $WM_PROJECT_DIR/etc/config.sh/completion_cache
+fi
+
+# Use the bash completion function, but retain cache etc.
+_of_complete_tcsh=true
+if [ -f $WM_PROJECT_DIR/etc/config.sh/bash_completion ]
+then  . $WM_PROJECT_DIR/etc/config.sh/bash_completion
+else
+    # Could warn about missing file, or treat silently
+    echo
+    exit 1
+fi
+
+appName=$1
+
+# Ensure COMP_LINE is available for bash function
+if [ "$#" -eq 2 ]
+then
+    COMP_LINE=$2
+else
+    COMP_LINE=$COMMAND_LINE
+fi
+
+# Remove the colon as a completion separator because tcsh cannot handle it
+COMP_WORDBREAKS=${COMP_WORDBREAKS//:}
+
+# Set COMP_WORDS in a way that can be handled by the bash script.
+COMP_WORDS=($COMP_LINE)
+
+# The cursor is at the end of parameter #1.
+# We must check for a space as the last character which will
+# tell us that the previous word is complete and the cursor
+# is on the next word.
+if [ "${COMP_LINE: -1}" = " " ]
+then
+    # The last character is a space, so our location is at the end
+    # of the command-line array
+    COMP_CWORD=${#COMP_WORDS[@]}
+else
+    # The last character is not a space, so our location is on the
+    # last word of the command-line array, so we must decrement the
+    # count by 1
+    COMP_CWORD=$((${#COMP_WORDS[@]}-1))
+fi
+
+# Call _of_complete_ APPNAME Current Previous
+_of_complete_ \
+    "$appName" "${COMP_WORDS[COMP_CWORD]}" "${COMP_WORDS[COMP_CWORD-1]}"
+
+# Tcsh needs slash on the end of directories
+reply=($(for i in ${COMPREPLY[@]}
+    do
+        if [ -d "$i" -a "${i#/}" = "$i" ]
+        then
+            echo "$i/"
+        else
+            echo "$i"
+        fi
+    done
+))
+
+echo ${reply[@]}
+
+#------------------------------------------------------------------------------
diff --git a/etc/config.csh/tcsh_completion b/etc/config.csh/tcsh_completion
index 251c63cc3afa41907a8b2b51678c639f554c46c1..51258b70206e740cff1e6f866c3c8186b485d652 100644
--- a/etc/config.csh/tcsh_completion
+++ b/etc/config.csh/tcsh_completion
@@ -3,15 +3,23 @@
 # Using bash_completion functions for the hard work
 
 if ($?tcsh) then  # tcsh only
-    if ( -f $WM_PROJECT_DIR/etc/config.sh/bash_completion \
-      && -f $WM_PROJECT_DIR/etc/config.csh/complete) then
-        foreach appName (`sed -ne 's/^complete.* //p' $WM_PROJECT_DIR/etc/config.sh/bash_completion`)
+
+    # 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 $cleaned
+    end
+
+    # Generate completions for predefined directories
+    foreach dirName ("$FOAM_APPBIN")
+        if ( ! -d $dirName || ! -f $WM_PROJECT_DIR/etc/config.csh/complete-wrapper ) continue
+        foreach appName (`find $dirName -maxdepth 1 -executable -type f`)
             # Pass explicitly
-            ## complete $appName 'p,*,`bash $WM_PROJECT_DIR/etc/config.csh/complete '$appName' "${COMMAND_LINE}"`,'
+            ## complete $appName:t 'p,*,`bash $WM_PROJECT_DIR/etc/config.csh/complete-wrapper '$appName:t' "${COMMAND_LINE}"`,'
             # Pass via environment
-            complete $appName 'p,*,`bash $WM_PROJECT_DIR/etc/config.csh/complete '$appName'`,'
+            complete $appName:t 'p,*,`bash $WM_PROJECT_DIR/etc/config.csh/complete-wrapper '$appName:t'`,'
         end
-    endif
+    end
 endif
 
 #------------------------------------------------------------------------------
diff --git a/etc/config.csh/unset b/etc/config.csh/unset
index d9cb0ff21b005e32c1784d2274af7fde3ca92e5d..20f7c9eb6df633eba43b35fa4755bda3835de18c 100644
--- a/etc/config.csh/unset
+++ b/etc/config.csh/unset
@@ -196,11 +196,10 @@ unalias wmRefresh
 unalias foamVersion
 unalias foamPV
 
-# Cleanup completions, which look like this:
-#   complete blockMesh 'p,*,`bash $WM_PROJECT_DIR/etc/ ...
-
+# Remove old completions, which look like:
+#   complete APPNAME 'p,*,`bash $WM_PROJECT_DIR/etc/ ...
 if ($?prompt && $?tcsh) then  # Interactive tcsh only
-    foreach cleaned (`complete | sed -n -e '/WM_PROJECT/s/\t.*$//p'`)
+    foreach cleaned (`complete | sed -ne '/WM_PROJECT/s/\t.*$//p'`)
         uncomplete $cleaned
     end
 endif
diff --git a/etc/config.sh/bash_completion b/etc/config.sh/bash_completion
index b99683f78fc76bb28b3d053bdf7651cd7423e69d..541771c5f1b6a0c7dd0f62a409f34c465728f5ab 100644
--- a/etc/config.sh/bash_completion
+++ b/etc/config.sh/bash_completion
@@ -1,30 +1,97 @@
 #----------------------------------*-sh-*--------------------------------------
-# Bash completions for OpenFOAM applications
-# Recreate with "foamCreateBashCompletions"
+# =========                 |
+# \\      /  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/>.
 #
-# Formatted as "complete ... -F _of_APPNAME APPNAME
-
+# File
+#     etc/config.sh/bash_completion
+#
+# Description
+#     Bash completion handler for OpenFOAM applications and automatic
+#     generation of completion associations
+#
+# Provides
+#     foamAddCompletion
+#     _of_complete_
 #
+# Uses
+#     _of_complete_cache_
+#
+#------------------------------------------------------------------------------
+
+# Add completion for command or directory of commands
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+unset -f foamAddCompletion 2>/dev/null
+foamAddCompletion()
+{
+    [ "$#" -gt 0 ] || \
+        echo "Usage: foamAddCompletion -clear | -list | dir(s) | app(s)" 1>&2
+
+    local appName choices
+    for appName
+    do
+        if [ "$appName" = "-clear" ]
+        then
+           # Clear cached values
+           echo "clear cached values"
+           _of_complete_cache_=()
+
+        elif [ "$appName" = "-list" ]
+        then
+           # List cached keys
+           choices="${#_of_complete_cache_[@]}"
+           echo "$choices cached values:"
+           [ "$choices" = 0 ] || echo ${!_of_complete_cache_[@]}  # keys
+
+        elif [ -d "$appName" ]
+        then
+            # Process directory for applications
+            choices="$(find $appName -maxdepth 1 -executable -type f 2>/dev/null)"
+            for appName in $choices
+            do
+                complete -o filenames -F _of_complete_ "${appName##*/}"
+                # echo "complete ${appName##*/}" 1>&2
+            done
+
+        elif command -v "$appName" > /dev/null 2>&1
+        then
+            complete -o filenames -F _of_complete_ "${appName##*/}"
+            # echo "complete ${appName##*/}" 1>&2
+        else
+            echo "No completion added for $appName" 1>&2
+        fi
+    done
+}
+
+
 # Generic completion handler for OpenFOAM applications
+#
+# Dispatch via "complete ... -F _of_complete_ APPNAME
 # - arg1 = command-name
 # - arg2 = current word
 # - arg3 = previous word
-# - arg4 = options with args
-# - arg5 = boolean options
+#
+# The respective options are generated on-the-fly from the application's -help
+# output and cached to the _of_complete_cache_ global associative array with
+# entries formatted as "argOpts.. | boolOpts ..".
+# The '|' character separates options with and without arguments.
 #
 unset -f _of_complete_ 2>/dev/null
 _of_complete_()
 {
-    # Unused: local cmd=$1
+    local appName=$1
     local cur=$2
     local prev=$3
-    local optsWithArgs="$4 "   # Trailing space added for easier matching
-    local opts="$5 "
     local choices
 
     case ${prev} in
     -help|-doc|-srcDoc)
-        # These options are usage and we can stop here.
+        # These options are usage - we can stop now.
         COMPREPLY=()
         return 0
         ;;
@@ -43,33 +110,60 @@ _of_complete_()
         choices="collated uncollated masterUncollated"
         COMPREPLY=($(compgen -W "$choices" -- ${cur}))
         ;;
-    *Dict)
-        # local dirs=$(\ls -d s*/)
-        # local files=$(\ls -f | grep Dict)
-        # COMPREPLY=($(compgen -W \"$dirs $files\" -- ${cur}))
-        COMPREPLY=($(compgen -f -- ${cur}))
-        ;;
     *)
-        if [ "${optsWithArgs/${prev} /}" != "${optsWithArgs}" ]
+        # All options
+        choices="${_of_complete_cache_[$appName]}"
+
+        # Not in cache, obtain by parsing application -help
+        if [ -z "$choices" ]
         then
-            # Option with unknown type of arg - set to files.
-            # Not always correct but can still navigate path if needed...
-            COMPREPLY=($(compgen -f -- ${cur}))
-        elif [ -n "$cur" -a "${cur#-}" = "${cur}" ]
+            local helpText=$($appName -help 2>/dev/null | sed -ne '/^  *-/p')
+
+            if [ -n "$helpText" ]
+            then
+                # Array of options with args
+                local argOpts=($(awk '/^ {0,4}-[a-z]/ && /</ {print $1}' <<< "$helpText"))
+
+                # Array of options without args
+                local boolOpts=($(awk '/^ {0,4}-[a-z]/ && !/</ {print $1}' <<< "$helpText"))
+
+                choices="${argOpts[@]} | ${boolOpts[@]}"
+            else
+                echo "Error calling $appName" 1>&2
+                choices="false"  # Mark failure to prevent repeating again
+            fi
+            _of_complete_cache_[$appName]="$choices"
+            ## echo "generated $appName = $choices" 1>&2   # Debugging
+        fi
+        if [ "${choices:-false}" = false ]
         then
-            # Already started a (non-empty) word that isn't an option,
-            # use files in which case revert to filenames.
             COMPREPLY=($(compgen -f -- ${cur}))
         else
-            # Catchall
-            # - Present remaining options (not already seen in $COMP_LINE)
-            choices=$(
-                for o in ${opts} ${optsWithArgs}
-                do
-                    [ "${COMP_LINE/$o/}" = "${COMP_LINE}" ] && echo $o
-                done
-            )
-            COMPREPLY=($(compgen -W "$choices" -- ${cur}))
+            # Everything before the '|' ==> options with args.
+            local argOpts="${choices%|*}"
+
+            if [ "${argOpts/${prev} /}" != "${argOpts}" ]
+            then
+                # Option with unknown type of arg - set to files.
+                # Not always correct but can still navigate path if needed...
+                COMPREPLY=($(compgen -f -- ${cur}))
+            elif [ -n "$cur" -a "${cur#-}" = "${cur}" ]
+            then
+                # Already started a (non-empty) word that isn't an option,
+                # in which case revert to filenames.
+                COMPREPLY=($(compgen -f -- ${cur}))
+            else
+                # Catchall
+                # - Present remaining options (not already seen in $COMP_LINE)
+                choices=$(
+                    for o in ${choices}
+                    do
+                        [ "${COMP_LINE/$o/}" = "${COMP_LINE}" ] && echo "${o#|}"
+                    done
+                )
+
+                COMPREPLY=($(compgen -W "$choices" -- ${cur}))
+            fi
         fi
         ;;
     esac
@@ -79,2435 +173,31 @@ _of_complete_()
 
 #------------------------------------------------------------------------------
 
+# Global associative array (cached options for OpenFOAM applications)
+declare -gA _of_complete_cache_;
 
-# [adiabaticFlameT]
-unset -f _of_adiabaticFlameT 2>/dev/null
-_of_adiabaticFlameT() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-srcDoc -doc -help"
-}
-complete -o filenames -F _of_adiabaticFlameT adiabaticFlameT
-
-
-# [adjointShapeOptimizationFoam]
-unset -f _of_adjointShapeOptimizationFoam 2>/dev/null
-_of_adjointShapeOptimizationFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_adjointShapeOptimizationFoam adjointShapeOptimizationFoam
-
-
-# [ansysToFoam]
-unset -f _of_ansysToFoam 2>/dev/null
-_of_ansysToFoam() {
-    _of_complete_ "$@" \
-    "-case -scale" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_ansysToFoam ansysToFoam
-
-
-# [applyBoundaryLayer]
-unset -f _of_applyBoundaryLayer 2>/dev/null
-_of_applyBoundaryLayer() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -region -roots -ybl" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_applyBoundaryLayer applyBoundaryLayer
-
-
-# [attachMesh]
-unset -f _of_attachMesh 2>/dev/null
-_of_attachMesh() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-noFunctionObjects -overwrite -srcDoc -doc -help"
-}
-complete -o filenames -F _of_attachMesh attachMesh
-
-
-# [autoPatch]
-unset -f _of_autoPatch 2>/dev/null
-_of_autoPatch() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-noFunctionObjects -overwrite -srcDoc -doc -help"
-}
-complete -o filenames -F _of_autoPatch autoPatch
-
-
-# [blockMesh]
-unset -f _of_blockMesh 2>/dev/null
-_of_blockMesh() {
-    _of_complete_ "$@" \
-    "-case -dict -region" \
-    "-blockTopology -noClean -noFunctionObjects -sets -srcDoc -doc -help"
-}
-complete -o filenames -F _of_blockMesh blockMesh
-
-
-# [boundaryFoam]
-unset -f _of_boundaryFoam 2>/dev/null
-_of_boundaryFoam() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_boundaryFoam boundaryFoam
-
-
-# [boxTurb]
-unset -f _of_boxTurb 2>/dev/null
-_of_boxTurb() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_boxTurb boxTurb
-
-
-# [buoyantBoussinesqPimpleFoam]
-unset -f _of_buoyantBoussinesqPimpleFoam 2>/dev/null
-_of_buoyantBoussinesqPimpleFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_buoyantBoussinesqPimpleFoam buoyantBoussinesqPimpleFoam
-
-
-# [buoyantBoussinesqSimpleFoam]
-unset -f _of_buoyantBoussinesqSimpleFoam 2>/dev/null
-_of_buoyantBoussinesqSimpleFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_buoyantBoussinesqSimpleFoam buoyantBoussinesqSimpleFoam
-
-
-# [buoyantPimpleFoam]
-unset -f _of_buoyantPimpleFoam 2>/dev/null
-_of_buoyantPimpleFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_buoyantPimpleFoam buoyantPimpleFoam
-
-
-# [buoyantSimpleFoam]
-unset -f _of_buoyantSimpleFoam 2>/dev/null
-_of_buoyantSimpleFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_buoyantSimpleFoam buoyantSimpleFoam
-
-
-# [cavitatingDyMFoam]
-unset -f _of_cavitatingDyMFoam 2>/dev/null
-_of_cavitatingDyMFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_cavitatingDyMFoam cavitatingDyMFoam
-
-
-# [cavitatingFoam]
-unset -f _of_cavitatingFoam 2>/dev/null
-_of_cavitatingFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_cavitatingFoam cavitatingFoam
-
-
-# [cfx4ToFoam]
-unset -f _of_cfx4ToFoam 2>/dev/null
-_of_cfx4ToFoam() {
-    _of_complete_ "$@" \
-    "-case -scale" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_cfx4ToFoam cfx4ToFoam
-
-
-# [changeDictionary]
-unset -f _of_changeDictionary 2>/dev/null
-_of_changeDictionary() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -dict -instance -region -roots -subDict -time" \
-    "-constant -disablePatchGroups -enableFunctionEntries -latestTime -literalRE -newTimes -noFunctionObjects -noZero -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_changeDictionary changeDictionary
-
-
-# [checkMesh]
-unset -f _of_checkMesh 2>/dev/null
-_of_checkMesh() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -region -roots -time -writeFields -writeSets" \
-    "-allGeometry -allTopology -constant -latestTime -meshQuality -newTimes -noFunctionObjects -noTopology -noZero -parallel -writeAllFields -srcDoc -doc -help"
-}
-complete -o filenames -F _of_checkMesh checkMesh
-
-
-# [chemFoam]
-unset -f _of_chemFoam 2>/dev/null
-_of_chemFoam() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-noFunctionObjects -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_chemFoam chemFoam
-
-
-# [chemkinToFoam]
-unset -f _of_chemkinToFoam 2>/dev/null
-_of_chemkinToFoam() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-newFormat -srcDoc -doc -help"
-}
-complete -o filenames -F _of_chemkinToFoam chemkinToFoam
-
-
-# [chtMultiRegionFoam]
-unset -f _of_chtMultiRegionFoam 2>/dev/null
-_of_chtMultiRegionFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_chtMultiRegionFoam chtMultiRegionFoam
-
-
-# [chtMultiRegionSimpleFoam]
-unset -f _of_chtMultiRegionSimpleFoam 2>/dev/null
-_of_chtMultiRegionSimpleFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_chtMultiRegionSimpleFoam chtMultiRegionSimpleFoam
-
-
-# [coalChemistryFoam]
-unset -f _of_coalChemistryFoam 2>/dev/null
-_of_coalChemistryFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_coalChemistryFoam coalChemistryFoam
-
-
-# [coldEngineFoam]
-unset -f _of_coldEngineFoam 2>/dev/null
-_of_coldEngineFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_coldEngineFoam coldEngineFoam
-
-
-# [collapseEdges]
-unset -f _of_collapseEdges 2>/dev/null
-_of_collapseEdges() {
-    _of_complete_ "$@" \
-    "-case -collapseFaceSet -decomposeParDict -dict -roots -time" \
-    "-collapseFaces -constant -latestTime -newTimes -noFunctionObjects -noZero -overwrite -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_collapseEdges collapseEdges
-
-
-# [combinePatchFaces]
-unset -f _of_combinePatchFaces 2>/dev/null
-_of_combinePatchFaces() {
-    _of_complete_ "$@" \
-    "-case -concaveAngle -decomposeParDict -roots" \
-    "-meshQuality -noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_combinePatchFaces combinePatchFaces
-
-
-# [compressibleInterDyMFoam]
-unset -f _of_compressibleInterDyMFoam 2>/dev/null
-_of_compressibleInterDyMFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_compressibleInterDyMFoam compressibleInterDyMFoam
-
-
-# [compressibleInterFoam]
-unset -f _of_compressibleInterFoam 2>/dev/null
-_of_compressibleInterFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_compressibleInterFoam compressibleInterFoam
-
-
-# [compressibleMultiphaseInterFoam]
-unset -f _of_compressibleMultiphaseInterFoam 2>/dev/null
-_of_compressibleMultiphaseInterFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_compressibleMultiphaseInterFoam compressibleMultiphaseInterFoam
-
-
-# [createBaffles]
-unset -f _of_createBaffles 2>/dev/null
-_of_createBaffles() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -dict -region -roots" \
-    "-noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_createBaffles createBaffles
-
-
-# [createExternalCoupledPatchGeometry]
-unset -f _of_createExternalCoupledPatchGeometry 2>/dev/null
-_of_createExternalCoupledPatchGeometry() {
-    _of_complete_ "$@" \
-    "-case -commsDir -decomposeParDict -region -regions -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_createExternalCoupledPatchGeometry createExternalCoupledPatchGeometry
-
-
-# [createPatch]
-unset -f _of_createPatch 2>/dev/null
-_of_createPatch() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -dict -region -roots" \
-    "-noFunctionObjects -overwrite -parallel -writeObj -srcDoc -doc -help"
-}
-complete -o filenames -F _of_createPatch createPatch
-
-
-# [createZeroDirectory]
-unset -f _of_createZeroDirectory 2>/dev/null
-_of_createZeroDirectory() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots -templateDir" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_createZeroDirectory createZeroDirectory
-
-
-# [datToFoam]
-unset -f _of_datToFoam 2>/dev/null
-_of_datToFoam() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_datToFoam datToFoam
-
-
-# [decomposePar]
-unset -f _of_decomposePar 2>/dev/null
-_of_decomposePar() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -region -time" \
-    "-allRegions -cellDist -constant -copyUniform -copyZero -fields -force -ifRequired -latestTime -newTimes -noFunctionObjects -noSets -noZero -srcDoc -doc -help"
-}
-complete -o filenames -F _of_decomposePar decomposePar
-
-
-# [deformedGeom]
-unset -f _of_deformedGeom 2>/dev/null
-_of_deformedGeom() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_deformedGeom deformedGeom
-
-
-# [dnsFoam]
-unset -f _of_dnsFoam 2>/dev/null
-_of_dnsFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_dnsFoam dnsFoam
-
-
-# [DPMDyMFoam]
-unset -f _of_DPMDyMFoam 2>/dev/null
-_of_DPMDyMFoam() {
-    _of_complete_ "$@" \
-    "-case -cloudName -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_DPMDyMFoam DPMDyMFoam
-
-
-# [DPMFoam]
-unset -f _of_DPMFoam 2>/dev/null
-_of_DPMFoam() {
-    _of_complete_ "$@" \
-    "-case -cloud -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_DPMFoam DPMFoam
-
-
-# [driftFluxFoam]
-unset -f _of_driftFluxFoam 2>/dev/null
-_of_driftFluxFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_driftFluxFoam driftFluxFoam
-
-
-# [dsmcFoam]
-unset -f _of_dsmcFoam 2>/dev/null
-_of_dsmcFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_dsmcFoam dsmcFoam
-
-
-# [dsmcInitialise]
-unset -f _of_dsmcInitialise 2>/dev/null
-_of_dsmcInitialise() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_dsmcInitialise dsmcInitialise
-
-
-# [electrostaticFoam]
-unset -f _of_electrostaticFoam 2>/dev/null
-_of_electrostaticFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_electrostaticFoam electrostaticFoam
-
-
-# [engineCompRatio]
-unset -f _of_engineCompRatio 2>/dev/null
-_of_engineCompRatio() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_engineCompRatio engineCompRatio
-
-
-# [engineFoam]
-unset -f _of_engineFoam 2>/dev/null
-_of_engineFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_engineFoam engineFoam
-
-
-# [engineSwirl]
-unset -f _of_engineSwirl 2>/dev/null
-_of_engineSwirl() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_engineSwirl engineSwirl
-
-
-# [equilibriumCO]
-unset -f _of_equilibriumCO 2>/dev/null
-_of_equilibriumCO() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-srcDoc -doc -help"
-}
-complete -o filenames -F _of_equilibriumCO equilibriumCO
-
-
-# [equilibriumFlameT]
-unset -f _of_equilibriumFlameT 2>/dev/null
-_of_equilibriumFlameT() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-srcDoc -doc -help"
-}
-complete -o filenames -F _of_equilibriumFlameT equilibriumFlameT
-
-
-# [extrude2DMesh]
-unset -f _of_extrude2DMesh 2>/dev/null
-_of_extrude2DMesh() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_extrude2DMesh extrude2DMesh
-
-
-# [extrudeMesh]
-unset -f _of_extrudeMesh 2>/dev/null
-_of_extrudeMesh() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -region -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_extrudeMesh extrudeMesh
-
-
-# [extrudeToRegionMesh]
-unset -f _of_extrudeToRegionMesh 2>/dev/null
-_of_extrudeToRegionMesh() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -dict -region -roots" \
-    "-noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_extrudeToRegionMesh extrudeToRegionMesh
-
-
-# [faceAgglomerate]
-unset -f _of_faceAgglomerate 2>/dev/null
-_of_faceAgglomerate() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -dict -region -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_faceAgglomerate faceAgglomerate
-
-
-# [financialFoam]
-unset -f _of_financialFoam 2>/dev/null
-_of_financialFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_financialFoam financialFoam
-
-
-# [fireFoam]
-unset -f _of_fireFoam 2>/dev/null
-_of_fireFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_fireFoam fireFoam
-
-
-# [fireToFoam]
-unset -f _of_fireToFoam 2>/dev/null
-_of_fireToFoam() {
-    _of_complete_ "$@" \
-    "-case -scale" \
-    "-ascii -check -noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_fireToFoam fireToFoam
-
-
-# [flattenMesh]
-unset -f _of_flattenMesh 2>/dev/null
-_of_flattenMesh() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_flattenMesh flattenMesh
+# Clear existing cache and reassign bash completions.
+# But for tcsh wrapper make use of caching and avoid this overhead.
+if [ -z "$_of_complete_tcsh" ]
+then
+    _of_complete_cache_=()
 
+    # Remove old completions, which look like:
+    #     "complete ... -F _of_complete_ APPNAME
+    # For economy, obtain list first
+    foamOldDirs="$(complete 2>/dev/null | sed -ne 's/^.*-F _of_.* \(..*\)$/\1/p')"
+    for cleaned in $foamOldDirs
+    do
+        complete -r $cleaned 2>/dev/null
+    done
 
-# [fluent3DMeshToFoam]
-unset -f _of_fluent3DMeshToFoam 2>/dev/null
-_of_fluent3DMeshToFoam() {
-    _of_complete_ "$@" \
-    "-case -ignoreCellGroups -ignoreFaceGroups -scale" \
-    "-cubit -noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_fluent3DMeshToFoam fluent3DMeshToFoam
-
-
-# [fluentMeshToFoam]
-unset -f _of_fluentMeshToFoam 2>/dev/null
-_of_fluentMeshToFoam() {
-    _of_complete_ "$@" \
-    "-case -scale" \
-    "-noFunctionObjects -writeSets -writeZones -srcDoc -doc -help"
-}
-complete -o filenames -F _of_fluentMeshToFoam fluentMeshToFoam
-
-
-# [foamDataToFluent]
-unset -f _of_foamDataToFluent 2>/dev/null
-_of_foamDataToFluent() {
-    _of_complete_ "$@" \
-    "-case -time" \
-    "-latestTime -newTimes -noFunctionObjects -noZero -srcDoc -doc -help"
-}
-complete -o filenames -F _of_foamDataToFluent foamDataToFluent
-
-
-# [foamDictionary]
-unset -f _of_foamDictionary 2>/dev/null
-_of_foamDictionary() {
-    _of_complete_ "$@" \
-    "-add -case -decomposeParDict -diff -entry -roots -set" \
-    "-disableFunctionEntries -expand -includes -keywords -noFunctionObjects -parallel -remove -value -srcDoc -doc -help"
-}
-complete -o filenames -F _of_foamDictionary foamDictionary
-
-
-# [foamFormatConvert]
-unset -f _of_foamFormatConvert 2>/dev/null
-_of_foamFormatConvert() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -region -roots -time" \
-    "-constant -enableFunctionEntries -latestTime -newTimes -noConstant -noFunctionObjects -noZero -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_foamFormatConvert foamFormatConvert
-
-
-# [foamHelp]
-unset -f _of_foamHelp 2>/dev/null
-_of_foamHelp() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -region -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_foamHelp foamHelp
-
-
-# [foamList]
-unset -f _of_foamList 2>/dev/null
-_of_foamList() {
-    _of_complete_ "$@" \
-    "-case -scalarBCs -vectorBCs" \
-    "-compressibleTurbulenceModels -functionObjects -fvOptions -incompressibleTurbulenceModels -noFunctionObjects -registeredSwitches -switches -unset -srcDoc -doc -help"
-}
-complete -o filenames -F _of_foamList foamList
-
-
-# [foamListTimes]
-unset -f _of_foamListTimes 2>/dev/null
-_of_foamListTimes() {
-    _of_complete_ "$@" \
-    "-case -time" \
-    "-constant -latestTime -newTimes -noFunctionObjects -noZero -processor -rm -withZero -srcDoc -doc -help"
-}
-complete -o filenames -F _of_foamListTimes foamListTimes
-
-
-# [foamMeshToFluent]
-unset -f _of_foamMeshToFluent 2>/dev/null
-_of_foamMeshToFluent() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_foamMeshToFluent foamMeshToFluent
-
-
-# [foamToEnsight]
-unset -f _of_foamToEnsight 2>/dev/null
-_of_foamToEnsight() {
-    _of_complete_ "$@" \
-    "-case -cellZone -decomposeParDict -faceZones -fields -name -patches -region -roots -time -width" \
-    "-ascii -constant -latestTime -newTimes -noFunctionObjects -noLagrangian -noPatches -noZero -nodeValues -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_foamToEnsight foamToEnsight
-
-
-# [foamToEnsightParts]
-unset -f _of_foamToEnsightParts 2>/dev/null
-_of_foamToEnsightParts() {
-    _of_complete_ "$@" \
-    "-case -index -name -time -width" \
-    "-ascii -constant -latestTime -newTimes -noFunctionObjects -noLagrangian -noMesh -noZero -srcDoc -doc -help"
-}
-complete -o filenames -F _of_foamToEnsightParts foamToEnsightParts
-
-
-# [foamToFireMesh]
-unset -f _of_foamToFireMesh 2>/dev/null
-_of_foamToFireMesh() {
-    _of_complete_ "$@" \
-    "-case -scale -time" \
-    "-ascii -constant -latestTime -newTimes -noFunctionObjects -noZero -srcDoc -doc -help"
-}
-complete -o filenames -F _of_foamToFireMesh foamToFireMesh
-
-
-# [foamToGMV]
-unset -f _of_foamToGMV 2>/dev/null
-_of_foamToGMV() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_foamToGMV foamToGMV
-
-
-# [foamToStarMesh]
-unset -f _of_foamToStarMesh 2>/dev/null
-_of_foamToStarMesh() {
-    _of_complete_ "$@" \
-    "-case -scale -time" \
-    "-constant -latestTime -newTimes -noBnd -noFunctionObjects -noZero -srcDoc -doc -help"
-}
-complete -o filenames -F _of_foamToStarMesh foamToStarMesh
-
-
-# [foamToSurface]
-unset -f _of_foamToSurface 2>/dev/null
-_of_foamToSurface() {
-    _of_complete_ "$@" \
-    "-case -scale -time" \
-    "-constant -latestTime -newTimes -noFunctionObjects -noZero -tri -srcDoc -doc -help"
-}
-complete -o filenames -F _of_foamToSurface foamToSurface
-
-
-# [foamToTetDualMesh]
-unset -f _of_foamToTetDualMesh 2>/dev/null
-_of_foamToTetDualMesh() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots -time" \
-    "-constant -latestTime -noFunctionObjects -noZero -overwrite -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_foamToTetDualMesh foamToTetDualMesh
-
-
-# [foamToVTK]
-unset -f _of_foamToVTK 2>/dev/null
-_of_foamToVTK() {
-    _of_complete_ "$@" \
-    "-case -cellSet -decomposeParDict -excludePatches -faceSet -fields -name -pointSet -region -roots -time" \
-    "-allPatches -ascii -constant -latestTime -nearCellValue -newTimes -noFaceZones -noFunctionObjects -noInternal -noLagrangian -noLinks -noPointValues -noZero -parallel -poly -surfaceFields -useTimeName -xml -srcDoc -doc -help"
-}
-complete -o filenames -F _of_foamToVTK foamToVTK
-
-
-# [foamUpgradeCyclics]
-unset -f _of_foamUpgradeCyclics 2>/dev/null
-_of_foamUpgradeCyclics() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -region -roots -time" \
-    "-constant -enableFunctionEntries -latestTime -newTimes -noFunctionObjects -noZero -parallel -test -srcDoc -doc -help"
-}
-complete -o filenames -F _of_foamUpgradeCyclics foamUpgradeCyclics
-
-
-# [foamyHexMesh]
-unset -f _of_foamyHexMesh 2>/dev/null
-_of_foamyHexMesh() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-checkGeometry -conformationOnly -noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_foamyHexMesh foamyHexMesh
-
-
-# [foamyQuadMesh]
-unset -f _of_foamyQuadMesh 2>/dev/null
-_of_foamyQuadMesh() {
-    _of_complete_ "$@" \
-    "-case -pointsFile" \
-    "-noFunctionObjects -overwrite -srcDoc -doc -help"
-}
-complete -o filenames -F _of_foamyQuadMesh foamyQuadMesh
-
-
-# [gambitToFoam]
-unset -f _of_gambitToFoam 2>/dev/null
-_of_gambitToFoam() {
-    _of_complete_ "$@" \
-    "-case -scale" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_gambitToFoam gambitToFoam
-
-
-# [gmshToFoam]
-unset -f _of_gmshToFoam 2>/dev/null
-_of_gmshToFoam() {
-    _of_complete_ "$@" \
-    "-case -region" \
-    "-keepOrientation -noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_gmshToFoam gmshToFoam
+    # Generate completions for predefined directories
+    foamAddCompletion $FOAM_APPBIN
+fi
 
+#------------------------------------------------------------------------------
+# Intermediate variables (do as last for a clean exit code)
 
-# [icoFoam]
-unset -f _of_icoFoam 2>/dev/null
-_of_icoFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_icoFoam icoFoam
-
-
-# [icoUncoupledKinematicParcelDyMFoam]
-unset -f _of_icoUncoupledKinematicParcelDyMFoam 2>/dev/null
-_of_icoUncoupledKinematicParcelDyMFoam() {
-    _of_complete_ "$@" \
-    "-case -cloud -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_icoUncoupledKinematicParcelDyMFoam icoUncoupledKinematicParcelDyMFoam
-
-
-# [icoUncoupledKinematicParcelFoam]
-unset -f _of_icoUncoupledKinematicParcelFoam 2>/dev/null
-_of_icoUncoupledKinematicParcelFoam() {
-    _of_complete_ "$@" \
-    "-case -cloud -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_icoUncoupledKinematicParcelFoam icoUncoupledKinematicParcelFoam
-
-
-# [ideasUnvToFoam]
-unset -f _of_ideasUnvToFoam 2>/dev/null
-_of_ideasUnvToFoam() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-dump -noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_ideasUnvToFoam ideasUnvToFoam
-
-
-# [insideCells]
-unset -f _of_insideCells 2>/dev/null
-_of_insideCells() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_insideCells insideCells
-
-
-# [interCondensatingEvaporatingFoam]
-unset -f _of_interCondensatingEvaporatingFoam 2>/dev/null
-_of_interCondensatingEvaporatingFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_interCondensatingEvaporatingFoam interCondensatingEvaporatingFoam
-
-
-# [interDyMFoam]
-unset -f _of_interDyMFoam 2>/dev/null
-_of_interDyMFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_interDyMFoam interDyMFoam
-
-
-# [interFoam]
-unset -f _of_interFoam 2>/dev/null
-_of_interFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_interFoam interFoam
-
-
-# [interIsoFoam]
-unset -f _of_interIsoFoam 2>/dev/null
-_of_interIsoFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_interIsoFoam interIsoFoam
-
-
-# [interMixingFoam]
-unset -f _of_interMixingFoam 2>/dev/null
-_of_interMixingFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_interMixingFoam interMixingFoam
-
-
-# [interPhaseChangeDyMFoam]
-unset -f _of_interPhaseChangeDyMFoam 2>/dev/null
-_of_interPhaseChangeDyMFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_interPhaseChangeDyMFoam interPhaseChangeDyMFoam
-
-
-# [interPhaseChangeFoam]
-unset -f _of_interPhaseChangeFoam 2>/dev/null
-_of_interPhaseChangeFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_interPhaseChangeFoam interPhaseChangeFoam
-
-
-# [kivaToFoam]
-unset -f _of_kivaToFoam 2>/dev/null
-_of_kivaToFoam() {
-    _of_complete_ "$@" \
-    "-case -file -version -zHeadMin" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_kivaToFoam kivaToFoam
-
-
-# [laplacianFoam]
-unset -f _of_laplacianFoam 2>/dev/null
-_of_laplacianFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_laplacianFoam laplacianFoam
-
-
-# [lumpedPointForces]
-unset -f _of_lumpedPointForces 2>/dev/null
-_of_lumpedPointForces() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -region -roots -time" \
-    "-constant -latestTime -newTimes -noZero -parallel -vtk -srcDoc -doc -help"
-}
-complete -o filenames -F _of_lumpedPointForces lumpedPointForces
-
-
-# [lumpedPointMovement]
-unset -f _of_lumpedPointMovement 2>/dev/null
-_of_lumpedPointMovement() {
-    _of_complete_ "$@" \
-    "-case -max -scale -span" \
-    "-removeLock -slave -srcDoc -doc -help"
-}
-complete -o filenames -F _of_lumpedPointMovement lumpedPointMovement
-
-
-# [lumpedPointZones]
-unset -f _of_lumpedPointZones 2>/dev/null
-_of_lumpedPointZones() {
-    _of_complete_ "$@" \
-    "-case -region" \
-    "-verbose -srcDoc -doc -help"
-}
-complete -o filenames -F _of_lumpedPointZones lumpedPointZones
-
-
-# [magneticFoam]
-unset -f _of_magneticFoam 2>/dev/null
-_of_magneticFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noB -noFunctionObjects -noH -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_magneticFoam magneticFoam
-
-
-# [mapFields]
-unset -f _of_mapFields 2>/dev/null
-_of_mapFields() {
-    _of_complete_ "$@" \
-    "-case -mapMethod -sourceDecomposeParDict -sourceRegion -sourceTime -targetDecomposeParDict -targetRegion" \
-    "-consistent -noFunctionObjects -parallelSource -parallelTarget -subtract -srcDoc -doc -help"
-}
-complete -o filenames -F _of_mapFields mapFields
-
-
-# [mapFieldsPar]
-unset -f _of_mapFieldsPar 2>/dev/null
-_of_mapFieldsPar() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -fields -mapMethod -patchMapMethod -roots -sourceRegion -sourceTime -targetRegion" \
-    "-consistent -noFunctionObjects -noLagrangian -parallel -subtract -srcDoc -doc -help"
-}
-complete -o filenames -F _of_mapFieldsPar mapFieldsPar
-
-
-# [mdEquilibrationFoam]
-unset -f _of_mdEquilibrationFoam 2>/dev/null
-_of_mdEquilibrationFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_mdEquilibrationFoam mdEquilibrationFoam
-
-
-# [mdFoam]
-unset -f _of_mdFoam 2>/dev/null
-_of_mdFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_mdFoam mdFoam
-
-
-# [mdInitialise]
-unset -f _of_mdInitialise 2>/dev/null
-_of_mdInitialise() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_mdInitialise mdInitialise
-
-
-# [mergeMeshes]
-unset -f _of_mergeMeshes 2>/dev/null
-_of_mergeMeshes() {
-    _of_complete_ "$@" \
-    "-addRegion -case -decomposeParDict -masterRegion -roots" \
-    "-noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_mergeMeshes mergeMeshes
-
-
-# [mergeOrSplitBaffles]
-unset -f _of_mergeOrSplitBaffles 2>/dev/null
-_of_mergeOrSplitBaffles() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -dict -region -roots" \
-    "-detectOnly -noFunctionObjects -overwrite -parallel -split -srcDoc -doc -help"
-}
-complete -o filenames -F _of_mergeOrSplitBaffles mergeOrSplitBaffles
-
-
-# [mhdFoam]
-unset -f _of_mhdFoam 2>/dev/null
-_of_mhdFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_mhdFoam mhdFoam
-
-
-# [mirrorMesh]
-unset -f _of_mirrorMesh 2>/dev/null
-_of_mirrorMesh() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_mirrorMesh mirrorMesh
-
-
-# [mixtureAdiabaticFlameT]
-unset -f _of_mixtureAdiabaticFlameT 2>/dev/null
-_of_mixtureAdiabaticFlameT() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-srcDoc -doc -help"
-}
-complete -o filenames -F _of_mixtureAdiabaticFlameT mixtureAdiabaticFlameT
-
-
-# [modifyMesh]
-unset -f _of_modifyMesh 2>/dev/null
-_of_modifyMesh() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_modifyMesh modifyMesh
-
-
-# [moveDynamicMesh]
-unset -f _of_moveDynamicMesh 2>/dev/null
-_of_moveDynamicMesh() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -region -roots" \
-    "-checkAMI -noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_moveDynamicMesh moveDynamicMesh
-
-
-# [moveEngineMesh]
-unset -f _of_moveEngineMesh 2>/dev/null
-_of_moveEngineMesh() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_moveEngineMesh moveEngineMesh
-
-
-# [moveMesh]
-unset -f _of_moveMesh 2>/dev/null
-_of_moveMesh() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_moveMesh moveMesh
-
-
-# [MPPICDyMFoam]
-unset -f _of_MPPICDyMFoam 2>/dev/null
-_of_MPPICDyMFoam() {
-    _of_complete_ "$@" \
-    "-case -cloudName -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_MPPICDyMFoam MPPICDyMFoam
-
-
-# [MPPICFoam]
-unset -f _of_MPPICFoam 2>/dev/null
-_of_MPPICFoam() {
-    _of_complete_ "$@" \
-    "-case -cloud -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_MPPICFoam MPPICFoam
-
-
-# [MPPICInterFoam]
-unset -f _of_MPPICInterFoam 2>/dev/null
-_of_MPPICInterFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_MPPICInterFoam MPPICInterFoam
-
-
-# [mshToFoam]
-unset -f _of_mshToFoam 2>/dev/null
-_of_mshToFoam() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-hex -noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_mshToFoam mshToFoam
-
-
-# [multiphaseEulerFoam]
-unset -f _of_multiphaseEulerFoam 2>/dev/null
-_of_multiphaseEulerFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_multiphaseEulerFoam multiphaseEulerFoam
-
-
-# [multiphaseInterDyMFoam]
-unset -f _of_multiphaseInterDyMFoam 2>/dev/null
-_of_multiphaseInterDyMFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_multiphaseInterDyMFoam multiphaseInterDyMFoam
-
-
-# [multiphaseInterFoam]
-unset -f _of_multiphaseInterFoam 2>/dev/null
-_of_multiphaseInterFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_multiphaseInterFoam multiphaseInterFoam
-
-
-# [netgenNeutralToFoam]
-unset -f _of_netgenNeutralToFoam 2>/dev/null
-_of_netgenNeutralToFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_netgenNeutralToFoam netgenNeutralToFoam
-
-
-# [noise]
-unset -f _of_noise 2>/dev/null
-_of_noise() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -dict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_noise noise
-
-
-# [nonNewtonianIcoFoam]
-unset -f _of_nonNewtonianIcoFoam 2>/dev/null
-_of_nonNewtonianIcoFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_nonNewtonianIcoFoam nonNewtonianIcoFoam
-
-
-# [objToVTK]
-unset -f _of_objToVTK 2>/dev/null
-_of_objToVTK() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_objToVTK objToVTK
-
-
-# [orientFaceZone]
-unset -f _of_orientFaceZone 2>/dev/null
-_of_orientFaceZone() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -region -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_orientFaceZone orientFaceZone
-
-
-# [overInterDyMFoam]
-unset -f _of_overInterDyMFoam 2>/dev/null
-_of_overInterDyMFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_overInterDyMFoam overInterDyMFoam
-
-
-# [overLaplacianDyMFoam]
-unset -f _of_overLaplacianDyMFoam 2>/dev/null
-_of_overLaplacianDyMFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_overLaplacianDyMFoam overLaplacianDyMFoam
-
-
-# [overPimpleDyMFoam]
-unset -f _of_overPimpleDyMFoam 2>/dev/null
-_of_overPimpleDyMFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_overPimpleDyMFoam overPimpleDyMFoam
-
-
-# [overRhoPimpleDyMFoam]
-unset -f _of_overRhoPimpleDyMFoam 2>/dev/null
-_of_overRhoPimpleDyMFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_overRhoPimpleDyMFoam overRhoPimpleDyMFoam
-
-
-# [overSimpleFoam]
-unset -f _of_overSimpleFoam 2>/dev/null
-_of_overSimpleFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_overSimpleFoam overSimpleFoam
-
-
-# [particleTracks]
-unset -f _of_particleTracks 2>/dev/null
-_of_particleTracks() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -region -roots -time" \
-    "-constant -latestTime -newTimes -noFunctionObjects -noZero -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_particleTracks particleTracks
-
-
-# [patchSummary]
-unset -f _of_patchSummary 2>/dev/null
-_of_patchSummary() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -region -roots -time" \
-    "-constant -expand -latestTime -newTimes -noFunctionObjects -noZero -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_patchSummary patchSummary
-
-
-# [pdfPlot]
-unset -f _of_pdfPlot 2>/dev/null
-_of_pdfPlot() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_pdfPlot pdfPlot
-
-
-# [PDRFoam]
-unset -f _of_PDRFoam 2>/dev/null
-_of_PDRFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_PDRFoam PDRFoam
-
-
-# [PDRMesh]
-unset -f _of_PDRMesh 2>/dev/null
-_of_PDRMesh() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_PDRMesh PDRMesh
-
-
-# [pimpleDyMFoam]
-unset -f _of_pimpleDyMFoam 2>/dev/null
-_of_pimpleDyMFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_pimpleDyMFoam pimpleDyMFoam
-
-
-# [pimpleFoam]
-unset -f _of_pimpleFoam 2>/dev/null
-_of_pimpleFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_pimpleFoam pimpleFoam
-
-
-# [pisoFoam]
-unset -f _of_pisoFoam 2>/dev/null
-_of_pisoFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_pisoFoam pisoFoam
-
-
-# [plot3dToFoam]
-unset -f _of_plot3dToFoam 2>/dev/null
-_of_plot3dToFoam() {
-    _of_complete_ "$@" \
-    "-case -scale" \
-    "-noBlank -noFunctionObjects -singleBlock -srcDoc -doc -help"
-}
-complete -o filenames -F _of_plot3dToFoam plot3dToFoam
-
-
-# [polyDualMesh]
-unset -f _of_polyDualMesh 2>/dev/null
-_of_polyDualMesh() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-concaveMultiCells -doNotPreserveFaceZones -noFunctionObjects -overwrite -splitAllFaces -srcDoc -doc -help"
-}
-complete -o filenames -F _of_polyDualMesh polyDualMesh
-
-
-# [porousSimpleFoam]
-unset -f _of_porousSimpleFoam 2>/dev/null
-_of_porousSimpleFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_porousSimpleFoam porousSimpleFoam
-
-
-# [postChannel]
-unset -f _of_postChannel 2>/dev/null
-_of_postChannel() {
-    _of_complete_ "$@" \
-    "-case -time" \
-    "-constant -latestTime -newTimes -noFunctionObjects -noZero -srcDoc -doc -help"
-}
-complete -o filenames -F _of_postChannel postChannel
-
-
-# [postProcess]
-unset -f _of_postProcess 2>/dev/null
-_of_postProcess() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -dict -field -fields -func -funcs -region -roots -time" \
-    "-constant -latestTime -list -newTimes -noFunctionObjects -noZero -parallel -profiling -srcDoc -doc -help"
-}
-complete -o filenames -F _of_postProcess postProcess
-
-
-# [potentialFoam]
-unset -f _of_potentialFoam 2>/dev/null
-_of_potentialFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -pName -roots" \
-    "-initialiseUBCs -noFunctionObjects -parallel -withFunctionObjects -writePhi -writep -srcDoc -doc -help"
-}
-complete -o filenames -F _of_potentialFoam potentialFoam
-
-
-# [potentialFreeSurfaceDyMFoam]
-unset -f _of_potentialFreeSurfaceDyMFoam 2>/dev/null
-_of_potentialFreeSurfaceDyMFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_potentialFreeSurfaceDyMFoam potentialFreeSurfaceDyMFoam
-
-
-# [potentialFreeSurfaceFoam]
-unset -f _of_potentialFreeSurfaceFoam 2>/dev/null
-_of_potentialFreeSurfaceFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_potentialFreeSurfaceFoam potentialFreeSurfaceFoam
-
-
-# [reactingFoam]
-unset -f _of_reactingFoam 2>/dev/null
-_of_reactingFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_reactingFoam reactingFoam
-
-
-# [reactingMultiphaseEulerFoam]
-unset -f _of_reactingMultiphaseEulerFoam 2>/dev/null
-_of_reactingMultiphaseEulerFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_reactingMultiphaseEulerFoam reactingMultiphaseEulerFoam
-
-
-# [reactingParcelFilmFoam]
-unset -f _of_reactingParcelFilmFoam 2>/dev/null
-_of_reactingParcelFilmFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_reactingParcelFilmFoam reactingParcelFilmFoam
-
-
-# [reactingParcelFoam]
-unset -f _of_reactingParcelFoam 2>/dev/null
-_of_reactingParcelFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_reactingParcelFoam reactingParcelFoam
-
-
-# [reactingTwoPhaseEulerFoam]
-unset -f _of_reactingTwoPhaseEulerFoam 2>/dev/null
-_of_reactingTwoPhaseEulerFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_reactingTwoPhaseEulerFoam reactingTwoPhaseEulerFoam
-
-
-# [reconstructPar]
-unset -f _of_reconstructPar 2>/dev/null
-_of_reconstructPar() {
-    _of_complete_ "$@" \
-    "-case -fields -lagrangianFields -region -time" \
-    "-allRegions -constant -latestTime -newTimes -noFields -noFunctionObjects -noLagrangian -noSets -noZero -withZero -srcDoc -doc -help"
-}
-complete -o filenames -F _of_reconstructPar reconstructPar
-
-
-# [reconstructParMesh]
-unset -f _of_reconstructParMesh 2>/dev/null
-_of_reconstructParMesh() {
-    _of_complete_ "$@" \
-    "-case -mergeTol -region -time" \
-    "-cellDist -constant -fullMatch -latestTime -newTimes -noFunctionObjects -noZero -withZero -srcDoc -doc -help"
-}
-complete -o filenames -F _of_reconstructParMesh reconstructParMesh
-
-
-# [redistributePar]
-unset -f _of_redistributePar 2>/dev/null
-_of_redistributePar() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -mergeTol -region -roots -time" \
-    "-cellDist -constant -decompose -latestTime -newTimes -noFunctionObjects -noZero -overwrite -parallel -reconstruct -withZero -srcDoc -doc -help"
-}
-complete -o filenames -F _of_redistributePar redistributePar
-
-
-# [refineHexMesh]
-unset -f _of_refineHexMesh 2>/dev/null
-_of_refineHexMesh() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -region -roots" \
-    "-minSet -noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_refineHexMesh refineHexMesh
-
-
-# [refinementLevel]
-unset -f _of_refinementLevel 2>/dev/null
-_of_refinementLevel() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -readLevel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_refinementLevel refinementLevel
-
-
-# [refineMesh]
-unset -f _of_refineMesh 2>/dev/null
-_of_refineMesh() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -dict -region -roots" \
-    "-all -noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_refineMesh refineMesh
-
-
-# [refineWallLayer]
-unset -f _of_refineWallLayer 2>/dev/null
-_of_refineWallLayer() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots -useSet" \
-    "-noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_refineWallLayer refineWallLayer
-
-
-# [removeFaces]
-unset -f _of_removeFaces 2>/dev/null
-_of_removeFaces() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_removeFaces removeFaces
-
-
-# [renumberMesh]
-unset -f _of_renumberMesh 2>/dev/null
-_of_renumberMesh() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -dict -region -roots -time" \
-    "-constant -frontWidth -latestTime -noFunctionObjects -noZero -overwrite -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_renumberMesh renumberMesh
-
-
-# [rhoCentralDyMFoam]
-unset -f _of_rhoCentralDyMFoam 2>/dev/null
-_of_rhoCentralDyMFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_rhoCentralDyMFoam rhoCentralDyMFoam
-
-
-# [rhoCentralFoam]
-unset -f _of_rhoCentralFoam 2>/dev/null
-_of_rhoCentralFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_rhoCentralFoam rhoCentralFoam
-
-
-# [rhoPimpleAdiabaticFoam]
-unset -f _of_rhoPimpleAdiabaticFoam 2>/dev/null
-_of_rhoPimpleAdiabaticFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_rhoPimpleAdiabaticFoam rhoPimpleAdiabaticFoam
-
-
-# [rhoPimpleDyMFoam]
-unset -f _of_rhoPimpleDyMFoam 2>/dev/null
-_of_rhoPimpleDyMFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_rhoPimpleDyMFoam rhoPimpleDyMFoam
-
-
-# [rhoPimpleFoam]
-unset -f _of_rhoPimpleFoam 2>/dev/null
-_of_rhoPimpleFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_rhoPimpleFoam rhoPimpleFoam
-
-
-# [rhoPorousSimpleFoam]
-unset -f _of_rhoPorousSimpleFoam 2>/dev/null
-_of_rhoPorousSimpleFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_rhoPorousSimpleFoam rhoPorousSimpleFoam
-
-
-# [rhoReactingBuoyantFoam]
-unset -f _of_rhoReactingBuoyantFoam 2>/dev/null
-_of_rhoReactingBuoyantFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_rhoReactingBuoyantFoam rhoReactingBuoyantFoam
-
-
-# [rhoReactingFoam]
-unset -f _of_rhoReactingFoam 2>/dev/null
-_of_rhoReactingFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_rhoReactingFoam rhoReactingFoam
-
-
-# [rhoSimpleFoam]
-unset -f _of_rhoSimpleFoam 2>/dev/null
-_of_rhoSimpleFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_rhoSimpleFoam rhoSimpleFoam
-
-
-# [rotateMesh]
-unset -f _of_rotateMesh 2>/dev/null
-_of_rotateMesh() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots -time" \
-    "-constant -latestTime -newTimes -noFunctionObjects -noZero -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_rotateMesh rotateMesh
-
-
-# [scalarTransportFoam]
-unset -f _of_scalarTransportFoam 2>/dev/null
-_of_scalarTransportFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_scalarTransportFoam scalarTransportFoam
-
-
-# [selectCells]
-unset -f _of_selectCells 2>/dev/null
-_of_selectCells() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_selectCells selectCells
-
-
-# [setAlphaField]
-unset -f _of_setAlphaField 2>/dev/null
-_of_setAlphaField() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_setAlphaField setAlphaField
-
-
-# [setFields]
-unset -f _of_setFields 2>/dev/null
-_of_setFields() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -dict -region -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_setFields setFields
-
-
-# [setSet]
-unset -f _of_setSet 2>/dev/null
-_of_setSet() {
-    _of_complete_ "$@" \
-    "-batch -case -decomposeParDict -region -roots -time" \
-    "-constant -latestTime -loop -newTimes -noFunctionObjects -noSync -noVTK -noZero -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_setSet setSet
-
-
-# [setsToZones]
-unset -f _of_setsToZones 2>/dev/null
-_of_setsToZones() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -region -roots -time" \
-    "-constant -latestTime -newTimes -noFlipMap -noFunctionObjects -noZero -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_setsToZones setsToZones
-
-
-# [shallowWaterFoam]
-unset -f _of_shallowWaterFoam 2>/dev/null
-_of_shallowWaterFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_shallowWaterFoam shallowWaterFoam
-
-
-# [simpleCoalParcelFoam]
-unset -f _of_simpleCoalParcelFoam 2>/dev/null
-_of_simpleCoalParcelFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_simpleCoalParcelFoam simpleCoalParcelFoam
-
-
-# [simpleFoam]
-unset -f _of_simpleFoam 2>/dev/null
-_of_simpleFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_simpleFoam simpleFoam
-
-
-# [simpleReactingParcelFoam]
-unset -f _of_simpleReactingParcelFoam 2>/dev/null
-_of_simpleReactingParcelFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_simpleReactingParcelFoam simpleReactingParcelFoam
-
-
-# [singleCellMesh]
-unset -f _of_singleCellMesh 2>/dev/null
-_of_singleCellMesh() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots -time" \
-    "-constant -latestTime -newTimes -noFunctionObjects -noZero -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_singleCellMesh singleCellMesh
-
-
-# [smapToFoam]
-unset -f _of_smapToFoam 2>/dev/null
-_of_smapToFoam() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_smapToFoam smapToFoam
-
-
-# [snappyHexMesh]
-unset -f _of_snappyHexMesh 2>/dev/null
-_of_snappyHexMesh() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -dict -outFile -patches -region -roots -surfaceSimplify" \
-    "-checkGeometry -noFunctionObjects -overwrite -parallel -profiling -srcDoc -doc -help"
-}
-complete -o filenames -F _of_snappyHexMesh snappyHexMesh
-
-
-# [snappyRefineMesh]
-unset -f _of_snappyRefineMesh 2>/dev/null
-_of_snappyRefineMesh() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_snappyRefineMesh snappyRefineMesh
-
-
-# [solidDisplacementFoam]
-unset -f _of_solidDisplacementFoam 2>/dev/null
-_of_solidDisplacementFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_solidDisplacementFoam solidDisplacementFoam
-
-
-# [solidEquilibriumDisplacementFoam]
-unset -f _of_solidEquilibriumDisplacementFoam 2>/dev/null
-_of_solidEquilibriumDisplacementFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_solidEquilibriumDisplacementFoam solidEquilibriumDisplacementFoam
-
-
-# [sonicDyMFoam]
-unset -f _of_sonicDyMFoam 2>/dev/null
-_of_sonicDyMFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_sonicDyMFoam sonicDyMFoam
-
-
-# [sonicFoam]
-unset -f _of_sonicFoam 2>/dev/null
-_of_sonicFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_sonicFoam sonicFoam
-
-
-# [sonicLiquidFoam]
-unset -f _of_sonicLiquidFoam 2>/dev/null
-_of_sonicLiquidFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_sonicLiquidFoam sonicLiquidFoam
-
-
-# [splitCells]
-unset -f _of_splitCells 2>/dev/null
-_of_splitCells() {
-    _of_complete_ "$@" \
-    "-case -set -tol" \
-    "-geometry -noFunctionObjects -overwrite -srcDoc -doc -help"
-}
-complete -o filenames -F _of_splitCells splitCells
-
-
-# [splitMesh]
-unset -f _of_splitMesh 2>/dev/null
-_of_splitMesh() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-noFunctionObjects -overwrite -srcDoc -doc -help"
-}
-complete -o filenames -F _of_splitMesh splitMesh
-
-
-# [splitMeshRegions]
-unset -f _of_splitMeshRegions 2>/dev/null
-_of_splitMeshRegions() {
-    _of_complete_ "$@" \
-    "-blockedFaces -case -cellZonesFileOnly -decomposeParDict -insidePoint -region -roots" \
-    "-cellZones -cellZonesOnly -detectOnly -largestOnly -makeCellZones -noFunctionObjects -overwrite -parallel -prefixRegion -sloppyCellZones -useFaceZones -srcDoc -doc -help"
-}
-complete -o filenames -F _of_splitMeshRegions splitMeshRegions
-
-
-# [sprayDyMFoam]
-unset -f _of_sprayDyMFoam 2>/dev/null
-_of_sprayDyMFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_sprayDyMFoam sprayDyMFoam
-
-
-# [sprayEngineFoam]
-unset -f _of_sprayEngineFoam 2>/dev/null
-_of_sprayEngineFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_sprayEngineFoam sprayEngineFoam
-
-
-# [sprayFoam]
-unset -f _of_sprayFoam 2>/dev/null
-_of_sprayFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_sprayFoam sprayFoam
-
-
-# [SRFPimpleFoam]
-unset -f _of_SRFPimpleFoam 2>/dev/null
-_of_SRFPimpleFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_SRFPimpleFoam SRFPimpleFoam
-
-
-# [SRFSimpleFoam]
-unset -f _of_SRFSimpleFoam 2>/dev/null
-_of_SRFSimpleFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_SRFSimpleFoam SRFSimpleFoam
-
-
-# [star4ToFoam]
-unset -f _of_star4ToFoam 2>/dev/null
-_of_star4ToFoam() {
-    _of_complete_ "$@" \
-    "-case -scale" \
-    "-ascii -noFunctionObjects -solids -srcDoc -doc -help"
-}
-complete -o filenames -F _of_star4ToFoam star4ToFoam
-
-
-# [steadyParticleTracks]
-unset -f _of_steadyParticleTracks 2>/dev/null
-_of_steadyParticleTracks() {
-    _of_complete_ "$@" \
-    "-case -dict -region -time" \
-    "-constant -latestTime -newTimes -noFunctionObjects -noZero -srcDoc -doc -help"
-}
-complete -o filenames -F _of_steadyParticleTracks steadyParticleTracks
-
-
-# [stitchMesh]
-unset -f _of_stitchMesh 2>/dev/null
-_of_stitchMesh() {
-    _of_complete_ "$@" \
-    "-case -region -toleranceDict" \
-    "-noFunctionObjects -overwrite -partial -perfect -srcDoc -doc -help"
-}
-complete -o filenames -F _of_stitchMesh stitchMesh
-
-
-# [subsetMesh]
-unset -f _of_subsetMesh 2>/dev/null
-_of_subsetMesh() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -patch -patches -region -resultTime -roots" \
-    "-noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_subsetMesh subsetMesh
-
-
-# [surfaceAdd]
-unset -f _of_surfaceAdd 2>/dev/null
-_of_surfaceAdd() {
-    _of_complete_ "$@" \
-    "-case -points" \
-    "-mergeRegions -noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceAdd surfaceAdd
-
-
-# [surfaceBooleanFeatures]
-unset -f _of_surfaceBooleanFeatures 2>/dev/null
-_of_surfaceBooleanFeatures() {
-    _of_complete_ "$@" \
-    "-case -trim" \
-    "-invertedSpace -noFunctionObjects -perturb -surf1Baffle -surf2Baffle -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceBooleanFeatures surfaceBooleanFeatures
-
-
-# [surfaceCheck]
-unset -f _of_surfaceCheck 2>/dev/null
-_of_surfaceCheck() {
-    _of_complete_ "$@" \
-    "-case -outputThreshold" \
-    "-blockMesh -checkSelfIntersection -noFunctionObjects -splitNonManifold -verbose -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceCheck surfaceCheck
-
-
-# [surfaceClean]
-unset -f _of_surfaceClean 2>/dev/null
-_of_surfaceClean() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-noClean -noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceClean surfaceClean
-
-
-# [surfaceCoarsen]
-unset -f _of_surfaceCoarsen 2>/dev/null
-_of_surfaceCoarsen() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceCoarsen surfaceCoarsen
-
-
-# [surfaceConvert]
-unset -f _of_surfaceConvert 2>/dev/null
-_of_surfaceConvert() {
-    _of_complete_ "$@" \
-    "-case -scale -writePrecision" \
-    "-clean -group -noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceConvert surfaceConvert
-
-
-# [surfaceFeatureConvert]
-unset -f _of_surfaceFeatureConvert 2>/dev/null
-_of_surfaceFeatureConvert() {
-    _of_complete_ "$@" \
-    "-case -scale" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceFeatureConvert surfaceFeatureConvert
-
-
-# [surfaceFeatureExtract]
-unset -f _of_surfaceFeatureExtract 2>/dev/null
-_of_surfaceFeatureExtract() {
-    _of_complete_ "$@" \
-    "-case -dict" \
-    "-srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceFeatureExtract surfaceFeatureExtract
-
-
-# [surfaceFind]
-unset -f _of_surfaceFind 2>/dev/null
-_of_surfaceFind() {
-    _of_complete_ "$@" \
-    "-case -x -y -z" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceFind surfaceFind
-
-
-# [surfaceHookUp]
-unset -f _of_surfaceHookUp 2>/dev/null
-_of_surfaceHookUp() {
-    _of_complete_ "$@" \
-    "-case -dict" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceHookUp surfaceHookUp
-
-
-# [surfaceInertia]
-unset -f _of_surfaceInertia 2>/dev/null
-_of_surfaceInertia() {
-    _of_complete_ "$@" \
-    "-case -density -referencePoint" \
-    "-noFunctionObjects -shellProperties -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceInertia surfaceInertia
-
-
-# [surfaceInflate]
-unset -f _of_surfaceInflate 2>/dev/null
-_of_surfaceInflate() {
-    _of_complete_ "$@" \
-    "-case -featureAngle -nSmooth" \
-    "-checkSelfIntersection -debug -noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceInflate surfaceInflate
-
-
-# [surfaceLambdaMuSmooth]
-unset -f _of_surfaceLambdaMuSmooth 2>/dev/null
-_of_surfaceLambdaMuSmooth() {
-    _of_complete_ "$@" \
-    "-featureFile" \
-    "-srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceLambdaMuSmooth surfaceLambdaMuSmooth
-
-
-# [surfaceMeshConvert]
-unset -f _of_surfaceMeshConvert 2>/dev/null
-_of_surfaceMeshConvert() {
-    _of_complete_ "$@" \
-    "-case -dict -from -scaleIn -scaleOut -to" \
-    "-clean -noFunctionObjects -tri -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceMeshConvert surfaceMeshConvert
-
-
-# [surfaceMeshConvertTesting]
-unset -f _of_surfaceMeshConvertTesting 2>/dev/null
-_of_surfaceMeshConvertTesting() {
-    _of_complete_ "$@" \
-    "-case -scale" \
-    "-clean -noFunctionObjects -orient -stdout -surfMesh -testModify -triFace -triSurface -unsorted -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceMeshConvertTesting surfaceMeshConvertTesting
-
-
-# [surfaceMeshExport]
-unset -f _of_surfaceMeshExport 2>/dev/null
-_of_surfaceMeshExport() {
-    _of_complete_ "$@" \
-    "-case -dict -from -name -scaleIn -scaleOut -to" \
-    "-clean -noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceMeshExport surfaceMeshExport
-
-
-# [surfaceMeshImport]
-unset -f _of_surfaceMeshImport 2>/dev/null
-_of_surfaceMeshImport() {
-    _of_complete_ "$@" \
-    "-case -dict -from -name -scaleIn -scaleOut -to" \
-    "-clean -noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceMeshImport surfaceMeshImport
-
-
-# [surfaceMeshInfo]
-unset -f _of_surfaceMeshInfo 2>/dev/null
-_of_surfaceMeshInfo() {
-    _of_complete_ "$@" \
-    "-case -scale" \
-    "-areas -noFunctionObjects -xml -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceMeshInfo surfaceMeshInfo
-
-
-# [surfaceMeshTriangulate]
-unset -f _of_surfaceMeshTriangulate 2>/dev/null
-_of_surfaceMeshTriangulate() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -faceZones -patches -region -roots -time" \
-    "-constant -excludeProcPatches -latestTime -newTimes -noFunctionObjects -noZero -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceMeshTriangulate surfaceMeshTriangulate
-
-
-# [surfaceOrient]
-unset -f _of_surfaceOrient 2>/dev/null
-_of_surfaceOrient() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-inside -noFunctionObjects -usePierceTest -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceOrient surfaceOrient
-
-
-# [surfacePatch]
-unset -f _of_surfacePatch 2>/dev/null
-_of_surfacePatch() {
-    _of_complete_ "$@" \
-    "-case -dict" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfacePatch surfacePatch
-
-
-# [surfacePointMerge]
-unset -f _of_surfacePointMerge 2>/dev/null
-_of_surfacePointMerge() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfacePointMerge surfacePointMerge
-
-
-# [surfaceRedistributePar]
-unset -f _of_surfaceRedistributePar 2>/dev/null
-_of_surfaceRedistributePar() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-keepNonMapped -noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceRedistributePar surfaceRedistributePar
-
-
-# [surfaceRefineRedGreen]
-unset -f _of_surfaceRefineRedGreen 2>/dev/null
-_of_surfaceRefineRedGreen() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceRefineRedGreen surfaceRefineRedGreen
-
-
-# [surfaceSplitByPatch]
-unset -f _of_surfaceSplitByPatch 2>/dev/null
-_of_surfaceSplitByPatch() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceSplitByPatch surfaceSplitByPatch
-
-
-# [surfaceSplitByTopology]
-unset -f _of_surfaceSplitByTopology 2>/dev/null
-_of_surfaceSplitByTopology() {
-    _of_complete_ "$@" \
-    "" \
-    "-srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceSplitByTopology surfaceSplitByTopology
-
-
-# [surfaceSplitNonManifolds]
-unset -f _of_surfaceSplitNonManifolds 2>/dev/null
-_of_surfaceSplitNonManifolds() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-debug -noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceSplitNonManifolds surfaceSplitNonManifolds
-
-
-# [surfaceSubset]
-unset -f _of_surfaceSubset 2>/dev/null
-_of_surfaceSubset() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceSubset surfaceSubset
-
-
-# [surfaceToPatch]
-unset -f _of_surfaceToPatch 2>/dev/null
-_of_surfaceToPatch() {
-    _of_complete_ "$@" \
-    "-case -faceSet -tol" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceToPatch surfaceToPatch
-
-
-# [surfaceTransformPoints]
-unset -f _of_surfaceTransformPoints 2>/dev/null
-_of_surfaceTransformPoints() {
-    _of_complete_ "$@" \
-    "-case -rollPitchYaw -rotate -scale -translate -yawPitchRoll" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_surfaceTransformPoints surfaceTransformPoints
-
-
-# [temporalInterpolate]
-unset -f _of_temporalInterpolate 2>/dev/null
-_of_temporalInterpolate() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -divisions -fields -interpolationType -region -roots -time" \
-    "-constant -latestTime -newTimes -noFunctionObjects -noZero -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_temporalInterpolate temporalInterpolate
-
-
-# [tetgenToFoam]
-unset -f _of_tetgenToFoam 2>/dev/null
-_of_tetgenToFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFaceFile -noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_tetgenToFoam tetgenToFoam
-
-
-# [thermoFoam]
-unset -f _of_thermoFoam 2>/dev/null
-_of_thermoFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_thermoFoam thermoFoam
-
-
-# [topoSet]
-unset -f _of_topoSet 2>/dev/null
-_of_topoSet() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -dict -region -roots -time" \
-    "-constant -latestTime -newTimes -noFunctionObjects -noSync -noZero -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_topoSet topoSet
-
-
-# [transformPoints]
-unset -f _of_transformPoints 2>/dev/null
-_of_transformPoints() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -region -rollPitchYaw -roots -rotate -scale -translate -yawPitchRoll" \
-    "-noFunctionObjects -parallel -rotateFields -srcDoc -doc -help"
-}
-complete -o filenames -F _of_transformPoints transformPoints
-
-
-# [twoLiquidMixingFoam]
-unset -f _of_twoLiquidMixingFoam 2>/dev/null
-_of_twoLiquidMixingFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_twoLiquidMixingFoam twoLiquidMixingFoam
-
-
-# [twoPhaseEulerFoam]
-unset -f _of_twoPhaseEulerFoam 2>/dev/null
-_of_twoPhaseEulerFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_twoPhaseEulerFoam twoPhaseEulerFoam
-
-
-# [uncoupledKinematicParcelFoam]
-unset -f _of_uncoupledKinematicParcelFoam 2>/dev/null
-_of_uncoupledKinematicParcelFoam() {
-    _of_complete_ "$@" \
-    "-case -cloud -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_uncoupledKinematicParcelFoam uncoupledKinematicParcelFoam
-
-
-# [viewFactorsGen]
-unset -f _of_viewFactorsGen 2>/dev/null
-_of_viewFactorsGen() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -region -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_viewFactorsGen viewFactorsGen
-
-
-# [vtkUnstructuredToFoam]
-unset -f _of_vtkUnstructuredToFoam 2>/dev/null
-_of_vtkUnstructuredToFoam() {
-    _of_complete_ "$@" \
-    "-case" \
-    "-noFunctionObjects -srcDoc -doc -help"
-}
-complete -o filenames -F _of_vtkUnstructuredToFoam vtkUnstructuredToFoam
-
-
-# [wallFunctionTable]
-unset -f _of_wallFunctionTable 2>/dev/null
-_of_wallFunctionTable() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_wallFunctionTable wallFunctionTable
-
-
-# [writeMeshObj]
-unset -f _of_writeMeshObj 2>/dev/null
-_of_writeMeshObj() {
-    _of_complete_ "$@" \
-    "-case -cell -cellSet -decomposeParDict -face -faceSet -point -region -roots -time" \
-    "-constant -latestTime -newTimes -noFunctionObjects -noZero -parallel -patchEdges -patchFaces -srcDoc -doc -help"
-}
-complete -o filenames -F _of_writeMeshObj writeMeshObj
-
-
-# [XiDyMFoam]
-unset -f _of_XiDyMFoam 2>/dev/null
-_of_XiDyMFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_XiDyMFoam XiDyMFoam
-
-
-# [XiFoam]
-unset -f _of_XiFoam 2>/dev/null
-_of_XiFoam() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -roots" \
-    "-noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
-}
-complete -o filenames -F _of_XiFoam XiFoam
-
-
-# [zipUpMesh]
-unset -f _of_zipUpMesh 2>/dev/null
-_of_zipUpMesh() {
-    _of_complete_ "$@" \
-    "-case -decomposeParDict -region -roots" \
-    "-noFunctionObjects -parallel -srcDoc -doc -help"
-}
-complete -o filenames -F _of_zipUpMesh zipUpMesh
-
+unset cleaned foamOldDirs
 
 #------------------------------------------------------------------------------
diff --git a/etc/config.sh/completion_cache b/etc/config.sh/completion_cache
new file mode 100644
index 0000000000000000000000000000000000000000..942dbe4e466966b337c7d37a8f8068bacdcddef1
--- /dev/null
+++ b/etc/config.sh/completion_cache
@@ -0,0 +1,259 @@
+#----------------------------------*-sh-*--------------------------------------
+# Cached options for bash completion of OpenFOAM applications.
+# These are the values expected by the '_of_complete_' function
+#
+# Recreate with "foamCreateCompletionCache"
+
+# Global associative array (cached options for OpenFOAM applications)
+declare -gA _of_complete_cache_;
+
+# Clear existing cache.
+_of_complete_cache_=()
+
+#------------------------------------------------------------------------------
+_of_complete_cache_[adiabaticFlameT]="-case | -srcDoc -doc -help"
+_of_complete_cache_[adjointShapeOptimizationFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[ansysToFoam]="-case -scale | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[applyBoundaryLayer]="-case -decomposeParDict -region -roots -ybl | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[attachMesh]="-case | -noFunctionObjects -overwrite -srcDoc -doc -help"
+_of_complete_cache_[autoPatch]="-case | -noFunctionObjects -overwrite -srcDoc -doc -help"
+_of_complete_cache_[blockMesh]="-case -dict -region | -blockTopology -noClean -noFunctionObjects -sets -srcDoc -doc -help"
+_of_complete_cache_[boundaryFoam]="-case | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[boxTurb]="-case | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[buoyantBoussinesqPimpleFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[buoyantBoussinesqSimpleFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[buoyantPimpleFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[buoyantSimpleFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[cavitatingDyMFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[cavitatingFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[cfx4ToFoam]="-case -scale | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[changeDictionary]="-case -decomposeParDict -dict -instance -region -roots -subDict -time | -constant -disablePatchGroups -enableFunctionEntries -latestTime -literalRE -newTimes -noFunctionObjects -noZero -parallel -srcDoc -doc -help"
+_of_complete_cache_[checkMesh]="-case -decomposeParDict -region -roots -time -writeFields -writeSets | -allGeometry -allTopology -constant -latestTime -meshQuality -newTimes -noFunctionObjects -noTopology -noZero -parallel -writeAllFields -srcDoc -doc -help"
+_of_complete_cache_[chemFoam]="-case | -noFunctionObjects -postProcess -srcDoc -doc -help"
+_of_complete_cache_[chemkinToFoam]="-case | -newFormat -srcDoc -doc -help"
+_of_complete_cache_[chtMultiRegionFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[chtMultiRegionSimpleFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[coalChemistryFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[coldEngineFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[collapseEdges]="-case -collapseFaceSet -decomposeParDict -dict -roots -time | -collapseFaces -constant -latestTime -newTimes -noFunctionObjects -noZero -overwrite -parallel -srcDoc -doc -help"
+_of_complete_cache_[combinePatchFaces]="-case -concaveAngle -decomposeParDict -roots | -meshQuality -noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
+_of_complete_cache_[compressibleInterDyMFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[compressibleInterFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[compressibleMultiphaseInterFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[createBaffles]="-case -decomposeParDict -dict -region -roots | -noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
+_of_complete_cache_[createExternalCoupledPatchGeometry]="-case -commsDir -decomposeParDict -region -regions -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[createPatch]="-case -decomposeParDict -dict -region -roots | -noFunctionObjects -overwrite -parallel -writeObj -srcDoc -doc -help"
+_of_complete_cache_[createZeroDirectory]="-case -decomposeParDict -roots -templateDir | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[datToFoam]="-case | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[decomposePar]="-case -decomposeParDict -region -time | -allRegions -cellDist -constant -copyUniform -copyZero -fields -force -ifRequired -latestTime -newTimes -noFunctionObjects -noSets -noZero -srcDoc -doc -help"
+_of_complete_cache_[deformedGeom]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[dnsFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[DPMDyMFoam]="-case -cloudName -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[DPMFoam]="-case -cloud -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[driftFluxFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[dsmcFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[dsmcInitialise]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[electrostaticFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[engineCompRatio]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[engineFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[engineSwirl]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[equilibriumCO]="-case | -srcDoc -doc -help"
+_of_complete_cache_[equilibriumFlameT]="-case | -srcDoc -doc -help"
+_of_complete_cache_[extrude2DMesh]="-case -decomposeParDict -roots | -noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
+_of_complete_cache_[extrudeMesh]="-case -decomposeParDict -region -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[extrudeToRegionMesh]="-case -decomposeParDict -dict -region -roots | -noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
+_of_complete_cache_[faceAgglomerate]="-case -decomposeParDict -dict -region -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[financialFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[fireFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[fireToFoam]="-case -scale | -ascii -check -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[flattenMesh]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[fluent3DMeshToFoam]="-case -ignoreCellGroups -ignoreFaceGroups -scale | -cubit -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[fluentMeshToFoam]="-case -scale | -noFunctionObjects -writeSets -writeZones -srcDoc -doc -help"
+_of_complete_cache_[foamDataToFluent]="-case -time | -latestTime -newTimes -noFunctionObjects -noZero -srcDoc -doc -help"
+_of_complete_cache_[foamDictionary]="-add -case -decomposeParDict -diff -entry -roots -set | -disableFunctionEntries -expand -includes -keywords -noFunctionObjects -parallel -remove -value -srcDoc -doc -help"
+_of_complete_cache_[foamFormatConvert]="-case -decomposeParDict -region -roots -time | -constant -enableFunctionEntries -latestTime -newTimes -noConstant -noFunctionObjects -noZero -parallel -srcDoc -doc -help"
+_of_complete_cache_[foamHelp]="-case -decomposeParDict -region -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[foamList]="-case -scalarBCs -vectorBCs | -compressibleTurbulenceModels -functionObjects -fvOptions -incompressibleTurbulenceModels -noFunctionObjects -registeredSwitches -switches -unset -srcDoc -doc -help"
+_of_complete_cache_[foamListTimes]="-case -time | -constant -latestTime -newTimes -noFunctionObjects -noZero -processor -rm -withZero -srcDoc -doc -help"
+_of_complete_cache_[foamMeshToFluent]="-case | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[foamToEnsight]="-case -cellZone -decomposeParDict -faceZones -fields -name -patches -region -roots -time -width | -ascii -constant -latestTime -newTimes -noFunctionObjects -noLagrangian -noPatches -noZero -nodeValues -parallel -srcDoc -doc -help"
+_of_complete_cache_[foamToEnsightParts]="-case -index -name -time -width | -ascii -constant -latestTime -newTimes -noFunctionObjects -noLagrangian -noMesh -noZero -srcDoc -doc -help"
+_of_complete_cache_[foamToFireMesh]="-case -scale -time | -ascii -constant -latestTime -newTimes -noFunctionObjects -noZero -srcDoc -doc -help"
+_of_complete_cache_[foamToGMV]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[foamToStarMesh]="-case -scale -time | -constant -latestTime -newTimes -noBnd -noFunctionObjects -noZero -srcDoc -doc -help"
+_of_complete_cache_[foamToSurface]="-case -scale -time | -constant -latestTime -newTimes -noFunctionObjects -noZero -tri -srcDoc -doc -help"
+_of_complete_cache_[foamToTecplot360]="-case -cellSet -decomposeParDict -excludePatches -faceSet -fields -region -roots -time | -constant -latestTime -nearCellValue -newTimes -noFaceZones -noFunctionObjects -noInternal -noPointValues -noZero -parallel -srcDoc -doc -help"
+_of_complete_cache_[foamToTetDualMesh]="-case -decomposeParDict -roots -time | -constant -latestTime -noFunctionObjects -noZero -overwrite -parallel -srcDoc -doc -help"
+_of_complete_cache_[foamToVTK]="-case -cellSet -decomposeParDict -excludePatches -faceSet -fields -name -pointSet -region -roots -time | -allPatches -ascii -constant -latestTime -nearCellValue -newTimes -noFaceZones -noFunctionObjects -noInternal -noLagrangian -noLinks -noPointValues -noZero -parallel -poly -surfaceFields -useTimeName -xml -srcDoc -doc -help"
+_of_complete_cache_[foamUpgradeCyclics]="-case -decomposeParDict -region -roots -time | -constant -enableFunctionEntries -latestTime -newTimes -noFunctionObjects -noZero -parallel -test -srcDoc -doc -help"
+_of_complete_cache_[foamyHexMesh]="-case -decomposeParDict -roots | -checkGeometry -conformationOnly -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[foamyQuadMesh]="-case -pointsFile | -noFunctionObjects -overwrite -srcDoc -doc -help"
+_of_complete_cache_[gambitToFoam]="-case -scale | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[gmshToFoam]="-case -region | -keepOrientation -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[icoFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[icoUncoupledKinematicParcelDyMFoam]="-case -cloud -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[icoUncoupledKinematicParcelFoam]="-case -cloud -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[ideasUnvToFoam]="-case | -dump -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[insideCells]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[interCondensatingEvaporatingFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[interDyMFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[interFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[interIsoFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[interMixingFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[interPhaseChangeDyMFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[interPhaseChangeFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[kivaToFoam]="-case -file -version -zHeadMin | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[laplacianFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[lumpedPointForces]="-case -decomposeParDict -region -roots -time | -constant -latestTime -newTimes -noZero -parallel -vtk -srcDoc -doc -help"
+_of_complete_cache_[lumpedPointMovement]="-case -max -scale -span | -removeLock -slave -srcDoc -doc -help"
+_of_complete_cache_[lumpedPointZones]="-case -region | -verbose -srcDoc -doc -help"
+_of_complete_cache_[magneticFoam]="-case -decomposeParDict -roots | -noB -noFunctionObjects -noH -parallel -srcDoc -doc -help"
+_of_complete_cache_[mapFields]="-case -mapMethod -sourceDecomposeParDict -sourceRegion -sourceTime -targetDecomposeParDict -targetRegion | -consistent -noFunctionObjects -parallelSource -parallelTarget -subtract -srcDoc -doc -help"
+_of_complete_cache_[mapFieldsPar]="-case -decomposeParDict -fields -mapMethod -patchMapMethod -roots -sourceRegion -sourceTime -targetRegion | -consistent -noFunctionObjects -noLagrangian -parallel -subtract -srcDoc -doc -help"
+_of_complete_cache_[mdEquilibrationFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[mdFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[mdInitialise]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[mergeMeshes]="-addRegion -case -decomposeParDict -masterRegion -roots | -noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
+_of_complete_cache_[mergeOrSplitBaffles]="-case -decomposeParDict -dict -region -roots | -detectOnly -noFunctionObjects -overwrite -parallel -split -srcDoc -doc -help"
+_of_complete_cache_[mhdFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[mirrorMesh]="-case -decomposeParDict -roots | -noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
+_of_complete_cache_[mixtureAdiabaticFlameT]="-case | -srcDoc -doc -help"
+_of_complete_cache_[modifyMesh]="-case -decomposeParDict -roots | -noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
+_of_complete_cache_[moveDynamicMesh]="-case -decomposeParDict -region -roots | -checkAMI -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[moveEngineMesh]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[moveMesh]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[MPPICDyMFoam]="-case -cloudName -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[MPPICFoam]="-case -cloud -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[MPPICInterFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[mshToFoam]="-case | -hex -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[multiphaseEulerFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[multiphaseInterDyMFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[multiphaseInterFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[netgenNeutralToFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[noise]="-case -decomposeParDict -dict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[nonNewtonianIcoFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[objToVTK]="-case | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[orientFaceZone]="-case -decomposeParDict -region -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[overInterDyMFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[overLaplacianDyMFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[overPimpleDyMFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[overRhoPimpleDyMFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[overSimpleFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[particleTracks]="-case -decomposeParDict -region -roots -time | -constant -latestTime -newTimes -noFunctionObjects -noZero -parallel -srcDoc -doc -help"
+_of_complete_cache_[patchSummary]="-case -decomposeParDict -region -roots -time | -constant -expand -latestTime -newTimes -noFunctionObjects -noZero -parallel -srcDoc -doc -help"
+_of_complete_cache_[pdfPlot]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[PDRFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[PDRMesh]="-case -decomposeParDict -roots | -noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
+_of_complete_cache_[pimpleDyMFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[pimpleFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[pisoFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[plot3dToFoam]="-case -scale | -noBlank -noFunctionObjects -singleBlock -srcDoc -doc -help"
+_of_complete_cache_[polyDualMesh]="-case | -concaveMultiCells -doNotPreserveFaceZones -noFunctionObjects -overwrite -splitAllFaces -srcDoc -doc -help"
+_of_complete_cache_[porousSimpleFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[postChannel]="-case -time | -constant -latestTime -newTimes -noFunctionObjects -noZero -srcDoc -doc -help"
+_of_complete_cache_[postProcess]="-case -decomposeParDict -dict -field -fields -func -funcs -region -roots -time | -constant -latestTime -list -newTimes -noFunctionObjects -noZero -parallel -profiling -srcDoc -doc -help"
+_of_complete_cache_[potentialFoam]="-case -decomposeParDict -pName -roots | -initialiseUBCs -noFunctionObjects -parallel -withFunctionObjects -writePhi -writep -srcDoc -doc -help"
+_of_complete_cache_[potentialFreeSurfaceDyMFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[potentialFreeSurfaceFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[reactingFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[reactingMultiphaseEulerFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[reactingParcelFilmFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[reactingParcelFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[reactingTwoPhaseEulerFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[reconstructPar]="-case -fields -lagrangianFields -region -time | -allRegions -constant -latestTime -newTimes -noFields -noFunctionObjects -noLagrangian -noSets -noZero -withZero -srcDoc -doc -help"
+_of_complete_cache_[reconstructParMesh]="-case -mergeTol -region -time | -cellDist -constant -fullMatch -latestTime -newTimes -noFunctionObjects -noZero -withZero -srcDoc -doc -help"
+_of_complete_cache_[redistributePar]="-case -decomposeParDict -mergeTol -region -roots -time | -cellDist -constant -decompose -latestTime -newTimes -noFunctionObjects -noZero -overwrite -parallel -reconstruct -withZero -srcDoc -doc -help"
+_of_complete_cache_[refineHexMesh]="-case -decomposeParDict -region -roots | -minSet -noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
+_of_complete_cache_[refinementLevel]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -readLevel -srcDoc -doc -help"
+_of_complete_cache_[refineMesh]="-case -decomposeParDict -dict -region -roots | -all -noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
+_of_complete_cache_[refineWallLayer]="-case -decomposeParDict -roots -useSet | -noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
+_of_complete_cache_[removeFaces]="-case -decomposeParDict -roots | -noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
+_of_complete_cache_[renumberMesh]="-case -decomposeParDict -dict -region -roots -time | -constant -frontWidth -latestTime -noFunctionObjects -noZero -overwrite -parallel -srcDoc -doc -help"
+_of_complete_cache_[rhoCentralDyMFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[rhoCentralFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[rhoPimpleAdiabaticFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[rhoPimpleDyMFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[rhoPimpleFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[rhoPorousSimpleFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[rhoReactingBuoyantFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[rhoReactingFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[rhoSimpleFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[rotateMesh]="-case -decomposeParDict -roots -time | -constant -latestTime -newTimes -noFunctionObjects -noZero -parallel -srcDoc -doc -help"
+_of_complete_cache_[scalarTransportFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[selectCells]="-case | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[setAlphaField]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[setFields]="-case -decomposeParDict -dict -region -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[setSet]="-batch -case -decomposeParDict -region -roots -time | -constant -latestTime -loop -newTimes -noFunctionObjects -noSync -noVTK -noZero -parallel -srcDoc -doc -help"
+_of_complete_cache_[setsToZones]="-case -decomposeParDict -region -roots -time | -constant -latestTime -newTimes -noFlipMap -noFunctionObjects -noZero -parallel -srcDoc -doc -help"
+_of_complete_cache_[shallowWaterFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[simpleCoalParcelFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[simpleFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[simpleReactingParcelFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[singleCellMesh]="-case -decomposeParDict -roots -time | -constant -latestTime -newTimes -noFunctionObjects -noZero -parallel -srcDoc -doc -help"
+_of_complete_cache_[smapToFoam]="-case | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[snappyHexMesh]="-case -decomposeParDict -dict -outFile -patches -region -roots -surfaceSimplify | -checkGeometry -noFunctionObjects -overwrite -parallel -profiling -srcDoc -doc -help"
+_of_complete_cache_[snappyRefineMesh]="-case | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[solidDisplacementFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[solidEquilibriumDisplacementFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[sonicDyMFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[sonicFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[sonicLiquidFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[splitCells]="-case -set -tol | -geometry -noFunctionObjects -overwrite -srcDoc -doc -help"
+_of_complete_cache_[splitMesh]="-case | -noFunctionObjects -overwrite -srcDoc -doc -help"
+_of_complete_cache_[splitMeshRegions]="-blockedFaces -case -cellZonesFileOnly -decomposeParDict -insidePoint -region -roots | -cellZones -cellZonesOnly -detectOnly -largestOnly -makeCellZones -noFunctionObjects -overwrite -parallel -prefixRegion -sloppyCellZones -useFaceZones -srcDoc -doc -help"
+_of_complete_cache_[sprayDyMFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[sprayEngineFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[sprayFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[SRFPimpleFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[SRFSimpleFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[star4ToFoam]="-case -scale | -ascii -noFunctionObjects -solids -srcDoc -doc -help"
+_of_complete_cache_[steadyParticleTracks]="-case -dict -region -time | -constant -latestTime -newTimes -noFunctionObjects -noZero -srcDoc -doc -help"
+_of_complete_cache_[stitchMesh]="-case -region -toleranceDict | -noFunctionObjects -overwrite -partial -perfect -srcDoc -doc -help"
+_of_complete_cache_[subsetMesh]="-case -decomposeParDict -patch -patches -region -resultTime -roots | -noFunctionObjects -overwrite -parallel -srcDoc -doc -help"
+_of_complete_cache_[surfaceAdd]="-case -points | -mergeRegions -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[surfaceBooleanFeatures]="-case -trim | -invertedSpace -noFunctionObjects -perturb -surf1Baffle -surf2Baffle -srcDoc -doc -help"
+_of_complete_cache_[surfaceCheck]="-case -outputThreshold | -blockMesh -checkSelfIntersection -noFunctionObjects -splitNonManifold -verbose -srcDoc -doc -help"
+_of_complete_cache_[surfaceClean]="-case | -noClean -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[surfaceCoarsen]="-case | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[surfaceConvert]="-case -scale -writePrecision | -clean -group -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[surfaceFeatureConvert]="-case -scale | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[surfaceFeatureExtract]="-case -dict | -srcDoc -doc -help"
+_of_complete_cache_[surfaceFind]="-case -x -y -z | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[surfaceHookUp]="-case -dict | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[surfaceInertia]="-case -density -referencePoint | -noFunctionObjects -shellProperties -srcDoc -doc -help"
+_of_complete_cache_[surfaceInflate]="-case -featureAngle -nSmooth | -checkSelfIntersection -debug -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[surfaceLambdaMuSmooth]="-featureFile | -srcDoc -doc -help"
+_of_complete_cache_[surfaceMeshConvert]="-case -dict -from -scaleIn -scaleOut -to | -clean -noFunctionObjects -tri -srcDoc -doc -help"
+_of_complete_cache_[surfaceMeshConvertTesting]="-case -scale | -clean -noFunctionObjects -orient -stdout -surfMesh -testModify -triFace -triSurface -unsorted -srcDoc -doc -help"
+_of_complete_cache_[surfaceMeshExport]="-case -dict -from -name -scaleIn -scaleOut -to | -clean -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[surfaceMeshImport]="-case -dict -from -name -scaleIn -scaleOut -to | -clean -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[surfaceMeshInfo]="-case -scale | -areas -noFunctionObjects -xml -srcDoc -doc -help"
+_of_complete_cache_[surfaceMeshTriangulate]="-case -decomposeParDict -faceZones -patches -region -roots -time | -constant -excludeProcPatches -latestTime -newTimes -noFunctionObjects -noZero -parallel -srcDoc -doc -help"
+_of_complete_cache_[surfaceOrient]="-case | -inside -noFunctionObjects -usePierceTest -srcDoc -doc -help"
+_of_complete_cache_[surfacePatch]="-case -dict | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[surfacePointMerge]="-case | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[surfaceRedistributePar]="-case -decomposeParDict -roots | -keepNonMapped -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[surfaceRefineRedGreen]="-case | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[surfaceSplitByPatch]="-case | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[surfaceSplitByTopology]=" | -srcDoc -doc -help"
+_of_complete_cache_[surfaceSplitNonManifolds]="-case | -debug -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[surfaceSubset]="-case | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[surfaceToPatch]="-case -faceSet -tol | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[surfaceTransformPoints]="-case -rollPitchYaw -rotate -scale -translate -yawPitchRoll | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[temporalInterpolate]="-case -decomposeParDict -divisions -fields -interpolationType -region -roots -time | -constant -latestTime -newTimes -noFunctionObjects -noZero -parallel -srcDoc -doc -help"
+_of_complete_cache_[tetgenToFoam]="-case -decomposeParDict -roots | -noFaceFile -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[thermoFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[topoSet]="-case -decomposeParDict -dict -region -roots -time | -constant -latestTime -newTimes -noFunctionObjects -noSync -noZero -parallel -srcDoc -doc -help"
+_of_complete_cache_[transformPoints]="-case -decomposeParDict -region -rollPitchYaw -roots -rotate -scale -translate -yawPitchRoll | -noFunctionObjects -parallel -rotateFields -srcDoc -doc -help"
+_of_complete_cache_[twoLiquidMixingFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[twoPhaseEulerFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[uncoupledKinematicParcelFoam]="-case -cloud -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[viewFactorsGen]="-case -decomposeParDict -region -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[vtkUnstructuredToFoam]="-case | -noFunctionObjects -srcDoc -doc -help"
+_of_complete_cache_[wallFunctionTable]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+_of_complete_cache_[writeMeshObj]="-case -cell -cellSet -decomposeParDict -face -faceSet -point -region -roots -time | -constant -latestTime -newTimes -noFunctionObjects -noZero -parallel -patchEdges -patchFaces -srcDoc -doc -help"
+_of_complete_cache_[XiDyMFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[XiFoam]="-case -decomposeParDict -roots | -noFunctionObjects -parallel -postProcess -srcDoc -doc -help"
+_of_complete_cache_[zipUpMesh]="-case -decomposeParDict -region -roots | -noFunctionObjects -parallel -srcDoc -doc -help"
+
+#------------------------------------------------------------------------------
diff --git a/etc/config.sh/unset b/etc/config.sh/unset
index 74eff071b64922bc79e10b5339541efccd8806a8..fe8b8f18e10267cf5121e0e22c26c3872ad2185d 100644
--- a/etc/config.sh/unset
+++ b/etc/config.sh/unset
@@ -181,16 +181,21 @@ unset -f wmRefresh  2>/dev/null
 unset -f foamVersion 2>/dev/null
 unset -f foamPV     2>/dev/null
 
-# Cleanup bash completions, which look like this:
-#     "complete ... -F _of_APPNAME APPNAME
-# For economy, obtain list first but also remove the 'of_complete_' backend
-foamClean="$(complete 2>/dev/null | sed -n -e 's/complete.*-F _of_.* \(..*\)$/\1/p')"
-for cleaned in $foamClean complete_
+# Remove old completions, which look like
+#     "complete ... -F _of_complete_ APPNAME
+# For economy, obtain list first
+foamOldDirs="$(complete 2>/dev/null | sed -ne 's/^.*-F _of_.* \(..*\)$/\1/p')"
+for cleaned in $foamOldDirs
 do
-    unset -f _of_$cleaned 2>/dev/null
-    complete -r $cleaned  2>/dev/null
+    complete -r $cleaned 2>/dev/null
 done
 
+# Completion functions
+unset -f foamAddCompletion 2>/dev/null
+unset -f _of_complete_  2>/dev/null
+
+# Completion cache
+unset _of_complete_cache_
 
 #------------------------------------------------------------------------------
 # Intermediate variables (do as last for a clean exit code)