From f5ba62c0586982a0ad826ddd6b52add27398fe9d Mon Sep 17 00:00:00 2001 From: Liam <33645555+lj3954@users.noreply.github.com> Date: Sat, 1 Feb 2025 08:39:48 -0600 Subject: [PATCH] fix: Correctly throw errors when an invalid option is passed (#1560) * fix: Correctly throw errors when a parameter is not fully matched --- quickget | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/quickget b/quickget index 0e27ff2..6aa3839 100755 --- a/quickget +++ b/quickget @@ -45,7 +45,7 @@ function error_specify_os() { } function os_supported() { - if [[ ! "$(os_support)" =~ ${OS} ]]; then + if [[ ! " $(os_support) " =~ \ "${OS}"\ ]]; then echo -e "ERROR! ${OS} is not a supported OS.\n" os_support | fmt -w 80 exit 1 @@ -59,7 +59,7 @@ function error_specify_release() { } function error_not_supported_release() { - if [[ ! "${RELEASES[*]}" =~ ${RELEASE} ]]; then + if [[ ! " ${RELEASES[*]} " =~ \ "${RELEASE}"\ ]]; then echo -e "ERROR! ${DISPLAY_NAME} ${RELEASE} is not a supported release.\n" echo -n ' - Supported releases: ' releases_ @@ -83,6 +83,17 @@ function error_not_supported_argument() { exit 1 } +function is_valid_language() { + local I18N="" + local PASSED_I18N="${1}" + for I18N in "${I18NS[@]}"; do + if [[ "${I18N}" == "${PASSED_I18N}" ]]; then + return 0 + fi + done + return 1 +} + function handle_missing() { # Handle odd missing Fedora combinations case "${OS}" in