Add cancel/back options to all user input prompts

Changes:
- Added "0) Cancel" option to all menu prompts
- Added "(or 0 to cancel)" to all text input prompts
- Ensures users can back out of any operation at any time
- Scripts affected:
  - website-error-analyzer.sh (scope selection, time range)
  - 500-error-tracker.sh (time range selection)
  - wordpress-cron-manager.sh (all domain/user input prompts, status checks)

User Experience Improvements:
- No more being trapped in prompts
- Clear cancel instructions on every input
- Consistent "Operation cancelled" messaging
- Proper exit codes (0 for user cancellation)

Tested:
✓ website-error-analyzer.sh - cancel on scope selection
✓ 500-error-tracker.sh - cancel on time selection
✓ wordpress-cron-manager.sh - cancel on domain/user input
✓ All cancellations return cleanly to menu

https://claude.com/claude-code
This commit is contained in:
cschantz
2025-11-07 17:42:11 -05:00
parent 4e169f2c4d
commit 253bdc4229
3 changed files with 69 additions and 22 deletions
+26 -3
View File
@@ -47,26 +47,42 @@ echo -e "${CYAN}Analysis Scope:${NC}"
echo " 1) All users/domains (default)"
echo " 2) Specific cPanel user"
echo " 3) Specific domain"
echo " 0) Cancel and return to menu"
echo ""
read -p "Select option [1]: " scope_choice
scope_choice=${scope_choice:-1}
case $scope_choice in
0)
echo ""
echo "Analysis cancelled."
echo ""
exit 0
;;
2)
# Select specific user
select_user_interactive "Select cPanel user to analyze"
if [ -n "$SELECTED_USER" ]; then
FILTER_USER="$SELECTED_USER"
echo "→ Filtering for user: $FILTER_USER"
else
echo ""
echo "No user selected. Analysis cancelled."
echo ""
exit 0
fi
;;
3)
# Enter specific domain
echo ""
read -p "Enter domain name (e.g., example.com): " FILTER_DOMAIN
if [ -n "$FILTER_DOMAIN" ]; then
echo "→ Filtering for domain: $FILTER_DOMAIN"
read -p "Enter domain name (e.g., example.com) or 0 to cancel: " FILTER_DOMAIN
if [ "$FILTER_DOMAIN" = "0" ] || [ -z "$FILTER_DOMAIN" ]; then
echo ""
echo "Analysis cancelled."
echo ""
exit 0
fi
echo "→ Filtering for domain: $FILTER_DOMAIN"
;;
*)
echo "→ Analyzing all users/domains"
@@ -82,11 +98,18 @@ echo " 2) Last 6 hours"
echo " 3) Last 24 hours (default)"
echo " 4) Last 7 days"
echo " 5) Last 30 days"
echo " 0) Cancel and return to menu"
echo ""
read -p "Select option [3]: " time_choice
time_choice=${time_choice:-3}
case $time_choice in
0)
echo ""
echo "Analysis cancelled."
echo ""
exit 0
;;
1) HOURS_TO_ANALYZE=1 ;;
2) HOURS_TO_ANALYZE=6 ;;
3) HOURS_TO_ANALYZE=24 ;;