fix: Revert "feat(install.sh): handle installation directory prompt case-insensitively (#7138)

Revert "feat(install.sh): handle installation directory prompt responses case-insensitively (#6866)"

This reverts commit bc48b5fcb0.
This commit is contained in:
David Knaack
2025-12-17 19:57:01 +01:00
committed by GitHub
parent 056ab55dbb
commit d11bc8d586
+2 -29
View File
@@ -257,18 +257,12 @@ detect_target() {
printf '%s' "${target}"
}
set_interrupt_handler() {
trap 'echo; error "Interrupted (please re-run with the '--yes' option)"; exit 130' INT
}
confirm() {
if [ -z "${FORCE-}" ]; then
set_interrupt_handler
printf "%s " "${MAGENTA}?${NO_COLOR} $* ${BOLD}[y/N]${NO_COLOR}"
set +e
read -r yn </dev/tty
trap - INT
yn=$(echo "$yn" | tr '[:upper:]' '[:lower:]')
rc=$?
set -e
if [ $rc -ne 0 ]; then
@@ -276,29 +270,8 @@ confirm() {
exit 1
fi
if [ "$yn" != "y" ] && [ "$yn" != "yes" ]; then
if [ "$yn" = "n" ] || [ "$yn" = "no" ]; then
set_interrupt_handler
set +e
printf "Where would you like to install Starship? ${GREY}(e.g., /usr/local/bin)${NO_COLOR}\n"
read -p "> Install Starship ${GREEN}${VERSION}${NO_COLOR} to: " path
trap - INT
rc=$?
set -e
BIN_DIR=$path
if [ $rc != 0 ] || [ -z "$path" ]; then
if [ -z "$path" ]; then
echo
fi
error "Error reading from prompt (please re-run with '--yes' or provide path)"
exit 1
fi
else
if [ -z "$yn" ]; then
echo
fi
error 'Aborting (please answer "yes" to continue)'
exit 1
fi
error 'Aborting (please answer "yes" to continue)'
exit 1
fi
fi
}