updating zsh prompt to show when a reboot is required and a function 'reboot_for' to show what is driving the reboot need

This commit is contained in:
Andrew Davidson 2020-03-09 09:25:20 -04:00
parent e679f41745
commit 06861bdd16
Signed by: amd
GPG key ID: 17AF8F2A49CF25C6
2 changed files with 14 additions and 4 deletions

View file

@ -23,8 +23,14 @@ function truncated_pwd() {
echo ${(j:/:)dirs}
}
function collapse_pwd {
echo $(pwd | sed -e "s,^$HOME,~,")
# Show what requires a reboot if one is required
reboot_for() {
if test -f /var/run/reboot-required; then
echo "Reboot required for:"
cat /var/run/reboot-required.pkgs
else
echo "Nothing requires a reboot."
fi
}
# Extract anything

View file

@ -33,4 +33,8 @@ function current_pwd {
echo $(pwd | sed -e "s,^$HOME,~,")
}
PROMPT='%m ${PR_BOLD_YELLOW}$(truncated_pwd 3)$(git_branch)%{$reset_color%}$(git_unstaged)$(git_is_ahead)$(git_is_behind) %(?.%F{magenta}.%F{red})%f '
function check_reboot {
test -f /var/run/reboot-required && echo "R "
}
PROMPT='${PR_BOLD_RED}$(check_reboot)${reset_color}%m ${PR_BOLD_YELLOW}$(truncated_pwd 3)$(git_branch)%{$reset_color%}$(git_unstaged)$(git_is_ahead)$(git_is_behind) %(?.%F{magenta}.%F{red})%f '