From 0ef02be28917667225f519f2b1fe91d952759560 Mon Sep 17 00:00:00 2001 From: vg Date: Sat, 28 Feb 2026 18:25:21 +0100 Subject: git-sync on dita --- gamechesttui | 97 +++++++++++++----------------------------------------------- 1 file changed, 20 insertions(+), 77 deletions(-) (limited to 'gamechesttui') diff --git a/gamechesttui b/gamechesttui index 9689f46..a5cbda1 100755 --- a/gamechesttui +++ b/gamechesttui @@ -1,89 +1,32 @@ -#!/bin/bash +#!/bin/bash -eu -set -e - -declare -a games - -GAME_INSTALLED=$(gamechest list | grep -i true | cut -d ":" -f 1 | cut -d " " -f 1) - -populate_games() -{ - for game in "${GAME_INSTALLED}"; do - games+=($game) - done -} - -choose_game() -{ - local choice_array=() - local shortcut_count=0 - for game in "${games[@]}"; do - shortcut_count=$(( $shortcut_count + 1 )) - choice_array+=( "$game" "[$shortcut_count] $game" ) - done - - local dialog_args=( - --stdout - --clear - --backtitle "Games selection" - --title "List of installed games" - #--default-item "${games[-1]}" - --menu "Choose one of the following game:" 0 0 0 - "${choice_array[@]}" - ) - - dialog "${dialog_args[@]}" -} - -populate_profiles() -{ - for profile in "dragoncat blackmoor calendros guest malice loudivine airi adetess"; do - profiles+=($profile) - done -} - -choose_profile() -{ - local choice_array=() - local shortcut_count=0 - for profile in "${profiles[@]}"; do - shortcut_count=$(( $shortcut_count + 1 )) - choice_array+=( "$profile" "[$shortcut_count] $profile" ) - done - - local dialog_args=( - --stdout - --clear - --backtitle "Profiles selection" - --title "List of avalaible profiles" - #--default-item "${profiles[-1]}" - --menu "Choose one of the following profile:" 0 0 0 - "${choice_array[@]}" - ) - - dialog "${dialog_args[@]}" -} +set -x +GAMESAVES_PATH="$(gamechest showconfig | jq -r .gamesaves_path)" main() { # Game - - populate_games - if [ ${#games[*]} -eq 0 ]; then echo "No game installed, bye."; exit 0; fi - if [ ${#games[*]} -eq 1 ]; then - game=${games[0]} - else - game=$(choose_game) + game="$(\ + gamechest list \ + | grep -i true \ + | cut -d ":" -f 1 \ + | cut -d " " -f 1 \ + | fzf-frecency gamechest-game \ + )" + if [ -z "$game" ]; then + # no game selected + exit 0 fi # Profile - populate_profiles - if [ ${#profiles[*]} -eq 0 ]; then echo "No profile available, bye."; exit 0; fi - if [ ${#profiles[*]} -eq 1 ]; then - profile=${profiles[0]} - else - profile=$(choose_profile) + profile="$(\ + yq -r '.profiles[].name' < "$GAMESAVES_PATH/profiles.yaml" \ + | fzf-frecency gamechest-profile \ + )" + if [ -z "$profile" ]; then + # no profile selected + exit 0 fi echo "Running $game with $profile profile" -- cgit v1.2.3