diff --git a/data/scripts/o b/data/scripts/o index dbeeb38..e0f33bc 100755 --- a/data/scripts/o +++ b/data/scripts/o @@ -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