refactor: remove single use error_ functions
This commit is contained in:
parent
8cf007f8eb
commit
0440ce149b
34
quickget
34
quickget
|
@ -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"
|
||||
|
@ -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: '
|
||||
|
@ -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}"
|
||||
|
|
Loading…
Reference in New Issue