mirror of
https://github.com/dustinkirkland/byobu
synced 2025-08-14 02:36:59 -07:00
drastically simplify the conditional logic
This commit is contained in:
parent
39e6bc7c6d
commit
26528f1998
2 changed files with 37 additions and 46 deletions
3
debian/changelog
vendored
3
debian/changelog
vendored
|
@ -2,8 +2,9 @@ byobu (6.5) unreleased; urgency=medium
|
|||
|
||||
* usr/share/byobu/profiles/bashrc:
|
||||
- drop debian chroot from wolfi ps1
|
||||
- drastically simplify the conditional logic
|
||||
|
||||
-- Dustin Kirkland <kirkland@ubuntu.com> Mon, 08 Jan 2024 21:31:05 -0600
|
||||
-- Dustin Kirkland <kirkland@ubuntu.com> Tue, 09 Jan 2024 07:22:34 -0600
|
||||
|
||||
byobu (6.4) released; urgency=medium
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# byobu's bashrc -- colorize the prompt
|
||||
# Copyright (C) 2014 Dustin Kirkland
|
||||
# Copyright (C) 2023 Dustin Kirkland
|
||||
# Copyright (C) 2023, 2024 Dustin Kirkland
|
||||
#
|
||||
# Authors: Dustin Kirkland <kirkland@byobu.org>
|
||||
#
|
||||
|
@ -23,19 +23,11 @@ case "$TERM" in
|
|||
export TERM="xterm-256color"
|
||||
;;
|
||||
esac
|
||||
if [ -n "$TMUX" ] || [ "${TERMCAP#*screen}" != "${TERMCAP}" ]; then
|
||||
# Ensure that we're in bash or ash, in a byobu environment
|
||||
if [ -n "$BYOBU_BACKEND" ] && [ -n "$BASH" ] || [ "$SHELL" = "/bin/ash" ]; then
|
||||
byobu_prompt_status() { local e=$?; [ $e != 0 ] && echo -e " $e "; }
|
||||
[ -n "$BYOBU_CHARMAP" ] || BYOBU_CHARMAP=$(locale charmap 2>/dev/null || echo)
|
||||
byobu_prompt_symbol() {
|
||||
if [ "$USER" = "root" ]; then
|
||||
printf "%s" "#";
|
||||
else
|
||||
printf "%s" "\$"
|
||||
fi
|
||||
}
|
||||
case "$BYOBU_DISTRO" in
|
||||
[ -n "$BYOBU_CHARMAP" ] || BYOBU_CHARMAP=$(locale charmap 2>/dev/null || echo)
|
||||
[ -z "$USER" ] && export USER=$(whoami)
|
||||
byobu_prompt_status() { local e=$?; [ $e != 0 ] && echo -e " $e "; }
|
||||
byobu_prompt_symbol() { [ "$USER" = "root" ] && printf "%s" "#" || printf "%s" "\$"; }
|
||||
case "$BYOBU_DISTRO" in
|
||||
"Ubuntu")
|
||||
# Use Ubuntu colors (grey / orange / aubergine)
|
||||
PS1="${debian_chroot:+($debian_chroot)}\[\e[38;5;202m\]\$(byobu_prompt_status)\[\e[38;5;245m\]\u\[\e[00m\]@\[\e[38;5;172m\]\h\[\e[00m\]:\[\e[38;5;5m\]\w\[\e[00m\]\$(byobu_prompt_symbol) "
|
||||
|
@ -64,6 +56,4 @@ if [ -n "$TMUX" ] || [ "${TERMCAP#*screen}" != "${TERMCAP}" ]; then
|
|||
# Use Googley colors (blue / red / yellow / blue / green / red )
|
||||
PS1="${debian_chroot:+($debian_chroot)}\[\e[31m\]\$(byobu_prompt_status)\[\e[38;5;69m\]\u\[\e[38;5;214m\]@\[\e[38;5;167m\]\h\[\e[38;5;214m\]:\[\e[38;5;71m\]\w\[\e[38;5;214m\]\$(byobu_prompt_symbol)\[\e[00m\] "
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
esac
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue