diff options
author | Ronan Pigott <ronan@rjp.ie> | 2023-05-07 14:08:29 -0700 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2023-05-08 01:08:36 +0100 |
commit | b3d12ac0da2a8b25abc9052a4f350f1ea1108985 (patch) | |
tree | 82ae21d9dc4984cbe488cd88e505849cf19cee10 /shell-completion | |
parent | 78e0dd224467dc627dc0d3f907954e2a6dc59bc8 (diff) | |
download | systemd-b3d12ac0da2a8b25abc9052a4f350f1ea1108985.tar.gz |
zsh: add service-log-{level,target} completions for systemctl
Diffstat (limited to 'shell-completion')
-rw-r--r-- | shell-completion/zsh/_systemctl.in | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in index 0f97c884a0..782b643841 100644 --- a/shell-completion/zsh/_systemctl.in +++ b/shell-completion/zsh/_systemctl.in @@ -29,6 +29,8 @@ "show:Show properties of one or more units/jobs or the manager" "cat:Show the source unit files and drop-ins" "set-property:Sets one or more properties of a unit" + "service-log-level:Get or set the logging threshold for service" + "service-log-target:Get or set the logging target for service" "help:Show documentation for specified units" "reset-failed:Reset failed state for all, one, or more units" "list-dependencies:Show unit dependency tree" @@ -301,6 +303,30 @@ for fun in stop kill try-restart condrestart ; do } done +(( $+functions[_systemctl_service-log-level] )) || + _systemctl_service-log-level() { + local -a log_levels=( emerg alert crit err warning notice info debug ) + local _sys_active_units; _systemctl_active_units + if (( CURRENT == 2 )); then + _wanted systemd-units expl 'active unit' \ + compadd "$@" -a - _sys_active_units || _message "no units found" + else + compadd "$@" -a - log_levels + fi +} + +(( $+functions[_systemctl_service-log-target] )) || + _systemctl_service-log-target() { + local -a log_targets=( console kmsg journal syslog null auto ) + local _sys_active_units; _systemctl_active_units + if (( CURRENT == 2 )); then + _wanted systemd-units expl 'active unit' \ + compadd "$@" -a - _sys_active_units || _message "no units found" + else + compadd "$@" -a - log_targets + fi +} + # Completion functions for ISOLATABLE_UNITS (( $+functions[_systemctl_isolate] )) || _systemctl_isolate() { |