From c039075927f5b003765f02f8b51dddfc262ed13a Mon Sep 17 00:00:00 2001 From: steffen Date: Sat, 24 Jan 2026 14:16:49 +0000 Subject: [PATCH] Resolve hawolex git enable flag --- .context.json | 2 +- dotfiles/ps1/ps1.sh | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.context.json b/.context.json index 3a409ab..35d8dab 100644 --- a/.context.json +++ b/.context.json @@ -433,6 +433,6 @@ "Seasonal palettes and contest pack are now documented directly in main.", "README uses images/bash-pallete.png.", "Git capsule prefers __git_ps1 and falls back to git symbolic-ref/short hash when git-prompt is unavailable or returns empty.", - "Hawolex git capsule enables when PS1_GIT=1 or __PS1_GIT=1." + "Hawolex git capsule enables when PS1_GIT resolves to a truthy value (1/yes/true/on)." ] } diff --git a/dotfiles/ps1/ps1.sh b/dotfiles/ps1/ps1.sh index c3e5ed8..b04ba60 100644 --- a/dotfiles/ps1/ps1.sh +++ b/dotfiles/ps1/ps1.sh @@ -143,6 +143,15 @@ _ps1_holiday() { echo "$holiday" } +_ps1_git_enabled() { + _ps1_style_config + local v="${PS1_GIT:-0}" + case "$v" in + 1|y|Y|yes|YES|true|TRUE|on|ON) echo "1" ;; + *) echo "0" ;; + esac +} + # ---- Load Git prompt helper (best effort) ---- __try_source_git_prompt() { local candidates=( @@ -641,7 +650,7 @@ ${G_Z2_BG}${G_Z2_FG} ${HOST_PART}${PATH_SEP}${G_PATH_FG}${PATH_PART}${G_END_PAD} local H_LEFT_FG="\[\e[38;5;54m\]" local H_RIGHT_FG="\[\e[38;5;31m\]" local H_GIT="" - local H_GIT_ON="${PS1_GIT:-$__PS1_GIT}" + local H_GIT_ON="$(_ps1_git_enabled)" if [[ "$H_GIT_ON" == "1" ]]; then export GIT_PS1_SHOWDIRTYSTATE=1 export GIT_PS1_SHOWSTASHSTATE=1