From 69dec73c6dbf4add17c9f82fe472b079121e7788 Mon Sep 17 00:00:00 2001 From: aclist <92275929+aclist@users.noreply.github.com> Date: Sun, 19 Jun 2022 12:14:17 +0900 Subject: [PATCH] Add extended debug options --- dztui.sh | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/dztui.sh b/dztui.sh index 94393bb..2a9a507 100644 --- a/dztui.sh +++ b/dztui.sh @@ -1,6 +1,6 @@ #!/bin/bash set -eo pipefail -version=0.6.0 +version=0.7.0 release_url="https://raw.githubusercontent.com/aclist/dztui/main/dztui.sh" aid=221100 game="dayz" @@ -359,6 +359,9 @@ menu(){ printf "f$separator Launch favorite\n" printf "l$separator List installed mods\n" printf "r$separator Refresh\n" + if [[ $debug -eq 1 ]]; then + printf "d$separator Debug options\n" + fi printf "q$separator Quit\n" printf "\n" } @@ -370,6 +373,33 @@ forced_exit(){ printf "\n" exit_msg } +list_mod_names(){ + cd $game_dir + for i in $(find * -maxdepth 1 -type l); do + awk -F"[=;]" -v var="$i" '{OFS="\t"}/name/ {a=$2}END{print var,a}' "$i"/meta.cpp \ + | sed 's/;$//g' + done | column -t -s$'\t' -o$'\t' | less +} +debug_options(){ + if [[ $debug -eq 1 ]]; then + while true; do + printf "\n" + printf "1$separator List human readable mod paths\n" + printf "q$separator Back\n" + printf "\n" + read -p "Selection: " option + if [[ $option == 1 ]]; then + list_mod_names + elif [[ $option == q ]]; then + return + else + : + fi + done + else + : + fi +} main(){ checks init_table @@ -389,6 +419,7 @@ main(){ r) init_table ;; f) launch_fav ;; l) list_mods ;; + d) debug_options;; q) exit_msg ;; *) : ;; esac