fix installer arguments

This commit is contained in:
Niklas Gollenstede
2023-10-06 14:31:05 +02:00
parent e6dff14d73
commit 7bb3dc480f
3 changed files with 9 additions and 8 deletions

View File

@ -40,8 +40,8 @@ function generic-arg-help { # 1: name, 2?: args, 3?: description, 4?: suffix, 5?
# Entries in »allowedArgs« should have the form »[--name]="description"« for boolean flags, and »[--name=VAL]="description"« for string arguments.
# »description« is used by »generic-arg-help«. Boolean flags may only have the values »1« (as set by »generic-ags-parse« for flags without value) or be empty.
# »VAL« is purely nominal. Any argument passed that is not in »allowedArgs« raises an error.
function generic-arg-verify { # 1: exitCode
local exitCode=${1:-1}
function generic-arg-verify { # 1?: exitCode
local exitCode=${exitCode:-${1:-1}}
local names=' '"${!allowedArgs[@]}"
for name in "${!args[@]}" ; do
if [[ ${allowedArgs[--$name]:-} ]] ; then
@ -49,6 +49,7 @@ function generic-arg-verify { # 1: exitCode
echo "Argument »--$name« should be a boolean, but its value is: ${args[$name]}" 1>&2 ; \return $exitCode
fi
if [[ $names == *' --'"$name"'='* || $names == *' --'"$name"'[='* ]] ; then continue ; fi
if [[ ${undeclared:-} && $name =~ $undeclared ]] ; then continue ; fi
echo "Unexpected argument »--$name«.${allowedArgs[help]:+ Call with »--help« for a list of valid arguments.}" 1>&2 ; \return $exitCode
done
}