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:
Mark Olesen
2017-06-12 14:58:13 +02:00
parent 951fbb6575
commit bf88d4ec99

View File

@ -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}