1 #compdef loginctl journalctl hostnamectl localectl timedatectl systemd-coredumpctl udevadm systemd-analyze systemd-cat systemd-ask-password systemd-cgls systemd-cgtop systemd-delta systemd-detect-virt systemd-inhibit systemd-machine-id-setup systemd-notify systemd-nspawn systemd-tmpfiles systemd-tty-ask-password-agent machinectl
5 local curcontext="$curcontext" state lstate line
9 {-h,--help}'[Show help]' \
10 '--version[Show package version]' \
11 \*{-p,--property=}'[Show only properties by this name]:unit property' \
12 {-a,--all}'[Show all properties, including empty ones]' \
13 '--kill-who=[Who to send signal to]:killwho:(main control all)' \
14 {-s,--signal=}'[Which signal to send]:signal:_signals' \
15 '--no-ask-password[Do not ask for system passwords]' \
16 {-H,--host=}'[Show information for remote host]:userathost:_hosts_or_user_at_host' \
17 {-P,--privileged}'[Acquire privileges before execution]' \
18 '--no-pager[Do not pipe output into a pager]' \
19 '*::loginctl command:_loginctl_command'
24 {-h,--help}'[Show this help]' \
25 '--version[Show package version]' \
26 '--transient[Only set transient hostname]' \
27 '--static[Only set static hostname]' \
28 '--pretty[Only set pretty hostname]' \
29 '--no-ask-password[Do not prompt for password]' \
30 {-H,--host=}'[Operate on remote host]:userathost:_hosts_or_user_at_host' \
31 '*::hostnamectl commands:_hostnamectl_command'
35 '--since=[Start showing entries newer or of the specified date]:YYYY-MM-DD HH\:MM\:SS' \
36 '--until=[Stop showing entries older or of the specified date]:YYYY-MM-DD HH\:MM\:SS' \
37 {-c,--cursor=}'[Start showing entries from specified cursor]:cursors:_journal_fields __CURSORS' \
38 '--system[Show system and kernel messages]' \
39 '--user[Show messages from user services]' \
40 {-b,--this-boot}'[Show data only from current boot]' \
41 {-u,--unit=}'[Show data only from the specified unit]:units:_journal_fields _SYSTEMD_UNIT' \
42 '--user-unit[Show data only from the specified user session unit]:units:_journal_fields _SYSTEMD_USER_UNIT' \
43 {-p,--priority=}'[Show only messages within the specified priority range]:priority:_journal_fields PRIORITY' \
44 {-f,--follow}'[Follow journal]' \
45 {-n,--lines=}'[Number of journal entries to show]:integer' \
46 '--no-tail[Show all lines, even in follow mode]' \
47 {-o,--output=}'[Change journal output mode]:output modes:_outputmodes' \
48 {-l,--full}'[Show long fields in full]' \
49 {-a,--all}'[Show all fields, including long and unprintable]' \
50 {-q,--quiet}"[Don't show privilege warning]" \
51 '--no-pager[Do not pipe output into a pager]' \
52 {-m,--merge}'[Show entries from all available journals]' \
53 {-D,--directory=}'[Show journal files from directory]:directories:_directories' \
54 '--interval=[Time interval for changing the FSS sealing key]:time interval' \
55 '--verify-key=[Specify FSS verification key]:FSS key' \
56 {-h,--help}'[Show this help]' \
57 '--version[Show package version]' \
58 '--new-id128[Generate a new 128 Bit ID]' \
59 '--header[Show journal header information]' \
60 '--disk-usage[Show total disk usage]' \
61 {-F,--field=}'[List all values a certain field takes]:Fields:_list_fields' \
62 '--setup-keys[Generate new FSS key pair]' \
63 '--verify[Verify journal file consistency]' \
64 '--list-catalog[List messages in catalog]' \
65 '--update-catalog[Update binary catalog database]' \
66 '*::default: _journal_none'
70 {-h,--help}'[Show this help]' \
71 '--version[Show package version]' \
72 "--no-convert[Don't convert keyboard mappings]" \
73 '--no-pager[Do not pipe output into a pager]' \
74 '--no-ask-password[Do not prompt for password]' \
75 {-H,--host=}'[Operate on remote host]:userathost:_hosts_or_user_at_host' \
76 '*::localectl commands:_localectl_command'
80 {-o,--output=}'[Write output to FILE]:output file:_files' \
81 '--no-pager[Do not pipe output into a pager]' \
82 {-h,--help}'[Show this help]' \
83 '--version[Show package version]' \
84 '*::systemd-coredumpctl commands:_systemd-coredumpctl_command'
89 {-h,--help}'[Show this help]' \
90 '--version[Show package version]' \
91 '--adjust-system-clock[Adjust system clock when changing local RTC mode]' \
92 '--no-pager[Do not pipe output into a pager]' \
93 '--no-ask-password[Do not prompt for password]' \
94 {-H,--host=}'[Operate on remote host]:userathost:_hosts_or_user_at_host' \
95 '*::timedatectl commands:_timedatectl_command'
99 '--debug[Print debug messages to stderr]' \
100 '--version[Print version number]' \
101 '--help[Print help text]' \
102 '*::udevadm commands:_udevadm_command'
106 {-h,--help}'[Show help text.]' \
107 '--user[Shows performance data of user sessions instead of the system manager.]' \
108 '--order[When generating graph for dot, show only order]' \
109 '--require[When generating graph for dot, show only requirement]' \
110 '*::systemd-analyze commands:_systemd_analyze_command'
112 systemd-ask-password)
114 {-h,--help}'[Show this help]' \
115 '--icon=[Icon name]' \
116 '--timeout=[Timeout in sec]' \
117 '--no-tty[Ask question via agent even on TTY]' \
118 '--accept-cached[Accept cached passwords]' \
119 '--multiple[List multiple passwords if available]'
123 {-h,--help}'[Show this help]' \
124 '--version[Show package version.]' \
125 {-t,--identifier=}'[Set syslog identifier.]' \
126 {-p,--priority=}'[Set priority value.]:value:({0..7})' \
127 '--level-prefix=[Control whether level prefix shall be parsed.]:boolean:(1 0)' \
132 {-h,--help}'[Show this help]' \
133 '--version[Show package version]' \
134 '--no-pager[Do not pipe output into a pager]' \
135 {-a,--all}'[Show all groups, including empty]' \
136 '-k[Include kernel threads in output]' \
137 ':cgroups:(cpuset cpu cpuacct memory devices freezer net_cls blkio)'
141 {-h,--help}'[Show this help]' \
142 '--version[Print version and exit]' \
143 '(-c -m -i -t)-p[Order by path]' \
144 '(-c -p -m -i)-t[Order by number of tasks]' \
145 '(-m -p -i -t)-c[Order by CPU load]' \
146 '(-c -p -i -t)-m[Order by memory load]' \
147 '(-c -m -p -t)-i[Order by IO load]' \
148 {-d,--delay=}'[Specify delay]' \
149 {-n,--iterations=}'[Run for N iterations before exiting]' \
150 {-b,--batch}'[Run in batch mode, accepting no input]' \
151 '--depth=[Maximum traversal depth]'
155 {-h,--help}'[Show this help]' \
156 '--version[Show package version]' \
157 '--no-pager[Do not pipe output into a pager]' \
158 '--diff=[Show a diff when overridden files differ]:boolean:(1 0)' \
159 {-t,--type=}'[Only display a selected set of override types]:types:(masked equivalent redirected overridden unchanged)' \
160 ':SUFFIX:(tmpfiles.d sysctl.d systemd/system)'
164 {-h,--help}'[Show this help]' \
165 '--version[Show package version]' \
166 {-c,--container}'[Only detect whether we are run in a container]' \
167 {-v,--vm}'[Only detect whether we are run in a VM]' \
168 {-q,--quiet}"[Don't output anything, just set return value]"
172 {-h,--help}'[Show this help]' \
173 '--version[Show package version]' \
174 '--what=[Operations to inhibit]:options:(shutdown sleep idle handle-power-key handle-suspend-key handle-hibernate-key handle-lid-switch)' \
175 '--who=[A descriptive string who is inhibiting]' \
176 '--why=[A descriptive string why is being inhibited]' \
177 '--mode=[One of block or delay]' \
178 '--list[List active inhibitors]' \
179 '*:commands:_systemd_inhibit_command'
181 systemd-machine-id-setup)
183 {-h,--help}'[Show this help]' \
184 '--version[Show package version]'
188 {-h,--help}'[Show this help]' \
189 '--version[Show package version]' \
190 '--ready[Inform the init system about service start-up completion.]' \
191 '--pid=[Inform the init system about the main PID of the daemon]' \
192 '--status=[Send a free-form status string for the daemon to the init systemd]' \
193 '--booted[Returns 0 if the system was booted up with systemd]' \
194 '--readahead=[Controls disk read-ahead operations]:arguments:(cancel done noreply)'
198 {-h,--help}'[Show this help]' \
199 {--directory=,-D}'[Directory to use as file system root for the namespace container. If omitted the current directory will be used.]:directories:_directories' \
200 {--boot,-b}'[Automatically search for an init binary and invoke it instead of a shell or a user supplied program.]' \
201 {--user=,-u}'[Run the command under specified user, create home directory and cd into it.]' \
202 '--uuid=[Set the specified uuid for the container.]' \
203 {--controllers=,-C}'[Makes the container appear in other hierarchies than the name=systemd:/ one. Takes a comma-separated list of controllers.]' \
204 '--private-network[Turn off networking in the container. This makes all network interfaces unavailable in the container, with the exception of the loopback device.]' \
205 '--read-only[Mount the root file system read only for the container.]' \
206 '--capability=[List one or more additional capabilities to grant the container.]:capabilities:_systemd-nspawn' \
207 "--link-journal=[Control whether the container's journal shall be made visible to the host system.]:options:(no, host, guest, auto)" \
208 '-j[Equivalent to --link-journal=guest.]'
212 '--create[Create, set ownership/permissions based on the config files.]' \
213 '--clean[Clean up all files and directories with an age parameter configured.]' \
214 '--remove[All files and directories marked with r, R in the configuration files are removed.]' \
215 '--prefix=[Only apply rules that apply to paths with the specified prefix.]' \
216 '--exclude-prefix=[Ignore rules that apply to paths with the specified prefix.]' \
217 '--help[Prints a short help text and exits.]' \
220 systemd-tty-ask-password-agent)
222 {-h,--help}'[Prints a short help text and exits.]' \
223 '--version[Prints a short version string and exits.]' \
224 '--list[Lists all currently pending system password requests.]' \
225 '--query[Process all currently pending system password requests by querying the user on the calling TTY.]' \
226 '--watch[Continuously process password requests.]' \
227 '--wall[Forward password requests to wall(1).]' \
228 '--plymouth[Ask question with plymouth(8).]' \
229 '--console[Ask question on /dev/console.]'
233 {-h,--help}'[Prints a short help text and exits.]' \
234 '--version[Prints a short version string and exits.]' \
235 {-p,--property=}'[Limit output to specified property.]:property:(Name Id Timestamp TimestampMonotonic Service Scope Leader Class State RootDirectory)' \
236 {-a,--all}'[Show all proerties]' \
237 (-l,--full)'[Do not ellipsize cgroup members]' \
238 '--no-pager[Do not pipe output into a pager]' \
239 '--no-ask-password[Do not ask for system passwords]' \
240 '--kill-who=[Who to send signal to]:killwho:(leader all)' \
241 {-s,--signal=}'[Which signal to send]:signal:_signals' \
242 {-H,--host=}'[Show information for remote host]:userathost:_hosts_or_user_at_host' \
243 {-P,--privileged}'[Acquire privileges before execution]' \
244 '*::machinectl command:_machinectl_command'
252 _caps=( CAP_CHOWN CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH
253 CAP_FOWNER CAP_FSETID CAP_IPC_OWNER CAP_KILL CAP_LEASE CAP_LINUX_IMMUTABLE
254 CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SETGID CAP_SETFCAP CAP_SETPCAP
255 CAP_SETUID CAP_SYS_ADMIN CAP_SYS_CHROOT CAP_SYS_NICE CAP_SYS_PTRACE CAP_SYS_TTY_CONFIG
256 CAP_SYS_RESOURCE CAP_SYS_BOOT )
257 _values -s , 'capabilities' "$_caps[@]"
260 _systemd_inhibit_command(){
261 if (( CURRENT == 1 )); then
265 local n=${words[(b:2:i)[^-]*]}
266 if (( n <= CURRENT )); then
269 'files:file:_files' \
270 'commands:command:_normal' && return 0
277 _systemd_analyze_command(){
278 local -a _systemd_analyze_cmds
279 # Descriptions taken from systemd-analyze --help.
280 _systemd_analyze_cmds=(
281 'time:Print time spent in the kernel before reaching userspace'
282 'blame:Print list of running units ordered by time to init'
283 'critical-chain:Print a tree of the time critical chain of units'
284 'plot:Output SVG graphic showing service initialization'
285 'dot:Dump dependency graph (in dot(1) format)'
288 if (( CURRENT == 1 )); then
289 _describe "options" _systemd_analyze_cmds
291 _message "no more options"
295 _hosts_or_user_at_host()
298 'users-hosts:: _user_at_host' \
303 local -a _output_opts
304 _output_opts=(short short-monotonic verbose export json json-pretty json-see cat)
305 _describe -t output 'output mode' _output_opts || compadd "$@"
309 local -a journal_fields
310 journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC}
311 ERRNO SYSLOG_{FACILITY,IDENTIFIER,PID}
312 _{P,U,G}ID _COMM _EXE _CMDLINE
313 _AUDIT_{SESSION,LOGINUID}
314 _SYSTEMD_{CGROUP,SESSION,UNIT,OWNER_UID}
316 _SELINUX_CONTEXT _SOURCE_REALTIME_TIMESTAMP
317 _{BOOT,MACHINE}_ID _HOSTNAME _TRANSPORT
318 _KERNEL_{DEVICE,SUBSYSTEM}
319 _UDEV_{SYSNAME,DEVNODE,DEVLINK}
320 __CURSOR __{REALTIME,MONOTONIC}_TIMESTAMP)
321 _describe 'possible fields' journal_fields
325 local -a _commands _files
326 _commands=( ${(f)"$(_call_program commands "$service" -F _EXE 2>/dev/null)"} )
328 'files:/dev files:_files -W /dev -P /dev/' \
329 "commands:commands:($_commands[@])" \
330 'fields:fields:_list_fields'
335 cmd=("journalctl" "-F ${@[-1]}" "2>/dev/null" )
336 _fields=( ${(f)"$(_call_program fields $cmd[@])"} )
338 _describe 'possible values' _fields
342 _loginctl_all_sessions(){_sys_all_sessions=($(loginctl list-sessions | { while read a b; do echo " $a"; done; }) )}
343 _loginctl_all_users() {_sys_all_users=( $(loginctl list-users | { while read a b; do echo " $a"; done; }) )}
344 _loginctl_all_seats() {_sys_all_seats=( $(loginctl list-seats | { while read a b; do echo " $a"; done; }) )}
346 # Completion functions for SESSIONS
347 for fun in session-status show-session activate lock-session unlock-session terminate-session kill-session ; do
348 (( $+functions[_loginctl_$fun] )) || _loginctl_$fun()
350 _loginctl_all_sessions
351 compadd "$@" -a - _sys_all_sessions
355 # Completion functions for USERS
356 for fun in user-status show-user enable-linger disable-linger terminate-user kill-user ; do
357 (( $+functions[_loginctl_$fun] )) || _loginctl_$fun()
360 compadd "$@" -a - _sys_all_users
364 # Completion functions for SEATS
365 (( $+functions[_loginctl_seats] )) || _loginctl_seats()
368 compadd "$@" -a - _sys_all_seats
370 for fun in seat-status show-seat terminate-seat ; do
371 (( $+functions[_loginctl_$fun] )) || _loginctl_$fun()
375 # Completion functions for ATTACH
376 (( $+functions[_loginctl_attach] )) || _loginctl_attach()
380 _arguments -w -C -S -s \
381 ':seat:_loginctl_seats' \
385 # no loginctl completion for:
386 # [STANDALONE]='list-sessions list-users list-seats flush-devices'
388 (( $+functions[_loginctl_command] )) || _loginctl_command()
390 local -a _loginctl_cmds
392 "list-sessions:List sessions"
393 "session-status:Show session status"
394 "show-session:Show properties of one or more sessions"
395 "activate:Activate a session"
396 "lock-session:Screen lock one or more sessions"
397 "unlock-session:Screen unlock one or more sessions"
398 "terminate-session:Terminate one or more sessions"
399 "kill-session:Send signal to processes of a session"
400 "list-users:List users"
401 "user-status:Show user status"
402 "show-user:Show properties of one or more users"
403 "enable-linger:Enable linger state of one or more users"
404 "disable-linger:Disable linger state of one or more users"
405 "terminate-user:Terminate all sessions of one or more users"
406 "kill-user:Send signal to processes of a user"
407 "list-seats:List seats"
408 "seat-status:Show seat status"
409 "show-seat:Show properties of one or more seats"
410 "attach:Attach one or more devices to a seat"
411 "flush-devices:Flush all device associations"
412 "terminate-seat:Terminate all sessions on one or more seats"
415 if (( CURRENT == 1 )); then
416 _describe -t commands 'loginctl command' _loginctl_cmds || compadd "$@"
418 local curcontext="$curcontext"
420 cmd="${${_loginctl_cmds[(r)$words[1]:*]%%:*}}"
423 curcontext="${curcontext%:*:*}:loginctl-${cmd}:"
425 _call_function ret _loginctl_$cmd || _message 'no more arguments'
427 _message "unknown loginctl command: $words[1]"
433 _hostnamectl_command() {
434 local -a _hostnamectl_cmds
436 "status:Show current hostname settings"
437 "set-hostname:Set system hostname"
438 "set-icon-name:Set icon name for host"
440 if (( CURRENT == 1 )); then
441 _describe -t commands 'hostnamectl commands' _hostnamectl_cmds || compadd "$@"
443 local curcontext="$curcontext"
444 cmd="${${_hostnamectl_cmds[(r)$words[1]:*]%%:*}}"
446 [[ $cmd == status ]] && msg="no options" || msg="options for $cmd"
449 _message "unknown hostnamectl command: $words[1]"
454 _localectl_set-locale() {
455 local -a _confs _locales
457 _locales=( ${(f)"$(_call_program locales "$service" list-locales)"} )
458 _confs=( ${${(f)"$(_call_program confs "locale 2>/dev/null")"}%\=*} )
459 if [[ -prefix 1 *\= ]]; then
460 local conf=${PREFIX%%\=*}
462 _wanted locales expl "locales configs" \
463 _combination localeconfs confs=$conf locales "$@" -
465 compadd -S '=' $_confs
469 _localectl_set-keymap() {
471 _keymaps=( ${(f)"$(_call_program locales "$service" list-keymaps)"} )
472 if (( CURRENT <= 3 )); then
473 _describe keymaps _keymaps
475 _message "no more options"
479 _localectl_set-x11-keymap() {
480 if (( $+commands[pkg-config] )); then
481 local -a _file _layout _model _variant _options
483 _xorg_lst=${"$($commands[pkg-config] xkeyboard-config --variable=xkb_base)"}
484 _file=( ${(ps:\n\!:)"$(<$_xorg_lst/rules/xorg.lst)"} )
485 _layout=( ${${${(M)${(f)_file[1]}:# *}# }%% *} )
486 _model=( ${${${(M)${(f)_file[2]}:# *}# }%% *} )
487 _variant=( ${${${(M)${(f)_file[3]}:# *}# }%% *} )
488 _options=( ${${${(M)${(f)_file[4]}:# *}# }%% *} )
489 #_layout=( ${(f)"$( echo $_file[1] | awk '/^ / {print $1}' )"} )
490 #_model=( ${(f)"$(echo $_file[2] | awk '/^ / {print $1}')"} )
491 #_variant=( ${(f)"$(echo $_file[3] | awk '/^ / {print $1}')"} )
492 #_options=( ${(f)"$(echo ${_file[4]//:/\\:} | awk '/^ / {print $1}')"} )
495 2) _describe layouts _layout ;;
496 3) _describe models _model;;
497 4) _describe variants _variant;;
498 5) _describe options _options;;
499 *) _message "no more options"
505 _localectl_command() {
506 local -a _localectl_cmds
508 'status:Show current locale settings'
509 'set-locale:Set system locale'
510 'list-locales:Show known locales'
511 'set-keymap:Set virtual console keyboard mapping'
512 'list-keymaps:Show known virtual console keyboard mappings'
513 'set-x11-keymap:Set X11 keyboard mapping'
515 if (( CURRENT == 1 )); then
516 _describe -t commands 'localectl command' _localectl_cmds
518 local curcontext="$curcontext"
519 cmd="${${_localectl_cmds[(r)$words[1]:*]%%:*}}"
520 if (( $+functions[_localectl_$cmd] )); then
523 _message "no more options"
528 _timedatectl_set-timezone(){
530 _timezones=( ${(f)"$(_call_program timezones "${service}" list-timezones)"} )
531 compadd "$_timezones[@]"
534 _timedatectl_set-time(){
535 _message "YYYY-MM-DD HH:MM:SS"
538 _timedatectl_set-local-rtc(){
541 '0:Maintain RTC in universal time'
542 '1:Maintain RTC in local time'
544 _describe options _options
547 _timedatectl_set-ntp(){
550 '0:Disable NTP based network time configuration'
551 '1:Enable NTP based network time configuration'
553 _describe options _options
556 _timedatectl_command(){
557 local -a _timedatectl_cmds
559 'status:Show current time settings'
560 'set-time:Set system time'
561 'set-timezone:Set system timezone'
562 'list-timezones:Show known timezones'
563 'set-local-rtc:Control whether RTC is in local time'
564 'set-ntp:Control whether NTP is enabled'
566 if (( CURRENT == 1 )); then
567 _describe -t commands 'timedatectl command' _timedatectl_cmds
569 local curcontext="$curcontext"
570 cmd="${${_timedatectl_cmds[(r)$words[1]:*]%%:*}}"
572 if (( $+functions[_timedatectl_$cmd] )); then
575 _message "no more options"
578 _message "unknown timedatectl command: $words[1]"
582 _systemd-coredumpctl_command(){
583 local -a _systemd_coredumpctl_cmds
584 _systemd_coredumpctl_cmds=(
585 'list:List available coredumps'
586 'dump:Print coredump to std'
588 if (( CURRENT == 1 )); then
589 _describe -t commands 'systemd-coredumpctl command' _systemd_coredumpctl_cmds
591 local curcontext="$curcontext"
593 cmd="${${_systemd_coredumpctl_cmds[(r)$words[1]:*]%%:*}}"
595 # user can set zstyle ':completion:*:*:systemd-coredumpctl:*' sort no for coredumps to be ordered by date, otherwise they get ordered by pid
596 _dumps=( "${(foa)$(systemd-coredumpctl list | awk 'BEGIN{OFS=":"} /^\s/ {sub(/[[ \t]+/, ""); print $5,$0}' 2>/dev/null)}" )
597 if [[ -n "$_dumps" ]]; then
598 _describe -t pids 'coredumps' _dumps
600 _message "no coredumps"
603 _message "no more options"
610 (( $+functions[_machinectl_command] )) || _machinectl_command()
612 local -a _machinectl_cmds
614 "list:List currently running VMs/containers"
615 "status:Show VM/container status"
616 "show:Show properties of one or more VMs/containers"
617 "terminate:Terminate one or more VMs/containers"
618 "kill:Send signal to process or a VM/container"
620 if (( CURRENT == 1 )); then
621 _describe -t commands 'machinectl command' _machinectl_cmds || compadd "$@"
623 local curcontext="$curcontext"
624 cmd="${${_machinectl_cmds[(r)$words[1]:*]%%:*}}"
627 list) msg="no options" ;;
629 _machines=( "${(foa)$(machinectl list | awk '{print $1}')}" )
630 if [[ -n "$_machines" ]]; then
631 _describe 'machines' _machines
633 _message 'no machines'
637 _message "no more options"
644 '--query=[Query the database for specified type of device data. It needs the --path or --name to identify the specified device.]:type:(name symlink path property all)' \
645 '--path=[The devpath of the device to query.]:sys files:_files -P /sys/ -W /sys' \
646 '--name=[The name of the device node or a symlink to query]:device files:_files -P /dev/ -W /dev' \
647 '--root[Print absolute paths in name or symlink query.]' \
648 '--attribute-walk[Print all sysfs properties of the specified device that can be used in udev rules to match the specified device]' \
649 '--export[Print output as key/value pairs.]' \
650 '--export-prefix=[Add a prefix to the key name of exported values.]:prefix' \
651 '--device-id-of-file=[Print major/minor numbers of the underlying device, where the file lives on.]:files:_udevadm_mounts' \
652 '--export-db[Export the content of the udev database.]' \
653 '--cleanup-db[Cleanup the udev database.]'
658 '--verbose[Print the list of devices which will be triggered.]' \
659 '--dry-run[Do not actually trigger the event.]' \
660 '--type=[Trigger a specific type of devices.]:types:(devices subsystems failed)' \
661 '--action=[Type of event to be triggered.]:actions:(add change remove)' \
662 '--subsystem-match=[Trigger events for devices which belong to a matching subsystem.]' \
663 '--subsystem-nomatch=[Do not trigger events for devices which belong to a matching subsystem.]' \
664 '--attr-match=attribute=[Trigger events for devices with a matching sysfs attribute.]' \
665 '--attr-nomatch=attribute=[Do not trigger events for devices with a matching sysfs attribute.]' \
666 '--property-match=[Trigger events for devices with a matching property value.]' \
667 '--tag-match=property[Trigger events for devices with a matching tag.]' \
668 '--sysname-match=[Trigger events for devices with a matching sys device name.]' \
669 '--parent-match=[Trigger events for all children of a given device.]'
674 '--timeout=[Maximum number of seconds to wait for the event queue to become empty.]' \
675 '--seq-start=[Wait only for events after the given sequence number.]' \
676 '--seq-end=[Wait only for events before the given sequence number.]' \
677 '--exit-if-exists=[Stop waiting if file exists.]:files:_files' \
678 '--quiet[Do not print any output, like the remaining queue entries when reaching the timeout.]' \
679 '--help[Print help text.]'
684 '--exit[Signal and wait for systemd-udevd to exit.]' \
685 '--log-priority=[Set the internal log level of systemd-udevd.]:priorities:(err info debug)' \
686 '--stop-exec-queue[Signal systemd-udevd to stop executing new events. Incoming events will be queued.]' \
687 '--start-exec-queue[Signal systemd-udevd to enable the execution of events.]' \
688 '--reload[Signal systemd-udevd to reload the rules files and other databases like the kernel module index.]' \
689 '--property=[Set a global property for all events.]' \
690 '--children-max=[Set the maximum number of events.]' \
691 '--timeout=[The maximum number of seconds to wait for a reply from systemd-udevd.]' \
692 '--help[Print help text.]'
697 '--kernel[Print the kernel uevents.]' \
698 '--udev[Print the udev event after the rule processing.]' \
699 '--property[Also print the properties of the event.]' \
700 '--subsystem-match=[Filter events by subsystem/\[devtype\].]' \
701 '--tag-match=[Filter events by property.]' \
702 '--help[Print help text.]'
707 '--action=[The action string.]:actions:(add change remove)' \
708 '--subsystem=[The subsystem string.]' \
709 '--help[Print help text.]' \
710 '*::devpath:_files -P /sys/ -W /sys'
713 _udevadm_test-builtin(){
714 if (( CURRENT == 2 )); then
716 '--help[Print help text]' \
717 '*::builtins:(blkid btrfs hwdb input_id kmod path_id usb_id uaccess)'
718 elif (( CURRENT == 3 )); then
720 '--help[Print help text]' \
721 '*::syspath:_files -P /sys -W /sys'
724 '--help[Print help text]'
729 local dev_tmp dpath_tmp mp_tmp mline
731 tmp=( "${(@f)$(< /etc/mtab)}" )
732 dev_tmp=( "${(@)${(@)tmp%% *}:#none}" )
733 mp_tmp=( "${(@)${(@)tmp#* }%% *}" )
736 mp_tmp=("${(@q)mp_tmp//(#m)\\[0-7](#c3)/${(#)$(( 8#${MATCH[2,-1]} ))}}")
737 dpath_tmp=( "${(@Mq)dev_tmp:#/*}" )
738 dev_tmp=( "${(@q)dev_tmp:#/*}" )
741 'device-paths: device path:compadd -a dpath_tmp' \
742 'directories:mount point:compadd -a mp_tmp'
747 local -a _udevadm_cmds
749 'info:query sysfs or the udev database'
750 'trigger:request events from the kernel'
751 'settle:wait for the event queue to finish'
752 'control:control the udev daemon'
753 'monitor:listen to kernel and udev events'
754 'test:test an event run'
755 'test-builtin:test a built-in command'
758 if ((CURRENT == 1)); then
759 _describe -t commands 'udevadm commands' _udevadm_cmds
761 local curcontext="$curcontext"
762 cmd="${${_udevadm_cmds[(r)$words[1]:*]%%:*}}"
764 if (( $+functions[_udevadm_$cmd] )); then
767 _message "no options for $cmd"
770 _message "no more options"
777 #vim: set ft=zsh sw=4 ts=4 et