Use TRUE/FALSE for typeless option values in --help. Update parse_options.sh lib in Bash tools.

This commit is contained in:
Daniel Nichter
2012-07-21 11:40:39 -06:00
parent 9723a297f6
commit e1b39b3d5f
6 changed files with 51 additions and 1 deletions

View File

@@ -121,6 +121,15 @@ usage_or_errors() {
for opt in $(ls "$PO_DIR"); do
local varname="OPT_$(echo "$opt" | tr a-z- A-Z_)"
local varvalue="${!varname}"
if ! grep -q "type:" "$PO_DIR/$opt" >/dev/null; then
# Typeless option, like --version, so it's given/TRUE
# or not given/FALSE.
if [ "$varvalue" -a "$varvalue" = "yes" ];
then varvalue="TRUE"
else
varvalue="FALSE"
fi
fi
printf -- " --%-30s %s" "$opt" "${varvalue:-(No value)}"
echo
done