mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: reduce chance of false positives when generating bash completions
- only treat text as an option if it is preceded by 0-4 spaces. This prevents the description of an option from being accidentally detected as an option.
This commit is contained in:
@ -40,7 +40,7 @@ Usage: $Script [OPTION] <file>
|
||||
|
||||
* Create bash completions for OpenFOAM applications and write to <file>.
|
||||
By default searches directories \$FOAM_APPBIN and \$FOAM_USER_APPBIN
|
||||
|
||||
|
||||
|
||||
Options:
|
||||
-d | -directory Directory to process
|
||||
@ -149,10 +149,10 @@ do
|
||||
echo "Processing $appName"
|
||||
|
||||
# Options with args
|
||||
optsWithArgs=($(awk '/^ *-[a-z]/ && /</ {print $1}' <<< "$appHelp"))
|
||||
optsWithArgs=($(awk '/^ {0,4}-[a-z]/ && /</ {print $1}' <<< "$appHelp"))
|
||||
|
||||
# Options without args
|
||||
opts=($(awk '/^ *-[a-z]/ && !/</ {print $1}' <<< "$appHelp"))
|
||||
opts=($(awk '/^ {0,4}-[a-z]/ && !/</ {print $1}' <<< "$appHelp"))
|
||||
|
||||
cat<<WRITECOMPLETION >> $outFile
|
||||
unset -f _${appName}
|
||||
|
||||
Reference in New Issue
Block a user