Skip to content

Commit

Permalink
Merge pull request #205 from tegonal/improve/askYesOrNo-allow-yes-and-no
Browse files Browse the repository at this point in the history
allow `yes` and `no` as answer for askYesOrNo questions
  • Loading branch information
robstoll authored Oct 18, 2024
2 parents 8e7f2c8 + d1eaaf3 commit 1b2b813
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utility/ask.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ function askYesOrNo() {

# shellcheck disable=SC2059 # the question itself can have %s thus we use it in the format string
askWithTimeout "\033[0;36m$question\033[0m y/[n]:" "$askYesOrNo_timeout" askYesOrNo_noAnswerCallback answer "" "$@"
if [[ $answer == y ]] || [[ $answer == Y ]]; then
if [[ $answer == y ]] || [[ $answer == Y ]] || [[ $answer == yes ]]; then
return 0
elif [[ $answer == n ]] || [[ $answer == N ]]; then
elif [[ $answer == n ]] || [[ $answer == N ]] || [[ $answer == no ]]; then
return 1
else
logWarning "got \033[0;36m%s\033[0m as answer (instead of y for yes or n for no), interpreting it as a n, i.e. as a no" "$answer"
Expand Down

0 comments on commit 1b2b813

Please sign in to comment.