mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: adjust completion parser
- restrict to text between "^[Oo]ptions:" and "-help-full" to avoid potential issues when more text is introduced in the usage output.
This commit is contained in:
@ -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 }' \
|
||||
|
||||
Reference in New Issue
Block a user