Skip to content

Commit

Permalink
fix: Correctly throw errors when an invalid option is passed (quickem…
Browse files Browse the repository at this point in the history
…u-project#1560)

* fix: Correctly throw errors when a parameter is not fully matched
  • Loading branch information
lj3954 authored and zen0bit committed Feb 14, 2025
1 parent 9d8ea84 commit f5ba62c
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions quickget
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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_
Expand All @@ -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
Expand Down

0 comments on commit f5ba62c

Please sign in to comment.