add PROMPT_DIR_COLOR to change the directory color (#2239152)
originally idea of Thomas Steenholdt
This commit is contained in:
parent
10c5c4b86d
commit
88fb2b60ee
@ -1,16 +1,19 @@
|
|||||||
# Simple colored bash prompt
|
# Simple colored bash prompt
|
||||||
|
|
||||||
The prompt color theme can be customized simply by setting
|
The prompt color theme can be customized simply by setting
|
||||||
the `PROMPT_COLOR` envvar.
|
the `PROMPT_COLOR` envvar, and optionally `PROMPT_DIR_COLOR`.
|
||||||
|
|
||||||
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.
|
||||||
|
|
||||||
|
`PROMPT_DIR_COLOR` changes the color of the working directory,
|
||||||
|
which otherwise defaults to `PROMPT_COLOR`.
|
||||||
|
|
||||||
Set `prompt_color_force` (before source'ing) 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.
|
Also you can set `PROMPT_ERROR` if you want to append red error exit code to the prompt.
|
||||||
|
|
||||||
See `/etc/profile.d/bash-color-prompt.sh` for the actual script.
|
See `/etc/profile.d/bash-color-prompt.sh` for the actual script.
|
||||||
|
|
||||||
|
@ -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${PROMPT_ERROR:+\[\e[0;31m\]${?#0}}\[\e[0m\]\$ '
|
PS1='\[\e[${PROMPT_COLOR:-32}m\]\u@\h\[\e[0m\]:\[\e[${PROMPT_DIR_COLOR:-${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.2
|
||||||
Release: 2%{?dist}
|
Release: 1%{?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,8 +41,8 @@ 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
|
* Fri Nov 10 2023 Jens Petersen <petersen@redhat.com> - 0.2-1
|
||||||
- fixup PROMPT_ERROR change to include the red color code
|
- add PROMPT_DIR_COLOR to change the dir color (Thomas Steenholdt, #2239152)
|
||||||
|
|
||||||
* 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