summaryrefslogtreecommitdiff
path: root/.bash_prompt
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2025-10-04 18:10:59 +0200
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2025-10-04 18:10:59 +0200
commit6313738906f760f8a9b73cfe18dc2593bee1b4c5 (patch)
tree6f07e3d62dfb992fe737d574a1132eadfd640b35 /.bash_prompt
parentb15a51d3f2be594f648baf62aeda0c442cdd1784 (diff)
downloaddotfiles-6313738906f760f8a9b73cfe18dc2593bee1b4c5.tar.xz
Adjust prompt for M-x shell
Diffstat (limited to '.bash_prompt')
-rw-r--r--.bash_prompt30
1 files changed, 23 insertions, 7 deletions
diff --git a/.bash_prompt b/.bash_prompt
index 0d7f46b..97297d4 100644
--- a/.bash_prompt
+++ b/.bash_prompt
@@ -238,11 +238,27 @@ __smart-term/init ()
fi
}
+__dumb-term/set-ps1 ()
+{
+ local -ir rc=$?
+
+ BUILDING_PS=t
+
+ PS1=''
+ ((rc)) && PS1+=$(__fontify "${rc} " bold red)
+ PS1+='\W\$ '
+
+ unset BUILDING_PS
+}
+
+__dumb-term/init ()
+{
+ PROMPT_COMMAND=__dumb-term/set-ps1
+}
+
-if [ "${TERM}" = dumb ]
-then
- PS1='$? \u:\w\$ '
- PS2='> '
-else
- __smart-term/init
-fi
+case "${TERM}"
+in
+ dumb) __dumb-term/init ;;
+ *) __smart-term/init ;;
+esac