mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-13 10:34:28 +05:00
feat: KIAUH v4.0.0 (#191)
This commit is contained in:
@@ -1,39 +1,52 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
#=======================================================================#
|
||||
# Copyright (C) 2020 - 2022 Dominik Willner <th33xitus@gmail.com> #
|
||||
# #
|
||||
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
||||
# https://github.com/th33xitus/kiauh #
|
||||
# #
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license #
|
||||
#=======================================================================#
|
||||
|
||||
set -e
|
||||
|
||||
#ui total width = 57 chars
|
||||
top_border(){
|
||||
function top_border() {
|
||||
echo -e "/=======================================================\\"
|
||||
}
|
||||
|
||||
bottom_border(){
|
||||
function bottom_border() {
|
||||
echo -e "\=======================================================/"
|
||||
}
|
||||
|
||||
blank_line(){
|
||||
function blank_line() {
|
||||
echo -e "| |"
|
||||
}
|
||||
|
||||
hr(){
|
||||
function hr() {
|
||||
echo -e "|-------------------------------------------------------|"
|
||||
}
|
||||
|
||||
quit_footer(){
|
||||
function quit_footer() {
|
||||
hr
|
||||
echo -e "| ${red}Q) Quit${default} |"
|
||||
echo -e "| ${red}Q) Quit${white} |"
|
||||
bottom_border
|
||||
}
|
||||
|
||||
back_footer(){
|
||||
function back_footer() {
|
||||
hr
|
||||
echo -e "| ${green}B) « Back${default} |"
|
||||
echo -e "| ${green}B) « Back${white} |"
|
||||
bottom_border
|
||||
}
|
||||
|
||||
back_help_footer(){
|
||||
function back_help_footer() {
|
||||
hr
|
||||
echo -e "| ${green}B) « Back${default} | ${yellow}H) Help [?]${default} |"
|
||||
echo -e "| ${green}B) « Back${white} | ${yellow}H) Help [?]${white} |"
|
||||
bottom_border
|
||||
}
|
||||
|
||||
print_header(){
|
||||
function print_header() {
|
||||
top_border
|
||||
echo -e "| $(title_msg "~~~~~~~~~~~~~~~~~ [ KIAUH ] ~~~~~~~~~~~~~~~~~") |"
|
||||
echo -e "| $(title_msg " Klipper Installation And Update Helper ") |"
|
||||
@@ -41,35 +54,17 @@ print_header(){
|
||||
bottom_border
|
||||
}
|
||||
|
||||
kiauh_update_msg(){
|
||||
top_border
|
||||
echo -e "|${green} New KIAUH update available! ${default}| "
|
||||
hr
|
||||
echo -e "|${green} View Changelog: https://git.io/JnmlX ${default}| "
|
||||
blank_line
|
||||
echo -e "|${yellow} It is recommended to keep KIAUH up to date. Updates ${default}| "
|
||||
echo -e "|${yellow} usually contain bugfixes, important changes or new ${default}| "
|
||||
echo -e "|${yellow} features. Please consider updating! ${default}| "
|
||||
bottom_border
|
||||
}
|
||||
|
||||
################################################################################
|
||||
#******************************************************************************#
|
||||
################################################################################
|
||||
### TODO: rework other menus to make use of the following functions too and make them more readable
|
||||
|
||||
do_action(){
|
||||
function do_action() {
|
||||
clear && print_header
|
||||
### $1 is the action the user wants to fire
|
||||
$1
|
||||
print_msg && clear_msg
|
||||
# print_msg && clear_msg
|
||||
### $2 is the menu the user usually gets directed back to after an action is completed
|
||||
$2
|
||||
}
|
||||
|
||||
deny_action(){
|
||||
function deny_action() {
|
||||
clear && print_header
|
||||
print_unkown_cmd
|
||||
print_msg && clear_msg
|
||||
print_error "Invalid command!"
|
||||
$1
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user