o: strip ANSI escapes on dumb terminals
Detect TERM=dumb or non-tty stdout and use plain '> ' prompt instead of bold ANSI escape sequences.
This commit is contained in:
parent
765e8b9d05
commit
a3dfbcefc1
|
|
@ -29,6 +29,12 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
# ── Terminal capability ──────────────────────────────────────────
|
||||
USE_COLOR=true
|
||||
if [[ "${TERM:-dumb}" == "dumb" ]] || [[ ! -t 1 ]]; then
|
||||
USE_COLOR=false
|
||||
fi
|
||||
|
||||
# ── Globals set by dispatch ─────────────────────────────────────
|
||||
PREFIX="" # Path prefix based on context
|
||||
CTX_SESSION="" # Session name if in session/agent context
|
||||
|
|
@ -194,7 +200,11 @@ cmd_prompt() {
|
|||
while true; do
|
||||
local prompt_str
|
||||
if [[ -z "$buf" ]]; then
|
||||
prompt_str=$'\033[1m>\033[0m '
|
||||
if $USE_COLOR; then
|
||||
prompt_str=$'\033[1m>\033[0m '
|
||||
else
|
||||
prompt_str='> '
|
||||
fi
|
||||
else
|
||||
prompt_str=" "
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in New Issue