diff --git a/bin/tools/foamCreateCompletionCache b/bin/tools/foamCreateCompletionCache index 0e1e81bf1e9e2da3de744faebbd7fc91288f519f..f6c23e30e9a25e36e1f65483813dd74500061172 100755 --- a/bin/tools/foamCreateCompletionCache +++ b/bin/tools/foamCreateCompletionCache @@ -147,7 +147,8 @@ HEADER # -hostRoots Advanced distributed run option # -roots Advanced distributed run option # -# Terminate parsing on first appearance of -help-full. +# Begin parsing after first appearance of "^[Oo]ptions:" +# Terminate parsing on first appearance of "-help-full" # - options with '=' (eg, -mode=ugo) are not handled very well at all. # - alternatives (eg, -a, -all) are not handled nicely either, # for these treat ',' like a space to catch the worst of them. @@ -155,7 +156,8 @@ extractOptions() { local appName="$1" local helpText=$($appName -help-full 2>/dev/null | \ - sed -ne 's/^ *//; /^$/d; /^[^-]/d; /^--/d; /^-help-man/d;' \ + sed -ne '1,/^[Oo]ptions:/d' \ + -e 's/^ *//; /^$/d; /^[^-]/d; /^--/d; /^-help-man/d;' \ -e '/^-hostRoots /d; /^-roots /d;' \ -e 'y/,/ /; s/=.*$/=/;' \ -e '/^-[^ ]* </{ s/^\(-[^ ]* <\).*$/\1/; p; d }' \ diff --git a/etc/config.sh/bash_completion b/etc/config.sh/bash_completion index 5fb8b874c9e8b016fb0fc692841c5bec5fbc0196..9807865f532a82017815e32ef73af543a771db14 100644 --- a/etc/config.sh/bash_completion +++ b/etc/config.sh/bash_completion @@ -139,14 +139,16 @@ _of_complete_() # -opt2 <arg> descrip # -help-full # Ignore -help-man (internal option). - # Terminate parsing on first appearance of -help-full + # Begin parsing after first appearance of "^[Oo]ptions:" + # Terminate parsing on first appearance of "-help-full" # - options with '=' (eg, -mode=ugo) are not handled very well at all. # - alternatives (eg, -a, -all) are not handled nicely either, # for these treat ',' like a space to catch the worst of them. if [ -z "$choices" ] then local helpText=$($appName -help-full 2>/dev/null | \ - sed -ne 's/^ *//; /^$/d; /^[^-]/d; /^--/d; /^-help-man/d;' \ + sed -ne '1,/^[Oo]ptions:/d' \ + -e 's/^ *//; /^$/d; /^[^-]/d; /^--/d; /^-help-man/d;' \ -e 'y/,/ /; s/=.*$/=/;' \ -e '/^-[^ ]* </{ s/^\(-[^ ]* <\).*$/\1/; p; d }' \ -e 's/^\(-[^ ]*\).*$/\1/; p; /^-help-full/q;' \ diff --git a/src/OpenFOAM/global/argList/argListHelp.C b/src/OpenFOAM/global/argList/argListHelp.C index 35ced1a0ea1daa7b670b55873ba8ce267dcd0caa..f585afa225f49987cc00201e66a2d899aa2f4c57 100644 --- a/src/OpenFOAM/global/argList/argListHelp.C +++ b/src/OpenFOAM/global/argList/argListHelp.C @@ -318,8 +318,9 @@ void Foam::argList::printUsage(bool full) const Info<< ']'; } } + Info<< nl; - Info<< "\noptions:\n"; + Info<< "Options:\n"; for (const word& optName : validOptions.sortedToc()) {