add PROMPT_BRACKETS to surround the prompt with traditional brackets
(based on feedback from Thomas Steenholdt, #2239152)
This commit is contained in:
parent
75f56530c3
commit
501831219f
@ -6,9 +6,12 @@ the `PROMPT_COLOR` envvar, and optionally `PROMPT_DIR_COLOR`.
|
||||
For example `PROMPT_COLOR='2;7'` is dim inverse-video
|
||||
and `PROMPT_COLOR='1;33;53'` is bright/bold yellow with overline.
|
||||
|
||||
`PROMPT_DIR_COLOR` changes the color of the working directory,
|
||||
`PROMPT_DIR_COLOR` similarly changes the color of the working directory,
|
||||
which otherwise defaults to `PROMPT_COLOR`.
|
||||
|
||||
The prompt can be bracketed to look more like the traditional Fedora prompt
|
||||
by setting `PROMPT_BRACKETS`.
|
||||
|
||||
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"
|
||||
*and* PS1 is the fedora or bash default.
|
||||
@ -17,7 +20,7 @@ Also you can set `PROMPT_ERROR` if you want to append red error exit code to the
|
||||
|
||||
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).
|
||||
Please open issues against [shell-color-prompt](https://src.fedoraproject.org/rpms/shell-color-prompt).
|
||||
|
||||
## References
|
||||
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]\\$ " -o "$PS1" = "\\s-\\v\\\$ " ')' -a "${TERM: -5
|
||||
# PROMPT_COLOR='1;33;44' # bold yellow on blue
|
||||
# PROMPT_COLOR='1;32' # bold green
|
||||
# PROMPT_COLOR='' # unset defaults to green
|
||||
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\]\$ '
|
||||
PS1='${PROMPT_BRACKETS:+[}\[\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\]${PROMPT_BRACKETS:+]}\$ '
|
||||
fi
|
||||
|
||||
@ -44,6 +44,8 @@ install -m 644 -D -t %{buildroot}%{profiledir} bash-color-prompt.sh
|
||||
* Fri Nov 10 2023 Jens Petersen <petersen@redhat.com> - 0.2-1
|
||||
- add PROMPT_DIR_COLOR to change the dir color (Thomas Steenholdt, #2239152)
|
||||
- also check for bash default prompt for login shell (Sam Morris, #2248853)
|
||||
- add PROMPT_BRACKETS to surround the prompt with traditional brackets
|
||||
(based on feedback from Thomas Steenholdt, #2239152)
|
||||
|
||||
* Thu Nov 9 2023 Jens Petersen <petersen@redhat.com> - 0.1.1-1
|
||||
- only show error code if PROMPT_ERROR set
|
||||
|
||||
Loading…
Reference in New Issue
Block a user