feat: display klipper repo in main menu

Signed-off-by: Dominik Willner th33xitus@gmail.com
This commit is contained in:
th33xitus
2022-04-26 20:23:17 +02:00
parent 8f2cf3b9a1
commit 1e57aa5d24
8 changed files with 78 additions and 49 deletions

View File

@@ -15,17 +15,17 @@ function main_ui(){
top_border
echo -e "| $(title_msg "~~~~~~~~~~~~~~~ [ Main Menu ] ~~~~~~~~~~~~~~~") |"
hr
echo -e "| 0) [Log-Upload] | Klipper: $(get_klipper_status)|"
echo -e "| | |"
echo -e "| 1) [Install] | |"
echo -e "| 2) [Update] | Moonraker: $(get_moonraker_status)|"
echo -e "| 3) [Remove] | |"
echo -e "| 4) [Advanced] | Mainsail: $(mainsail_status)|"
echo -e "| 5) [Backup] | Fluidd: $(fluidd_status)|"
echo -e "| | KlipperScreen: $(klipperscreen_status)|"
echo -e "| 6) [Settings] | Telegram Bot: $(get_telegram_bot_status)|"
echo -e "| | |"
echo -e "| $(print_kiauh_version)| Octoprint: $(octoprint_status)|"
echo -e "| 0) [Log-Upload] | Klipper: $(print_status "klipper")|"
echo -e "| | Repo: $(print_klipper_repo)|"
echo -e "| 1) [Install] | |"
echo -e "| 2) [Update] | Moonraker: $(print_status "moonraker")|"
echo -e "| 3) [Remove] | |"
echo -e "| 4) [Advanced] | Mainsail: $(print_status "mainsail")|"
echo -e "| 5) [Backup] | Fluidd: $(print_status "fluidd")|"
echo -e "| | KlipperScreen: $(print_status "klipperscreen")|"
echo -e "| 6) [Settings] | Telegram Bot: $(print_status "telegram_bot")|"
echo -e "| | |"
echo -e "| $(print_kiauh_version)| Octoprint: $(print_status "octoprint")|"
quit_footer
}
@@ -38,10 +38,39 @@ function get_kiauh_version(){
function print_kiauh_version(){
local version
version="$(printf "%-20s" "$(get_kiauh_version)")"
version="$(printf "%-18s" "$(get_kiauh_version)")"
echo "${cyan}${version}${white}"
}
function print_status(){
local status component="${1}"
status=$(get_"${component}"_status)
if [ "${status}" == "Not installed!" ]; then
status="${red}${status}${white}"
elif [ "${status}" == "Incomplete!" ]; then
status="${yellow}${status}${white}"
else
status="${green}${status}${white}"
fi
printf "%-28s" "${status}"
}
function print_klipper_repo(){
read_kiauh_ini
local repo klipper_status
klipper_status=$(get_klipper_status)
repo=$(echo ${custom_klipper_repo} | sed "s/https:\/\/github\.com\///" | sed "s/\.git$//")
repo="${repo^^}"
if [[ "${klipper_status}" == "Not installed!" ]]; then
repo="${red}-${white}"
elif [[ -n "${repo}" && "${repo}" != "KLIPPER3D/KLIPPER" ]]; then
repo="${cyan}custom${white}"
else
repo="${cyan}Klipper3d/klipper${white}"
fi
printf "%-28s" "${repo}"
}
function kiauh_update_dialog(){
[ ! "$(kiauh_update_avail)" == "true" ] && return
top_border