Skip to content

Commit

Permalink
refactor: remove single use error_ functions
Browse files Browse the repository at this point in the history
  • Loading branch information
flexiondotorg committed Jul 2, 2024
1 parent 8cf007f commit 0440ce1
Showing 1 changed file with 13 additions and 21 deletions.
34 changes: 13 additions & 21 deletions quickget
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,6 @@ function error_specify_release() {
exit 1
}

function error_specify_edition() {
show_os_info "${OS}"
echo -e " - Editions:\t$("editions_${OS}" | fold -s -w "$(tput cols)")"
echo -e "\nERROR! You must specify an edition."
exit 1
}

function error_not_supported_release() {
if [[ ! "${RELEASES[*]}" =~ ${RELEASE} ]]; then
echo -e "ERROR! ${DISPLAY_NAME} ${RELEASE} is not a supported release.\n"
Expand All @@ -198,18 +191,6 @@ function error_not_supported_release() {
fi
}

function error_not_supported_edition() {
if [[ ! "${EDITIONS[*]}" = *"${EDITION}"* ]]; then
echo -e "ERROR! ${EDITION} is not a supported $(pretty_name "${OS}") edition\n"
echo -n ' - Supported editions: '
for EDITION in "${EDITIONS[@]}"; do
echo -n "${EDITION} "
done
echo ""
exit 1
fi
}

function error_not_supported_lang() {
echo -e "ERROR! ${I18N} is not a supported $(pretty_name "${OS}") language\n"
echo -n ' - Editions: '
Expand Down Expand Up @@ -3487,9 +3468,20 @@ if [ -n "${2}" ]; then
EDITIONS=("$(editions_"${OS}")")
if [ -n "${3}" ]; then
EDITION="${3}"
error_not_supported_edition
if [[ ! "${EDITIONS[*]}" = *"${EDITION}"* ]]; then
echo -e "ERROR! ${EDITION} is not a supported $(pretty_name "${OS}") edition\n"
echo -n ' - Supported editions: '
for EDITION in "${EDITIONS[@]}"; do
echo -n "${EDITION} "
done
echo ""
exit 1
fi
else
error_specify_edition
show_os_info "${OS}"
echo -e " - Editions:\t$("editions_${OS} | fmt -w 80")"
echo -e "\nERROR! You must specify an edition."
exit 1
fi
handle_missing
VM_PATH="${OS}-${RELEASE}-${EDITION}"
Expand Down

0 comments on commit 0440ce1

Please sign in to comment.