refactor(kiauh.sh): no global confirm / error message anymore

Signed-off-by: Dominik Willner th33xitus@gmail.com
This commit is contained in:
th33xitus
2022-03-19 19:22:15 +01:00
parent 5a4866d821
commit d82f6f9b5f
2 changed files with 9 additions and 12 deletions

View File

@@ -118,23 +118,21 @@ print_msg(){
}
print_error(){
[ -z "${ERROR_MSG}" ] && return
[ -z "${1}" ] && return
echo -e "${red}"
echo -e "#########################################################"
echo -e " ${ERROR_MSG} "
echo -e " ${1} "
echo -e "#########################################################"
echo -e "${white}"
unset ERROR_MSG
}
print_confirm(){
[ -z "${CONFIRM_MSG}" ] && return
[ -z "${1}" ] && return
echo -e "${green}"
echo -e "#########################################################"
echo -e " ${CONFIRM_MSG} "
echo -e " ${1} "
echo -e "#########################################################"
echo -e "${white}"
unset CONFIRM_MSG
}
clear_msg(){

View File

@@ -153,12 +153,11 @@ function klipper_setup(){
### confirm message
if [[ ${instances} -eq 1 ]]; then
CONFIRM_MSG="Klipper has been set up!"
local confirm="Klipper has been set up!"
elif [[ ${instances} -gt 1 ]]; then
CONFIRM_MSG="${instances} Klipper instances have been set up!"
local confirm="${instances} Klipper instances have been set up!"
fi
export CONFIRM_MSG
print_confirm && return
print_confirm "${confirm}" && return
}
function write_klipper_service(){
@@ -305,8 +304,8 @@ function remove_klipper(){
remove_klipper_dir
remove_klipper_env
CONFIRM_MSG=" Klipper was successfully removed!" && print_confirm
export CONFIRM_MSG
local confirm="Klipper was successfully removed!"
print_confirm "${confirm}" && return
}
#================================================#