Fix getopts error handling ...

This commit is contained in:
Alexandre Aubin 2024-06-29 19:21:08 +02:00
parent 1ab3a79d39
commit 3e1c9ebaf7

View file

@ -102,9 +102,9 @@ ynh_handle_getopts_args() {
getopts ":$getopts_parameters" parameter || true getopts ":$getopts_parameters" parameter || true
if [ "$parameter" = "?" ]; then if [ "$parameter" = "?" ]; then
ynh_die "Invalid argument: -${OPTARG:-}" ynh_die "Invalid argument: ${1:-}"
elif [ "$parameter" = ":" ]; then elif [ "$parameter" = ":" ]; then
ynh_die "-$OPTARG parameter requires an argument." ynh_die "${1:-} parameter requires an argument."
else else
local shift_value=1 local shift_value=1
# Use the long option, corresponding to the short option read by getopts, as a variable # Use the long option, corresponding to the short option read by getopts, as a variable