Skip to content

Commit

Permalink
Standardize confirm_continue function
Browse files Browse the repository at this point in the history
  • Loading branch information
ejsears committed Dec 13, 2024
1 parent 8484ee4 commit 0c32b1c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions include/menus.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ prompt_boolean() {
}

confirm_continue() {
# Function to prompt the user to press Y or y to continue.
# Exits the script if the user does not press Y or y.
# Function to prompt the user to press Y, y, or Enter to continue.
# Exits the script if the user does not press Y, y, or Enter.

read -p " Do you want to continue? (Y/y to continue): " -n 1 -r
read -p " Do you want to continue? (Y/n): " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
if [[ -z $REPLY || $REPLY =~ ^[Yy]$ ]]; then
return
else
print_msg ERROR " Operation aborted."
exit 1
fi
Expand Down

0 comments on commit 0c32b1c

Please sign in to comment.