* usr/share/byobu/profiles/bashrc, usr/share/man/man1/byobu-prompt.1:

- only display error code when non-zero
  - document behavior in manpage
This commit is contained in:
Dustin Kirkland 2013-09-21 09:38:07 -05:00
commit 68bfc41e75
3 changed files with 10 additions and 4 deletions

4
debian/changelog vendored
View file

@ -1,6 +1,8 @@
byobu (5.60) unreleased; urgency=low
* UNRELEASED
* usr/share/byobu/profiles/bashrc, usr/share/man/man1/byobu-prompt.1:
- only display error code when non-zero
- document behavior in manpage
-- Dustin Kirkland <kirkland@ubuntu.com> Thu, 19 Sep 2013 12:23:43 -0500

View file

@ -29,20 +29,21 @@ if [ -n "$TMUX" ] || [ "${TERMCAP#*screen}" != "${TERMCAP}" ]; then
"Ubuntu")
# Use Ubuntu colors (grey / aubergine / orange)
[ -n "$BYOBU_CHARMAP" ] || BYOBU_CHARMAP=$(locale charmap 2>/dev/null || echo)
PROMPT_COMMAND='prompt_status="$? "; if [[ $prompt_status == "0 " ]]; then prompt_status=; fi'
case "$BYOBU_CHARMAP" in
"UTF-8")
# MATHEMATICAL RIGHT DOUBLE ANGLE BRACKET (U+27EB, Pe): ⟫
PS1="${debian_chroot:+($debian_chroot)}\[\e[38;5;202m\]\$? \[\e[38;5;245m\]\u\[\e[00m\]@\[\e[38;5;5m\]\h\[\e[00m\]:\[\e[38;5;172m\]\w\[\e[00m\]⟫ "
PS1="${debian_chroot:+($debian_chroot)}\[\e[38;5;202m\]\$prompt_status\[\e[38;5;245m\]\u\[\e[00m\]@\[\e[38;5;5m\]\h\[\e[00m\]:\[\e[38;5;172m\]\w\[\e[00m\]⟫ "
;;
*)
# Simple ASCII greater-than sign
PS1="${debian_chroot:+($debian_chroot)}\[\e[38;5;202m\]\$? \[\e[38;5;245m\]\u\[\e[00m\]@\[\e[38;5;5m\]\h\[\e[00m\]:\[\e[38;5;172m\]\w\[\e[00m\]> "
PS1="${debian_chroot:+($debian_chroot)}\[\e[38;5;202m\]\$prompt_status\[\e[38;5;245m\]\u\[\e[00m\]@\[\e[38;5;5m\]\h\[\e[00m\]:\[\e[38;5;172m\]\w\[\e[00m\]> "
;;
esac
;;
*)
# Use Byobu colors (green / blue / red)
PS1="${debian_chroot:+($debian_chroot)}\[\e[31m\]\$? \[\e[00;32m\]\u\[\e[00m\]@\[\e[00;36m\]\h\[\e[00m\]:\[\e[00;31m\]\w\[\e[00m\]\$ "
PS1="${debian_chroot:+($debian_chroot)}\[\e[31m\]\$prompt_status\[\e[00;32m\]\u\[\e[00m\]@\[\e[00;36m\]\h\[\e[00m\]:\[\e[00;31m\]\w\[\e[00m\]\$ "
;;
esac
fi

View file

@ -10,6 +10,9 @@ byobu-prompt, byobu-enable-prompt, byobu-disable-prompt \- add and remove a nice
\fBbyobu-disable-prompt\fP
.SH DESCRIPTION
Byobu provides a special PS1 prompt command, compatible with Bash shells. It will display the previous command's exit code, if it's not zero. It will use 3 separate colors for the local username, hostname, and the current working directory.
\fBbyobu-enable-prompt\fP will add one line to your \fI~/.bashrc\fP.
You can safely remove the line from your \fI~/.bashrc\fP, which ends in \fB#byobu-prompt\fP.