From 68bfc41e757a012df16912e78e36338a42b46525 Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Sat, 21 Sep 2013 09:38:07 -0500 Subject: [PATCH] * usr/share/byobu/profiles/bashrc, usr/share/man/man1/byobu-prompt.1: - only display error code when non-zero - document behavior in manpage --- debian/changelog | 4 +++- usr/share/byobu/profiles/bashrc | 7 ++++--- usr/share/man/man1/byobu-prompt.1 | 3 +++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/debian/changelog b/debian/changelog index cdc65599..89ea539e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Thu, 19 Sep 2013 12:23:43 -0500 diff --git a/usr/share/byobu/profiles/bashrc b/usr/share/byobu/profiles/bashrc index b089c2c3..9783562e 100644 --- a/usr/share/byobu/profiles/bashrc +++ b/usr/share/byobu/profiles/bashrc @@ -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 diff --git a/usr/share/man/man1/byobu-prompt.1 b/usr/share/man/man1/byobu-prompt.1 index dfe40364..8699e06e 100644 --- a/usr/share/man/man1/byobu-prompt.1 +++ b/usr/share/man/man1/byobu-prompt.1 @@ -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.