fixup PROMPT_ERROR change to include the red color code
This commit is contained in:
parent
0643778d98
commit
10c5c4b86d
10
README.md
10
README.md
@ -6,9 +6,15 @@ the `PROMPT_COLOR` envvar.
|
|||||||
For example `PROMPT_COLOR='2;7'` is dim inverse-video
|
For example `PROMPT_COLOR='2;7'` is dim inverse-video
|
||||||
and `PROMPT_COLOR='1;33;53'` is bright/bold yellow with overline.
|
and `PROMPT_COLOR='1;33;53'` is bright/bold yellow with overline.
|
||||||
|
|
||||||
Set `prompt_color_force` to force usage/updating of color PS1:
|
Set `prompt_color_force` (before source'ing) to force usage/updating of color PS1:
|
||||||
by default it is only setup cautiously if `$TERM` ends in "color"
|
by default it is only setup cautiously if `$TERM` ends in "color"
|
||||||
and PS1 is the fedora default.
|
*and* PS1 is the fedora default.
|
||||||
|
|
||||||
|
Also set `PROMPT_ERROR` if you want to append red error exit codes to the prompt.
|
||||||
|
|
||||||
|
See `/etc/profile.d/bash-color-prompt.sh` for the actual script.
|
||||||
|
|
||||||
|
Please report bugs against [shell-color-prompt](https://src.fedoraproject.org/rpms/shell-color-prompt).
|
||||||
|
|
||||||
## References
|
## References
|
||||||
See <https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters> etc for the ANSI codes.
|
See <https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters> etc for the ANSI codes.
|
||||||
|
@ -16,5 +16,5 @@ if [ "$PS1" = "[\u@\h \W]\\$ " -a "${TERM: -5}" = "color" -o -n "${prompt_color_
|
|||||||
# PROMPT_COLOR='1;33;44' # bold yellow on blue
|
# PROMPT_COLOR='1;33;44' # bold yellow on blue
|
||||||
# PROMPT_COLOR='1;32' # bold green
|
# PROMPT_COLOR='1;32' # bold green
|
||||||
# PROMPT_COLOR='' # unset defaults to green
|
# PROMPT_COLOR='' # unset defaults to green
|
||||||
PS1='\[\e[${PROMPT_COLOR:-32}m\]\u@\h\[\e[0m\]:\[\e[${PROMPT_COLOR:-32}m\]\w\[\e[0;31m\]${PROMPT_ERROR:+${?#0}}\[\e[0m\]\$ '
|
PS1='\[\e[${PROMPT_COLOR:-32}m\]\u@\h\[\e[0m\]:\[\e[${PROMPT_COLOR:-32}m\]\w${PROMPT_ERROR:+\[\e[0;31m\]${?#0}}\[\e[0m\]\$ '
|
||||||
fi
|
fi
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Name: shell-color-prompt
|
Name: shell-color-prompt
|
||||||
Version: 0.1.1
|
Version: 0.1.1
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: Color prompt for bash shell
|
Summary: Color prompt for bash shell
|
||||||
|
|
||||||
License: GPL-2.0-or-later
|
License: GPL-2.0-or-later
|
||||||
@ -41,6 +41,9 @@ install -m 644 -D -t %{buildroot}%{profiledir} bash-color-prompt.sh
|
|||||||
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Nov 9 2023 Jens Petersen <petersen@redhat.com> - 0.1.1-2
|
||||||
|
- fixup PROMPT_ERROR change to include the red color code
|
||||||
|
|
||||||
* Thu Nov 9 2023 Jens Petersen <petersen@redhat.com> - 0.1.1-1
|
* Thu Nov 9 2023 Jens Petersen <petersen@redhat.com> - 0.1.1-1
|
||||||
- only show error code if PROMPT_ERROR set
|
- only show error code if PROMPT_ERROR set
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user