From 3c580866ed6119e7b3525ba40f019f7dd23b69ff Mon Sep 17 00:00:00 2001 From: JGH Date: Mon, 9 Feb 2026 12:48:30 +0000 Subject: [PATCH] Improve app input prompt logic in install.sh Enhance user prompt for application input with default handling and skip option. --- install.sh | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 3030474..c3c9539 100755 --- a/install.sh +++ b/install.sh @@ -25,10 +25,34 @@ ask_app() { local label="$1" local default="$2" local app + local first_run=true while true; do - read -rp "$label (default: $default): " app - app="${app:-$default}" + if [ "$first_run" = true ]; then + # First run: show the prompt with default + read -rp "$label (default: $default): " app + first_run=false + else + # Subsequent runs: show a simpler prompt + read -rp "Enter a different command or 'skip' to continue anyway: " app + fi + + # Handle empty input (use default on first run, empty on subsequent runs) + if [ -z "$app" ]; then + if [ "$first_run" = false ]; then + # User pressed Enter on retry - ask if they want to skip + echo " Press Enter again to skip, or type 'skip'" + continue + fi + app="$default" + fi + + # Allow user to skip validation + if [ "$app" = "skip" ]; then + echo " Using '$default' (not verified)" + echo "$default" + return + fi # check if command exists if command -v "${app%% *}" >/dev/null 2>&1; then @@ -36,7 +60,10 @@ ask_app() { return else echo "✗ '$app' not found in PATH" - echo " install it first or choose another" + if [ "$first_run" = true ]; then + echo " Install it with: sudo pacman -S ${app%% *}" + echo " Or choose a different application" + fi fi done } @@ -205,4 +232,4 @@ if [ "$WM" = "sway" ]; then echo "Make sure to log out and select Sway from your display manager" else echo "For i3, reload with: Super + Shift + C" -fi \ No newline at end of file +fi