From 77c62d575e0276ec1175e4e0d407083ce46daa90 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Sat, 2 Apr 2022 03:16:31 +0300 Subject: [PATCH] switch main menu to case code --- funkwhale-cli.sh | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/funkwhale-cli.sh b/funkwhale-cli.sh index 8955ede..10e2204 100755 --- a/funkwhale-cli.sh +++ b/funkwhale-cli.sh @@ -95,7 +95,8 @@ Exit='Exit' while true; do choice=$(echo "$downloadtrackspls\n$startplayer\n$podcasts\n$changepod\n$checkapilimits\n$Exit" | fzy) -if [ "$choice" = "$downloadtrackspls" ]; then +case "$choice" in + "$downloadtrackspls") echo 'Order by (prefix - is DESC ordering):' ordering=$(echo 'title\n-title\ncreation_date\n-creation_date\nrelease_date\n-release_date\nrandom' | fzy) export ordering @@ -107,14 +108,20 @@ if [ "$choice" = "$downloadtrackspls" ]; then export tag echo 'Enter page number: ' read page - load_tracks_to_playlist $page -elif [ "$choice" = "$startplayer" ]; then - $default_player_command playlist.m3u8 -elif [ "$choice" = "$podcasts" ]; then + load_tracks_to_playlist $page ;; + + + "$startplayer") + $default_player_command playlist.m3u8 ;; + + + "$podcasts") echo 'Enter page number: ' read page - funkwhale_get_podcasts_artists $page -elif [ "$choice" = "$changepod" ]; then + funkwhale_get_podcasts_artists $page ;; + + + "$changepod") if [ 'Choice from list' = "$(echo 'Choice from list\nManual input' | fzy)" ]; then instance=$(jj -l -i config.json public_list_instances | sed 's/"//g' | fzy) else @@ -131,10 +138,14 @@ elif [ "$choice" = "$changepod" ]; then echo '' fi clear - get_all_avalaible_count_tracks -elif [ "$choice" = "$checkapilimits" ]; then - funkwhale_api_check_api_limits | more -elif [ "$choice" = "$Exit" ]; then - exit 0 -fi + get_all_avalaible_count_tracks ;; + + + "$checkapilimits") + funkwhale_api_check_api_limits | more ;; + + + "$Exit") + exit 0 ;; +esac done