diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2025-10-04 17:52:34 +0200 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2025-10-04 17:54:50 +0200 |
| commit | b15a51d3f2be594f648baf62aeda0c442cdd1784 (patch) | |
| tree | 9d0c7f3446125ae8610d29da7d78d4ff11b1fcd7 /.bash_prompt | |
| parent | 22e0f29bfa01b14780050f23612107d6f4350f76 (diff) | |
| download | dotfiles-b15a51d3f2be594f648baf62aeda0c442cdd1784.tar.xz | |
"Namespace" PS1 functions for less-than-dumb terminals
Diffstat (limited to '.bash_prompt')
| -rw-r--r-- | .bash_prompt | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/.bash_prompt b/.bash_prompt index 2ac3151..0d7f46b 100644 --- a/.bash_prompt +++ b/.bash_prompt @@ -118,15 +118,6 @@ __fontify () __end-nonprinting } -__set-prompt () -{ - BUILDING_PS=t - - PS1="$(__write-context)\n$(__fontify '\$' dim) " - - unset BUILDING_PS -} - __current-column () { # Cf. console_codes(4) § ECMA-48 Status Report Commands @@ -185,7 +176,16 @@ __write-context () fi } -__refresh-terminal () +__smart-term/set-ps1 () +{ + BUILDING_PS=t + + PS1="$(__write-context)\n$(__fontify '\$' dim) " + + unset BUILDING_PS +} + +__smart-term/refresh () { local last_status=$? @@ -204,10 +204,10 @@ __refresh-terminal () __draw-rule dim fi - __set-prompt + __smart-term/set-ps1 } -__init-smart () +__smart-term/init () { ### Prompts. @@ -220,7 +220,7 @@ __init-smart () PS1_SHOWGITSTATUS=t fi - PROMPT_COMMAND=__refresh-terminal + PROMPT_COMMAND=__smart-term/refresh PS2=$( BUILDING_PS=t @@ -244,5 +244,5 @@ then PS1='$? \u:\w\$ ' PS2='> ' else - __init-smart + __smart-term/init fi |
