fix: corregir renderizado de colores en prompts ask() y confirm()
read -rp no interpreta escapes ANSI — reemplazado por printf + read -r. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
c2cd1e4240
commit
1aa93ebba8
+6
-3
@@ -73,17 +73,20 @@ divider() { echo -e "\n ${B}─────────────────
|
|||||||
ask() {
|
ask() {
|
||||||
local prompt="$1" default="${2:-}" answer
|
local prompt="$1" default="${2:-}" answer
|
||||||
if [[ -n "$default" ]]; then
|
if [[ -n "$default" ]]; then
|
||||||
read -rp " ${W}$prompt${N} [$default]: " answer
|
printf " ${W}%s${N} [%s]: " "$prompt" "$default"
|
||||||
|
read -r answer
|
||||||
echo "${answer:-$default}"
|
echo "${answer:-$default}"
|
||||||
else
|
else
|
||||||
read -rp " ${W}$prompt${N}: " answer
|
printf " ${W}%s${N}: " "$prompt"
|
||||||
|
read -r answer
|
||||||
echo "$answer"
|
echo "$answer"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
confirm() {
|
confirm() {
|
||||||
local answer
|
local answer
|
||||||
read -rp " ${W}$* [s/N]:${N} " answer
|
printf " ${W}%s [s/N]:${N} " "$*"
|
||||||
|
read -r answer
|
||||||
[[ "${answer,,}" == "s" ]]
|
[[ "${answer,,}" == "s" ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user