From dad456eac9d53c88d1ea90a0d3f77c2836a804fd Mon Sep 17 00:00:00 2001 From: ksyasuda Date: Mon, 31 Jan 2022 22:47:06 -0800 Subject: [PATCH] better error handling for command-line quality selection --- aniwrapper | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/aniwrapper b/aniwrapper index a067c36..28838f1 100755 --- a/aniwrapper +++ b/aniwrapper @@ -103,8 +103,14 @@ get_quality() { -sep '|' -only-match <<< "$QUALITIES") QUALITY=$(awk '{print $2}' <<< "$selection") else - printf "%s" "Enter quality [$QUALITIES]: " + qualities="best|1080p|720p|480p|360p|worst" + printf "%s" "Choose quality: [$qualities]: " read -r QUALITY + while [[ ! "$QUALITY" =~ ($qualities) ]]; do + lg "$QUALITY not a valid quality -> [$qualities]" + printf "%s" "Choose quality: [$qualities]: " + read -r QUALITY + done fi lg "selected quality: $QUALITY" }