Use "yes" for true, "" for false. Use $PO_DIR instead of $TMP_DIR/po. Add and test Baron's code for 'Options and values after processing arguments'. Make --help exit 0 unless there were errors.

This commit is contained in:
Daniel Nichter
2012-01-24 12:49:18 -07:00
parent 42a8e39635
commit c2fd3f54c2
5 changed files with 51 additions and 27 deletions

View File

@@ -91,12 +91,20 @@ usage_or_errors() {
echo
echo "Command line options:"
echo
for opt in $(ls $TMPDIR/po/); do
for opt in $(ls "$PO_DIR"); do
local desc=$(cat $TMPDIR/po/$opt | grep '^desc:' | sed -e 's/^desc://')
echo "--$opt"
echo " $desc"
echo
done
echo "Options and values after processing arguments:"
echo
for opt in $(ls "$PO_DIR"); do
local varname="OPT_$(echo "$opt" | tr a-z- A-Z_)"
local varvalue="${!varname}"
printf -- " --%-30s %s" "$opt" "${varvalue:-(No value)}"
echo
done
return 1
fi