add error checking to playlist mode

This commit is contained in:
ksyasuda 2021-11-08 00:55:36 -08:00
parent fd83a8c4a4
commit 6a1bfe1183

View File

@ -60,6 +60,7 @@ elif [[ "$selection" == "4." ]]; then
choice=$(printf "%s\n" "${options[@]}" | choice=$(printf "%s\n" "${options[@]}" |
rofi -dmenu -sep '|' \ rofi -dmenu -sep '|' \
-config "$CFG_DIR/$CFG_FILE" -l 4 -i -p "Enter choice:") -config "$CFG_DIR/$CFG_FILE" -l 4 -i -p "Enter choice:")
[ -z "$choice" ] && seppuku "No choice selected"
[ "$choice" == "5. Quit" ] && quit [ "$choice" == "5. Quit" ] && quit
selection=$(printf "%s\n" "$choice" | awk '{ print $1 }') selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
if [[ "$selection" == "1." ]]; then if [[ "$selection" == "1." ]]; then
@ -70,6 +71,7 @@ elif [[ "$selection" == "4." ]]; then
choice=$(printf "%s\n" "${options[@]}" | choice=$(printf "%s\n" "${options[@]}" |
rofi -dmenu -sep '|' \ rofi -dmenu -sep '|' \
-config "$CFG_DIR/$CFG_FILE" -l 4 -i -p "Enter choice:") -config "$CFG_DIR/$CFG_FILE" -l 4 -i -p "Enter choice:")
[ -z "$choice" ] && seppuku "No choice selected"
[ "$choice" == "5. Quit" ] && quit [ "$choice" == "5. Quit" ] && quit
selection=$(printf "%s\n" "$choice" | awk '{ print $1 }') selection=$(printf "%s\n" "$choice" | awk '{ print $1 }')
if [[ "$selection" == "1." ]]; then if [[ "$selection" == "1." ]]; then
@ -81,6 +83,7 @@ elif [[ "$selection" == "4." ]]; then
choice=$(find "$PLAYLIST_DIR" -type d | choice=$(find "$PLAYLIST_DIR" -type d |
rofi -dmenu \ rofi -dmenu \
-config "$CFG_DIR/$CFG_FILE" -l 5 -i -p "Choose playlist:") -config "$CFG_DIR/$CFG_FILE" -l 5 -i -p "Choose playlist:")
[ -z "$choice" ] && seppuku "No choice selected"
[ -z "$choice" ] && [ -z "$choice" ] &&
run -P "$PLAYLIST_DIR/$choice" run -P "$PLAYLIST_DIR/$choice"
elif [[ "$selection" == "2." ]]; then elif [[ "$selection" == "2." ]]; then