mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2026-11-25 18:03:03 +01:00
systemd: add prompt function to show systemd units' status (#7657)
Co-authored-by: Marc Cornellà <marc.cornella@live.com>
This commit is contained in:
1 parent
de261bd29c
commit
eeb49bf5b0
2 files changed
+56
No files matched your search
@@ -73,3 +73,18 @@ alias sc-mask-now="sc-mask --now"
|
||||
alias scu-enable-now="scu-enable --now"
|
||||
alias scu-disable-now="scu-disable --now"
|
||||
alias scu-mask-now="scu-mask --now"
|
||||
|
||||
function systemd_prompt_info {
|
||||
local unit
|
||||
for unit in $@; do
|
||||
echo -n "$ZSH_THEME_SYSTEMD_PROMPT_PREFIX"
|
||||
[[ -n "$ZSH_THEME_SYSTEMD_PROMPT_CAPS" ]] && echo "${(U)unit}:" || echo "$unit:"
|
||||
if systemctl is-active $unit &>/dev/null; then
|
||||
echo -n "$ZSH_THEME_SYSTEMD_PROMPT_ACTIVE"
|
||||
else
|
||||
echo -n "$ZSH_THEME_SYSTEMD_PROMPT_NOTACTIVE"
|
||||
fi
|
||||
echo -n "$ZSH_THEME_SYSTEMD_PROMPT_SUFFIX"
|
||||
done
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user