summaryrefslogtreecommitdiff
path: root/plugins/systemd/systemd.plugin.zsh
diff options
context:
space:
mode:
authorMarc Cornellà <marc.cornella@live.com>2020-02-27 22:55:30 +0100
committerGitHub <noreply@github.com>2020-02-27 22:55:30 +0100
commit18ee5dffdc57bb9219ee96b40da006704ac37df1 (patch)
treee1fe420cf18fa7a916d5d43c408c6f92ed33b62d /plugins/systemd/systemd.plugin.zsh
parentd81cd753e0b3a845e8f3549da245dbad102a6e4c (diff)
parent368198b7616eb69b396de86d9ec4ff0f35bd72f0 (diff)
downloadzsh-18ee5dffdc57bb9219ee96b40da006704ac37df1.tar.gz
zsh-18ee5dffdc57bb9219ee96b40da006704ac37df1.tar.bz2
zsh-18ee5dffdc57bb9219ee96b40da006704ac37df1.zip
Merge branch 'master' into clipboard
Diffstat (limited to 'plugins/systemd/systemd.plugin.zsh')
-rw-r--r--plugins/systemd/systemd.plugin.zsh80
1 files changed, 74 insertions, 6 deletions
diff --git a/plugins/systemd/systemd.plugin.zsh b/plugins/systemd/systemd.plugin.zsh
index 7cd27d450..f2d1d6f1c 100644
--- a/plugins/systemd/systemd.plugin.zsh
+++ b/plugins/systemd/systemd.plugin.zsh
@@ -1,12 +1,65 @@
user_commands=(
- list-units is-active status show help list-unit-files
- is-enabled list-jobs show-environment cat list-timers)
+ cat
+ get-default
+ help
+ is-active
+ is-enabled
+ is-failed
+ is-system-running
+ list-dependencies
+ list-jobs
+ list-sockets
+ list-timers
+ list-unit-files
+ list-units
+ show
+ show-environment
+ status)
sudo_commands=(
- start stop reload restart try-restart isolate kill
- reset-failed enable disable reenable preset mask unmask
- link load cancel set-environment unset-environment
- edit)
+ add-requires
+ add-wants
+ cancel
+ daemon-reexec
+ daemon-reload
+ default
+ disable
+ edit
+ emergency
+ enable
+ halt
+ hibernate
+ hybrid-sleep
+ import-environment
+ isolate
+ kexec
+ kill
+ link
+ list-machines
+ load
+ mask
+ poweroff
+ preset
+ preset-all
+ reboot
+ reenable
+ reload
+ reload-or-restart
+ reset-failed
+ rescue
+ restart
+ revert
+ set-default
+ set-environment
+ set-property
+ start
+ stop
+ suspend
+ switch-root
+ try-reload-or-restart
+ try-restart
+ unmask
+ unset-environment)
for c in $user_commands; do; alias sc-$c="systemctl $c"; done
for c in $sudo_commands; do; alias sc-$c="sudo systemctl $c"; done
@@ -20,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
+}
+