feat: os_supported_edition function

This commit is contained in:
Martin Wimpress 2024-04-16 14:12:43 +01:00
commit bf8fa84c4f
No known key found for this signature in database
GPG Key ID: 61DF940515E06DA3
1 changed files with 13 additions and 7 deletions

View File

@ -3662,6 +3662,18 @@ fi
LANGS=() LANGS=()
os_supported_edition() {
if [[ ! " ${EDITIONS[*]} " =~ " ${EDITION} " ]]; then
echo -e "ERROR! ${EDITION} is not a supported $(pretty_name "${OS}") edition\n"
echo -n ' - Editions: '
for EDITION in "${EDITIONS[@]}"; do
echo -n "${EDITION} "
done
echo ""
exit 1
fi
}
os_error_edition() { os_error_edition() {
echo -en "ERROR! You must specify an edition.\n - Editions: " echo -en "ERROR! You must specify an edition.\n - Editions: "
#TODO ERROR here #TODO ERROR here
@ -3810,13 +3822,7 @@ if [ -n "${2}" ]; then
EDITION=${EDITIONS[0]} EDITION=${EDITIONS[0]}
if [ -n "${3}" ]; then if [ -n "${3}" ]; then
EDITION="${3}" EDITION="${3}"
if [[ ! " ${EDITIONS[*]} " =~ " ${EDITION} " ]]; then os_supported_edition
echo -e "ERROR! ${EDITION} is not a supported $(pretty_name "${OS}") edition:\n"
for EDITION in "${EDITIONS[@]}"; do
echo -n "${EDITION} "
done
exit 1
fi
else else
os_error_edition os_error_edition
fi fi