]> git.ipfire.org Git - thirdparty/systemd.git/blame - shell-completion/zsh/_systemctl.in
man: systemd-measure. Remove 'tpm2-pcrs=' from cryptenroll command (#39590)
[thirdparty/systemd.git] / shell-completion / zsh / _systemctl.in
CommitLineData
682e043c 1#compdef systemctl
db9ecf05 2# SPDX-License-Identifier: LGPL-2.1-or-later
ff7a0685 3
c501ecd7 4(( $+functions[_systemctl_commands] )) || _systemctl_commands()
ff7a0685 5{
356873dd
DS
6 local expl i
7
fa7ea865 8 local -a unit_commands=(
51a3b726 9 # Unit Commands
5edea3b7 10 "list-automounts:List automounts"
73369684 11 "list-paths:List paths"
843cfcb1
ZJS
12 "list-sockets:List sockets"
13 "list-timers:List timers"
14 "list-units:List units"
15 "start:Start (activate) one or more units"
16 "stop:Stop (deactivate) one or more units"
17 "reload:Reload one or more units"
18 "restart:Start or restart one or more units"
19 "condrestart:Restart one or more units if active"
20 "try-restart:Restart one or more units if active"
21 "reload-or-restart:Reload one or more units if possible, otherwise start or restart"
22 "force-reload:Reload one or more units if possible, otherwise restart if active"
843cfcb1
ZJS
23 "try-reload-or-restart:Reload one or more units if possible, otherwise restart if active"
24 "isolate:Start one unit and stop all others"
25 "kill:Send signal to processes of a unit"
26 "is-active:Check whether units are active"
27 "is-failed:Check whether units are failed"
28 "status:Show runtime status of one or more units"
29 "show:Show properties of one or more units/jobs or the manager"
30 "cat:Show the source unit files and drop-ins"
51a3b726 31 "set-property:Sets one or more properties of a unit"
b3d12ac0
RP
32 "service-log-level:Get or set the logging threshold for service"
33 "service-log-target:Get or set the logging target for service"
51a3b726 34 "help:Show documentation for specified units"
843cfcb1 35 "reset-failed:Reset failed state for all, one, or more units"
51a3b726 36 "list-dependencies:Show unit dependency tree"
1d8385b4 37 "clean:Remove configuration, state, cache, logs or runtime data of units"
c4d708c3 38 "freeze:Freeze one or more units specified on the command line using cgroup freezer"
39 "thaw:Thaw (unfreeze) one or more units specified on the command line."
5e8deb94 40 "bind:Bind mount a path from the host into a unit's namespace"
6faecbd3 41 "mount-image:Mount an image from the host into a unit's namespace"
6864f9b9 42 "whoami:Determines as part of which unit the command is being invoked"
fa7ea865 43 )
1d8385b4 44
fa7ea865 45 local -a machine_commands=(
1d8385b4
DS
46 # Machine Commands
47 "list-machines:List the host and all running local containers"
fa7ea865 48 )
51a3b726 49
fa7ea865 50 local -a unit_file_commands=(
51a3b726 51 # Unit File Commands
843cfcb1
ZJS
52 "list-unit-files:List installed unit files"
53 "enable:Enable one or more unit files"
54 "disable:Disable one or more unit files"
843cfcb1
ZJS
55 "reenable:Reenable one or more unit files"
56 "preset:Enable/disable one or more unit files based on preset configuration"
c4e7664d 57 "preset-all:Enable/disable all unit files based on preset configuration"
51a3b726 58 "is-enabled:Check whether unit files are enabled"
843cfcb1
ZJS
59 "mask:Mask one or more units"
60 "unmask:Unmask one or more units"
61 "link:Link one or more units files into the search path"
51a3b726
DS
62 "revert:Revert unit files to their vendor versions"
63 "add-wants:Add Wants= dependencies to a unit"
64 "add-requires:Add Requires= dependencies to a unit"
65 "set-default:Set the default target"
66 "get-default:Query the default target"
67 "edit:Edit one or more unit files"
fa7ea865 68 )
51a3b726 69
fa7ea865 70 local -a job_commands=(
51a3b726 71 # Job Commands
843cfcb1
ZJS
72 "list-jobs:List jobs"
73 "cancel:Cancel all, one, or more jobs"
fa7ea865 74 )
51a3b726 75
fa7ea865 76 local -a environment_commands=(
51a3b726 77 # Environment Commands
843cfcb1
ZJS
78 "show-environment:Dump environment"
79 "set-environment:Set one or more environment variables"
80 "unset-environment:Unset one or more environment variables"
1d8385b4 81 "import-environment:Import environment variables set on the client"
fa7ea865 82 )
51a3b726 83
fa7ea865 84 local -a manager_state_commands=(
51a3b726 85 # Manager State Commands
843cfcb1
ZJS
86 "daemon-reload:Reload systemd manager configuration"
87 "daemon-reexec:Reexecute systemd manager"
1d8385b4
DS
88 "log-level:Get or set the log level"
89 "log-target:Get or set the log target"
90 "service-watchdogs:Get or set the state of software watchdogs"
fa7ea865 91 )
51a3b726 92
fa7ea865 93 local -a system_commands=(
51a3b726
DS
94 # System Commands
95 "is-system-running:Query overall status of the system"
843cfcb1
ZJS
96 "default:Enter system default mode"
97 "rescue:Enter system rescue mode"
98 "emergency:Enter system emergency mode"
99 "halt:Shut down and halt the system"
100 "suspend:Suspend the system"
101 "poweroff:Shut down and power-off the system"
102 "reboot:Shut down and reboot the system"
050d6d71 103 "soft-reboot:Shut down and reboot the userspace"
843cfcb1
ZJS
104 "kexec:Shut down and reboot the system with kexec"
105 "exit:Ask for user instance termination"
106 "switch-root:Change root directory"
51a3b726
DS
107 "hibernate:Hibernate the system"
108 "hybrid-sleep:Hibernate and suspend the system"
109 "suspend-then-hibernate:Suspend the system for a period of time, and then hibernate it"
c8342feb 110 "sleep:Put the system to sleep"
fa7ea865 111 )
51a3b726 112
356873dd
DS
113 local -a groups=( unit machine unit_file job environment manager_state system )
114 local -a _systemctl_cmds
115 for i in $groups; do
116 _systemctl_cmds+=( "${(@P)${:-"${i}_commands"}}" )
117 done
843cfcb1
ZJS
118
119 if (( CURRENT == 1 )); then
356873dd
DS
120 _tags ${^groups//_/-}-commands
121 while _tags; do
122 for i in $groups; do
123 if _requested ${i//_/-}-commands; then
12e64a48
EK
124 _describe -t ${i//_/-}-commands "${i//_/ } command" ${i}_commands &&
125 ret=0
356873dd
DS
126 fi
127 done
128 done
ff7a0685 129 else
356873dd 130 local curcontext="$curcontext"
843cfcb1
ZJS
131
132 cmd="${${_systemctl_cmds[(r)$words[1]:*]%%:*}}"
133 # Deal with any aliases
134 case $cmd in
135 condrestart) cmd="try-restart";;
136 force-reload) cmd="try-reload-or-restart";;
137 esac
138
139 if (( $#cmd )); then
140 curcontext="${curcontext%:*:*}:systemctl-${cmd}:"
141
142 local update_policy
143 zstyle -s ":completion:${curcontext}:" cache-policy update_policy
144 if [[ -z "$update_policy" ]]; then
145 zstyle ":completion:${curcontext}:" cache-policy _systemctl_caching_policy
146 fi
147
148 _call_function ret _systemctl_$cmd || _message 'no more arguments'
149 else
150 _message "unknown systemctl command: $words[1]"
151 fi
152 return ret
ff7a0685 153 fi
ff7a0685
WG
154}
155
c501ecd7 156# @todo _systemd-run has a helper with the same name, so we must redefine
ff7a0685
WG
157__systemctl()
158{
d0fc94a1 159 command systemctl $_sys_service_mgr --full --legend=no --no-pager --plain "$@" 2>/dev/null
ff7a0685
WG
160}
161
162
163# Fills the unit list
c501ecd7 164(( $+functions[_systemctl_all_units] )) ||
843cfcb1 165 _systemctl_all_units()
ff7a0685 166{
5300aa7a 167 if _cache_invalid SYS_ALL_UNITS$_sys_service_mgr || ! _retrieve_cache SYS_ALL_UNITS$_sys_service_mgr
843cfcb1 168 then
8139407e 169 _sys_all_units=( ${${(f)"$(__systemctl list-units --all)"}%% *} )
3b4c6009 170 _store_cache SYS_ALL_UNITS$_sys_service_mgr _sys_all_units
843cfcb1 171 fi
ff7a0685
WG
172}
173
174# Fills the unit list including all file units
c501ecd7 175(( $+functions[_systemctl_really_all_units] )) ||
843cfcb1 176 _systemctl_really_all_units()
ff7a0685 177{
5300aa7a
EK
178 local -a all_unit_files
179 local -a really_all_units
180 if _cache_invalid SYS_REALLY_ALL_UNITS$_sys_service_mgr || ! _retrieve_cache SYS_REALLY_ALL_UNITS$_sys_service_mgr
843cfcb1 181 then
8139407e 182 all_unit_files=( ${${(f)"$(__systemctl list-unit-files)"}%% *} )
843cfcb1
ZJS
183 _systemctl_all_units
184 really_all_units=($_sys_all_units $all_unit_files)
185 _sys_really_all_units=(${(u)really_all_units})
186 _store_cache SYS_REALLY_ALL_UNITS$_sys_service_mgr _sys_really_all_units
187 fi
ff7a0685
WG
188}
189
c501ecd7 190(( $+functions[_filter_units_by_property] )) ||
843cfcb1
ZJS
191 _filter_units_by_property() {
192 local property=$1 value=$2; shift 2
193 local -a units; units=("${(q-)@}")
194 local -A props
195 props=(${(f)"$(_call_program units "$service $_sys_service_mgr show --no-pager --property=\"Id,$property\" -- ${units} 2>/dev/null")"})
3ceb4d24 196 echo -E - "${(@)${(k@)props[(Re)$property=$value]}#Id=}"
843cfcb1 197 }
ff7a0685 198
c501ecd7 199(( $+functions[_systemctl_get_non_template_names] )) ||
c8e2cd79
RP
200 _systemctl_get_non_template_names() {
201 _systemctl_really_all_units
202 print -r - ${_sys_really_all_units:#*@.*}
203 }
4ed14116 204
c501ecd7 205(( $+functions[_systemctl_get_template_names] )) ||
9ec08083
RP
206 _systemctl_get_template_names() {
207 local pathkind=systemd-search-${_sys_service_mgr##*--}-unit
208 print -r - ${(s-:-)^$(_call_program $pathkind systemd-path $pathkind)}/*@.(${(~j.|.)$(__systemctl --type=help)})(N:t:r)
209 }
e9a19bd8 210
c501ecd7 211(( $+functions[_systemctl_active_units] )) ||
2cbda748
RP
212 _systemctl_active_units() {
213 local pattern
214 if zstyle -T ":completion:$curcontext" use-pattern; then
215 pattern="$PREFIX*$SUFFIX"
216 fi
217 _sys_active_units=( ${${(f)"$(__systemctl list-units $pattern)"}%% *} )
218 }
81333ecf 219
c501ecd7 220(( $+functions[_systemctl_startable_units] )) ||
843cfcb1 221 _systemctl_startable_units(){
2cbda748
RP
222 local pattern
223 if zstyle -T ":completion:$curcontext" use-pattern; then
224 pattern="$PREFIX*$SUFFIX"
225 fi
843cfcb1
ZJS
226 _sys_startable_units=( $( _filter_units_by_property ActiveState inactive $(
227 _filter_units_by_property CanStart yes ${${${(f)"$(
2cbda748
RP
228 __systemctl list-unit-files --state enabled,enabled-runtime,linked,linked-runtime,static,indirect,disabled,generated,transient $pattern
229 __systemctl list-units --state inactive,failed $pattern
992f51ea 230 )"}:#*@.*}%%[[:space:]]*}
843cfcb1
ZJS
231 )) )
232 }
81333ecf 233
c501ecd7 234(( $+functions[_systemctl_restartable_units] )) ||
843cfcb1 235 _systemctl_restartable_units(){
2cbda748
RP
236 local pattern
237 if zstyle -T ":completion:$curcontext" use-pattern; then
238 pattern="$PREFIX*$SUFFIX"
239 fi
843cfcb1 240 _sys_restartable_units=( $( _filter_units_by_property CanStart yes ${${${(f)"$(
2cbda748
RP
241 __systemctl list-unit-files --state enabled,disabled,static $pattern
242 __systemctl list-units $pattern
992f51ea 243 )"}:#*@.*}%%[[:space:]]*} ) )
843cfcb1 244 }
81333ecf 245
c501ecd7 246(( $+functions[_systemctl_failed_units] )) ||
8139407e 247 _systemctl_failed_units() {_sys_failed_units=( ${${(f)"$(__systemctl list-units --state=failed)"}%% *} ) }
c501ecd7 248
249(( $+functions[_systemctl_unit_state] )) ||
f5b3be30
HT
250 _systemctl_unit_state() {
251 setopt localoptions extendedglob
2cbda748
RP
252 local pattern
253 if zstyle -T ":completion:$curcontext" use-pattern; then
254 pattern="$PREFIX*$SUFFIX"
255 fi
f5b3be30 256 typeset -gA _sys_unit_state
2cbda748 257 _sys_unit_state=( ${=${${(f)"$(__systemctl list-unit-files $pattern)"}%%[[:space:]]#}% *} )
f5b3be30 258 }
ff7a0685 259
67afa931 260local fun
ff7a0685 261# Completion functions for ALL_UNITS
4ed14116 262for fun in cat mask ; do
843cfcb1
ZJS
263 (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
264 {
265 _systemctl_really_all_units
266 _wanted systemd-units expl unit \
267 compadd "$@" -a - _sys_really_all_units
268 }
ff7a0685
WG
269done
270
4ed14116 271# Completion functions for NONTEMPLATE_UNITS
c4a2deba 272for fun in is-active is-failed is-enabled status show preset help list-dependencies edit revert add-wants add-requires set-property; do
843cfcb1
ZJS
273 (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
274 {
275 _wanted systemd-units expl unit \
276 compadd "$@" - $(_systemctl_get_non_template_names)
277 }
4ed14116
EV
278done
279
ff7a0685 280# Completion functions for ENABLED_UNITS
e9a19bd8
ZJS
281(( $+functions[_systemctl_disable] )) || _systemctl_disable()
282{
fb869ca1 283 local _sys_unit_state; _systemctl_unit_state
d34b7c11 284 _wanted systemd-units expl 'enabled unit' \
843cfcb1 285 compadd "$@" - ${(k)_sys_unit_state[(R)enabled]}
e9a19bd8
ZJS
286}
287
288(( $+functions[_systemctl_reenable] )) || _systemctl_reenable()
289{
fb869ca1 290 local _sys_unit_state; _systemctl_unit_state
d34b7c11 291 _wanted systemd-units expl 'enabled/disabled unit' \
843cfcb1 292 compadd "$@" - ${(k)_sys_unit_state[(R)(enabled|disabled)]} $(_systemctl_get_template_names)
e9a19bd8 293}
ff7a0685
WG
294
295# Completion functions for DISABLED_UNITS
296(( $+functions[_systemctl_enable] )) || _systemctl_enable()
297{
843cfcb1
ZJS
298 local _sys_unit_state; _systemctl_unit_state
299 _wanted systemd-units expl 'disabled unit' \
300 compadd "$@" - ${(k)_sys_unit_state[(R)disabled]} $(_systemctl_get_template_names)
ff7a0685
WG
301}
302
303# Completion functions for FAILED_UNITS
304(( $+functions[_systemctl_reset-failed] )) || _systemctl_reset-failed()
305{
843cfcb1
ZJS
306 local _sys_failed_units; _systemctl_failed_units
307 _wanted systemd-units expl 'failed unit' \
308 compadd "$@" -a - _sys_failed_units || _message "no failed unit found"
ff7a0685
WG
309}
310
311# Completion functions for STARTABLE_UNITS
312(( $+functions[_systemctl_start] )) || _systemctl_start()
313{
843cfcb1
ZJS
314 local _sys_startable_units; _systemctl_startable_units
315 _wanted systemd-units expl 'startable unit' \
316 compadd "$@" - ${_sys_startable_units[*]}
ff7a0685
WG
317}
318
319# Completion functions for STOPPABLE_UNITS
c4d708c3 320for fun in stop condstop kill try-restart condrestart freeze thaw; do
843cfcb1
ZJS
321 (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
322 {
323 local _sys_active_units; _systemctl_active_units
324 _wanted systemd-units expl 'stoppable unit' \
325 compadd "$@" - $( _filter_units_by_property CanStop yes \
326 ${_sys_active_units[*]} )
327 }
ff7a0685
WG
328done
329
b3d12ac0
RP
330(( $+functions[_systemctl_service-log-level] )) ||
331 _systemctl_service-log-level() {
332 local -a log_levels=( emerg alert crit err warning notice info debug )
333 local _sys_active_units; _systemctl_active_units
334 if (( CURRENT == 2 )); then
335 _wanted systemd-units expl 'active unit' \
336 compadd "$@" -a - _sys_active_units || _message "no units found"
337 else
338 compadd "$@" -a - log_levels
339 fi
340}
341
342(( $+functions[_systemctl_service-log-target] )) ||
343 _systemctl_service-log-target() {
344 local -a log_targets=( console kmsg journal syslog null auto )
345 local _sys_active_units; _systemctl_active_units
346 if (( CURRENT == 2 )); then
347 _wanted systemd-units expl 'active unit' \
348 compadd "$@" -a - _sys_active_units || _message "no units found"
349 else
350 compadd "$@" -a - log_targets
351 fi
352}
353
ff7a0685
WG
354# Completion functions for ISOLATABLE_UNITS
355(( $+functions[_systemctl_isolate] )) || _systemctl_isolate()
356{
843cfcb1
ZJS
357 _systemctl_all_units
358 _wanted systemd-units expl 'isolatable unit' \
359 compadd "$@" - $( _filter_units_by_property AllowIsolate yes \
360 ${_sys_all_units[*]} )
ff7a0685
WG
361}
362
363# Completion functions for RELOADABLE_UNITS
aabf5d42 364for fun in reload try-reload-or-restart force-reload ; do
843cfcb1
ZJS
365 (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
366 {
367 local _sys_active_units; _systemctl_active_units
368 _wanted systemd-units expl 'reloadable unit' \
369 compadd "$@" - $( _filter_units_by_property CanReload yes \
370 ${_sys_active_units[*]} )
371 }
ff7a0685
WG
372done
373
374# Completion functions for RESTARTABLE_UNITS
375for fun in restart reload-or-restart ; do
843cfcb1
ZJS
376 (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
377 {
378 local _sys_restartable_units; _systemctl_restartable_units
379 _wanted systemd-units expl 'restartable unit' \
380 compadd "$@" - ${_sys_restartable_units[*]}
381 }
ff7a0685
WG
382done
383
384# Completion functions for MASKED_UNITS
385(( $+functions[_systemctl_unmask] )) || _systemctl_unmask()
386{
843cfcb1
ZJS
387 local _sys_unit_state; _systemctl_unit_state
388 _wanted systemd-units expl 'masked unit' \
389 compadd "$@" - ${(k)_sys_unit_state[(R)masked]} || _message "no masked units found"
ff7a0685
WG
390}
391
392# Completion functions for JOBS
393(( $+functions[_systemctl_cancel] )) || _systemctl_cancel()
394{
843cfcb1
ZJS
395 _wanted systemd-jobs expl job \
396 compadd "$@" - ${${(f)"$(__systemctl list-jobs)"}%% *} ||
397 _message "no jobs found"
ff7a0685
WG
398}
399
1cf3c30c
ZJS
400# Completion functions for TARGETS
401(( $+functions[_systemctl_set-default] )) || _systemctl_set-default()
402{
843cfcb1 403 _wanted systemd-targets expl target \
8139407e 404 compadd "$@" - ${${(f)"$(__systemctl list-unit-files --type target --all)"}%% *} ||
843cfcb1 405 _message "no targets found"
ff7a0685
WG
406}
407
408# Completion functions for ENVS
409for fun in set-environment unset-environment ; do
843cfcb1
ZJS
410 (( $+functions[_systemctl_$fun] )) || _systemctl_$fun()
411 {
412 local fun=$0 ; fun=${fun##_systemctl_}
413 local suf
414 if [[ "${fun}" = "set-environment" ]]; then
415 suf='-S='
416 fi
417 _wanted systemd-environment expl 'environment variable' \
6d07d23b 418 compadd "$@" ${suf} - ${${(f)"$(systemctl "$_sys_service_mgr" show-environment)"}%%=*}
843cfcb1 419 }
ff7a0685
WG
420done
421
34199208
ZJS
422(( $+functions[_systemctl_import-environment] )) || _systemctl_import-environment()
423{
424 _parameters
425}
426
2c12a402 427(( $+functions[_systemctl_link] )) || _systemctl_link() {
843cfcb1
ZJS
428 _sd_unit_files
429 }
ff7a0685 430
7b742b31 431(( $+functions[_systemctl_switch-root] )) || _systemctl_switch-root() {
843cfcb1
ZJS
432 _files
433 }
7b742b31 434
5e8deb94
LB
435(( $+functions[_systemctl_bind] )) || _systemctl_bind() {
436 _files
437 }
438
6faecbd3
LB
439(( $+functions[_systemctl_mount-image] )) || _systemctl_mount-image() {
440 _files
441 }
442
ff7a0685 443# no systemctl completion for:
299c397c 444# [STANDALONE]='daemon-reexec daemon-reload default
ff7a0685
WG
445# emergency exit halt kexec list-jobs list-units
446# list-unit-files poweroff reboot rescue show-environment'
ff7a0685 447
c501ecd7 448(( $+functions[_systemctl_caching_policy] )) ||
843cfcb1 449 _systemctl_caching_policy()
ff7a0685 450{
843cfcb1 451 # rebuild if cache is more than a day old
110ba0cc 452 [[ -n $1(#qNmd+1) ]] && return 0
ff7a0685 453
110ba0cc
RP
454 local pathkind=systemd-search-${1##*--}-unit
455 for dir in ${(s-:-)^$(_call_program $pathkind systemd-path $pathkind)}; do
456 [[ $dir -nt $1 ]] && return 0
457 done
ff7a0685 458
843cfcb1 459 return 1
ff7a0685
WG
460}
461
c501ecd7 462(( $+functions[_systemctl_unit_states] )) ||
843cfcb1
ZJS
463 _systemctl_unit_states() {
464 local -a _states
465 _states=("${(fo)$(__systemctl --state=help)}")
466 _values -s , "${_states[@]}"
467 }
298b9e23 468
c501ecd7 469(( $+functions[_systemctl_unit_types] )) ||
843cfcb1
ZJS
470 _systemctl_unit_types() {
471 local -a _types
472 _types=("${(fo)$(__systemctl -t help)}")
473 _values -s , "${_types[@]}"
474 }
298b9e23 475
c501ecd7 476(( $+functions[_systemctl_unit_properties] )) ||
843cfcb1 477 _systemctl_unit_properties() {
dfe6b3fa 478 local -a _sys_all_properties=( ${(f)"$({{LIBEXECDIR}}/systemd --no-pager --dump-bus-properties 2>/dev/null)"} )
ae6fb82c 479 _wanted systemd-unit-properties expl 'unit property' \
dfe6b3fa 480 _values -s , "${_sys_all_properties[@]}"
843cfcb1 481 }
c0a67aef 482
c501ecd7 483(( $+functions[_systemctl_job_modes] )) ||
843cfcb1
ZJS
484 _systemctl_job_modes() {
485 local -a _modes
486 _modes=(fail replace replace-irreversibly isolate ignore-dependencies ignore-requirements flush)
487 _values -s , "${_modes[@]}"
488 }
903e7c37 489
46ad9c53
LB
490(( $+functions[_systemctl_timestamp] )) ||
491 _systemctl_timestamp() {
492 local -a _styles
493 _styles=(help pretty us µs utc us+utc µs+utc)
494 _values -s , "${_styles[@]}"
495 }
496
4327574f
FS
497(( $+functions[_systemctl_check_inhibitors] )) ||
498 _systemctl_check_inhibitors() {
499 local -a _modes
500 _modes=(auto yes no)
501 _values -s , "${_modes[@]}"
502 }
503
e09d0d46 504# Build arguments for "systemctl" to be used in completion.
087f777a
RP
505# Use the last mode, or --system (they are exclusive and the last one is used).
506local _sys_service_mgr=${words[(R)(--user|--system)]:---system}
ff7a0685 507_arguments -s \
20927c0e
EK
508 '(- *)'{-h,--help}'[Show help]' \
509 '(- *)--version[Show package version]' \
510 '(-t --type)'{-t+,--type=}'[List only units of a particular type]:unit type:_systemctl_unit_types' \
c501ecd7 511 '--state=[Display units in the specified state]:unit state:_systemctl_unit_states' \
512 '--job-mode=[Specify how to deal with other jobs]:mode:_systemctl_job_modes' \
20927c0e
EK
513 '(-p --property)'{-p+,--property=}'[Show only properties by specific name]:unit property:_systemctl_unit_properties' \
514 '(-a --all)'{-a,--all}'[Show all units/properties, including dead/empty ones]' \
ff7a0685
WG
515 '--reverse[Show reverse dependencies]' \
516 '--after[Show units ordered after]' \
517 '--before[Show units ordered before]' \
20927c0e 518 '(-l --full)'{-l,--full}"[Don't ellipsize unit names on output]" \
ff7a0685 519 '--show-types[When showing sockets, show socket type]' \
4327574f 520 '--check-inhibitors[Specify if inhibitors should be checked]:mode:_systemctl_check_inhibitors' \
20927c0e 521 '(-q --quiet)'{-q,--quiet}'[Suppress output]' \
93b0ec8b 522 '--no-warn[Suppress several warnings shown by default]' \
ff7a0685 523 '--no-block[Do not wait until operation finished]' \
d60bd2ff 524 '--legend=no[Do not print a legend, i.e. the column headers and the footer with hints]' \
ff7a0685
WG
525 '--no-pager[Do not pipe output into a pager]' \
526 '--system[Connect to system manager]' \
527 '--user[Connect to user service manager]' \
528 "--no-wall[Don't send wall message before halt/power-off/reboot]" \
3c3335c7 529 '--global[Enable/disable/mask default user unit files globally]' \
ff7a0685
WG
530 "--no-reload[When enabling/disabling unit files, don't reload daemon configuration]" \
531 '--no-ask-password[Do not ask for system passwords]' \
4ccde410 532 '--kill-whom=[Whom to send signal to]:killwhom:(main control all)' \
20927c0e
EK
533 '(-s --signal)'{-s+,--signal=}'[Which signal to send]:signal:_signals' \
534 '(-f --force)'{-f,--force}'[When enabling unit files, override existing symlinks. When shutting down, execute action immediately]' \
4e93d369
LR
535 '--root=[Enable/disable/mask unit files in the specified root directory]:directory:_directories' \
536 '--runtime[Enable/disable/mask unit files only temporarily until next reboot]' \
20927c0e
EK
537 '(-H --host)'{-H+,--host=}'[Operate on remote host]:userathost:_sd_hosts_or_user_at_host' \
538 '(-P --privileged)'{-P,--privileged}'[Acquire privileges before execution]' \
539 '(-n --lines)'{-n+,--lines=}'[Journal entries to show]:number of entries' \
540 '(-o --output)'{-o+,--output=}'[Change journal output mode]:modes:_sd_outputmodes' \
5bdf2243 541 '--firmware-setup[Tell the firmware to show the setup menu on next boot]' \
ff7a0685 542 '--plain[When used with list-dependencies, print output as a list]' \
bef19548 543 '--failed[Show failed units]' \
46ad9c53 544 '--timestamp=[Change format of printed timestamps]:style:_systemctl_timestamp' \
c501ecd7 545 '*::systemctl command:_systemctl_commands'