Specifically assign 0 when not provider passed in

This commit is contained in:
climberomes
2025-12-21 00:06:11 -08:00
parent 206e23213a
commit 1d2a22397e

View File

@@ -425,12 +425,13 @@ function _prompt_install_feature() {
$function
fi
elif [ "$opt" == "pv_option" ]; then
local opt_value=${!opt}
# Skip silently if not requested (opt_value is 0)
# pv_option has multiple options and is not a normal binary flag [enabled(1)/disabled(0)].
# We must evaluate the input flag and its value in this block
local opt_value=${!opt:-0} # Default to zero if somehow pv_option is still assigned as to null.
if [ "$opt_value" == 0 ]; then
echo "(Skipped)"
echo "(Skipped)" # Skip if VPN Provider not selected / assigned
else
# Iterate over the VPN provider options
# Iterate over the defined VPN providers by pulling the valid providers from the config file
local valid_ids=($(jq -r '.providers[].id' "$webroot_dir/config/vpn-providers.json"))
local found=0
for id in "${valid_ids[@]}"; do
@@ -440,14 +441,14 @@ function _prompt_install_feature() {
fi
done
if [ $found == 1 ]; then
echo -e
echo -e # Newline for UI / clean output
$function
else
_install_status 1 "Invalid VPN provider ID $opt_value - (Skipped)"
fi
fi
elif [ "${!opt}" == 1 ]; then
echo -e
echo -e # Newline for UI / clean output
$function
else
echo "(Skipped)"