CONFIG: cleanup bash completions in unset

This commit is contained in:
Mark Olesen 2017-06-26 11:09:05 +02:00
parent d415bf77bf
commit 4971cedc2a
3 changed files with 13 additions and 0 deletions

View File

@ -97,6 +97,7 @@ done
cat << HEADER > $outFile
#----------------------------------*-sh-*--------------------------------------
# Bash completions for OpenFOAM applications
# Formatted as "complete ... -F _of_APPNAME APPNAME
unset -f _of_filter_opts 2>/dev/null
_of_filter_opts()

View File

@ -1,5 +1,6 @@
#----------------------------------*-sh-*--------------------------------------
# Bash completions for OpenFOAM applications
# Formatted as "complete ... -F _of_APPNAME APPNAME
unset -f _of_filter_opts 2>/dev/null
_of_filter_opts()

View File

@ -181,6 +181,17 @@ 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 add in 'filter_opts' helper
foamClean="$(complete 2>/dev/null | sed -n -e 's/complete.*-F _of_.* \(..*\)$/\1/p')"
for cleaned in $foamClean filter_opts
do
unset -f _of_$cleaned 2>/dev/null
complete -r $cleaned 2>/dev/null
done
#------------------------------------------------------------------------------
# Intermediate variables (do as last for a clean exit code)