Skip to content
Snippets Groups Projects
Commit bf88d4ec authored by Mark OLESEN's avatar Mark OLESEN
Browse files

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.
parent 951fbb65
Branches
Tags
No related merge requests found
......@@ -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}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment