1 #compdef 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 {-o,--output=}'[Write output to FILE]:output file:_files' \
10 '--no-pager[Do not pipe output into a pager]' \
11 {-h,--help}'[Show this help]' \
12 '--version[Show package version]' \
13 '*::systemd-coredumpctl commands:_systemd-coredumpctl_command'
18 {-h,--help}'[Show this help]' \
19 '--version[Show package version]' \
20 '--adjust-system-clock[Adjust system clock when changing local RTC mode]' \
21 '--no-pager[Do not pipe output into a pager]' \
22 '--no-ask-password[Do not prompt for password]' \
23 {-H,--host=}'[Operate on remote host]:userathost:_hosts_or_user_at_host' \
24 '*::timedatectl commands:_timedatectl_command'
28 '--debug[Print debug messages to stderr]' \
29 '--version[Print version number]' \
30 '--help[Print help text]' \
31 '*::udevadm commands:_udevadm_command'
35 {-h,--help}'[Show help text.]' \
36 '--user[Shows performance data of user sessions instead of the system manager.]' \
37 '--order[When generating graph for dot, show only order]' \
38 '--require[When generating graph for dot, show only requirement]' \
39 '*::systemd-analyze commands:_systemd_analyze_command'
43 {-h,--help}'[Show this help]' \
44 '--icon=[Icon name]' \
45 '--timeout=[Timeout in sec]' \
46 '--no-tty[Ask question via agent even on TTY]' \
47 '--accept-cached[Accept cached passwords]' \
48 '--multiple[List multiple passwords if available]'
52 {-h,--help}'[Show this help]' \
53 '--version[Show package version.]' \
54 {-t,--identifier=}'[Set syslog identifier.]' \
55 {-p,--priority=}'[Set priority value.]:value:({0..7})' \
56 '--level-prefix=[Control whether level prefix shall be parsed.]:boolean:(1 0)' \
61 {-h,--help}'[Show this help]' \
62 '--version[Show package version]' \
63 '--no-pager[Do not pipe output into a pager]' \
64 {-a,--all}'[Show all groups, including empty]' \
65 '-k[Include kernel threads in output]' \
66 ':cgroups:(cpuset cpu cpuacct memory devices freezer net_cls blkio)'
70 {-h,--help}'[Show this help]' \
71 '--version[Print version and exit]' \
72 '(-c -m -i -t)-p[Order by path]' \
73 '(-c -p -m -i)-t[Order by number of tasks]' \
74 '(-m -p -i -t)-c[Order by CPU load]' \
75 '(-c -p -i -t)-m[Order by memory load]' \
76 '(-c -m -p -t)-i[Order by IO load]' \
77 {-d,--delay=}'[Specify delay]' \
78 {-n,--iterations=}'[Run for N iterations before exiting]' \
79 {-b,--batch}'[Run in batch mode, accepting no input]' \
80 '--depth=[Maximum traversal depth]'
84 {-h,--help}'[Show this help]' \
85 '--version[Show package version]' \
86 '--no-pager[Do not pipe output into a pager]' \
87 '--diff=[Show a diff when overridden files differ]:boolean:(1 0)' \
88 {-t,--type=}'[Only display a selected set of override types]:types:(masked equivalent redirected overridden unchanged)' \
89 ':SUFFIX:(tmpfiles.d sysctl.d systemd/system)'
93 {-h,--help}'[Show this help]' \
94 '--version[Show package version]' \
95 {-c,--container}'[Only detect whether we are run in a container]' \
96 {-v,--vm}'[Only detect whether we are run in a VM]' \
97 {-q,--quiet}"[Don't output anything, just set return value]"
101 {-h,--help}'[Show this help]' \
102 '--version[Show package version]' \
103 '--what=[Operations to inhibit]:options:(shutdown sleep idle handle-power-key handle-suspend-key handle-hibernate-key handle-lid-switch)' \
104 '--who=[A descriptive string who is inhibiting]' \
105 '--why=[A descriptive string why is being inhibited]' \
106 '--mode=[One of block or delay]' \
107 '--list[List active inhibitors]' \
108 '*:commands:_systemd_inhibit_command'
110 systemd-machine-id-setup)
112 {-h,--help}'[Show this help]' \
113 '--version[Show package version]'
117 {-h,--help}'[Show this help]' \
118 '--version[Show package version]' \
119 '--ready[Inform the init system about service start-up completion.]' \
120 '--pid=[Inform the init system about the main PID of the daemon]' \
121 '--status=[Send a free-form status string for the daemon to the init systemd]' \
122 '--booted[Returns 0 if the system was booted up with systemd]' \
123 '--readahead=[Controls disk read-ahead operations]:arguments:(cancel done noreply)'
127 {-h,--help}'[Show this help]' \
128 {--directory=,-D}'[Directory to use as file system root for the namespace container. If omitted the current directory will be used.]:directories:_directories' \
129 {--boot,-b}'[Automatically search for an init binary and invoke it instead of a shell or a user supplied program.]' \
130 {--user=,-u}'[Run the command under specified user, create home directory and cd into it.]' \
131 '--uuid=[Set the specified uuid for the container.]' \
132 {--controllers=,-C}'[Makes the container appear in other hierarchies than the name=systemd:/ one. Takes a comma-separated list of controllers.]' \
133 '--private-network[Turn off networking in the container. This makes all network interfaces unavailable in the container, with the exception of the loopback device.]' \
134 '--read-only[Mount the root file system read only for the container.]' \
135 '--capability=[List one or more additional capabilities to grant the container.]:capabilities:_systemd-nspawn' \
136 "--link-journal=[Control whether the container's journal shall be made visible to the host system.]:options:(no, host, guest, auto)" \
137 '-j[Equivalent to --link-journal=guest.]'
141 '--create[Create, set ownership/permissions based on the config files.]' \
142 '--clean[Clean up all files and directories with an age parameter configured.]' \
143 '--remove[All files and directories marked with r, R in the configuration files are removed.]' \
144 '--prefix=[Only apply rules that apply to paths with the specified prefix.]' \
145 '--exclude-prefix=[Ignore rules that apply to paths with the specified prefix.]' \
146 '--help[Prints a short help text and exits.]' \
149 systemd-tty-ask-password-agent)
151 {-h,--help}'[Prints a short help text and exits.]' \
152 '--version[Prints a short version string and exits.]' \
153 '--list[Lists all currently pending system password requests.]' \
154 '--query[Process all currently pending system password requests by querying the user on the calling TTY.]' \
155 '--watch[Continuously process password requests.]' \
156 '--wall[Forward password requests to wall(1).]' \
157 '--plymouth[Ask question with plymouth(8).]' \
158 '--console[Ask question on /dev/console.]'
162 {-h,--help}'[Prints a short help text and exits.]' \
163 '--version[Prints a short version string and exits.]' \
164 {-p,--property=}'[Limit output to specified property.]:property:(Name Id Timestamp TimestampMonotonic Service Scope Leader Class State RootDirectory)' \
165 {-a,--all}'[Show all proerties]' \
166 (-l,--full)'[Do not ellipsize cgroup members]' \
167 '--no-pager[Do not pipe output into a pager]' \
168 '--no-ask-password[Do not ask for system passwords]' \
169 '--kill-who=[Who to send signal to]:killwho:(leader all)' \
170 {-s,--signal=}'[Which signal to send]:signal:_signals' \
171 {-H,--host=}'[Show information for remote host]:userathost:_hosts_or_user_at_host' \
172 {-P,--privileged}'[Acquire privileges before execution]' \
173 '*::machinectl command:_machinectl_command'
181 _caps=( CAP_CHOWN CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH
182 CAP_FOWNER CAP_FSETID CAP_IPC_OWNER CAP_KILL CAP_LEASE CAP_LINUX_IMMUTABLE
183 CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SETGID CAP_SETFCAP CAP_SETPCAP
184 CAP_SETUID CAP_SYS_ADMIN CAP_SYS_CHROOT CAP_SYS_NICE CAP_SYS_PTRACE CAP_SYS_TTY_CONFIG
185 CAP_SYS_RESOURCE CAP_SYS_BOOT )
186 _values -s , 'capabilities' "$_caps[@]"
189 _systemd_inhibit_command(){
190 if (( CURRENT == 1 )); then
194 local n=${words[(b:2:i)[^-]*]}
195 if (( n <= CURRENT )); then
198 'files:file:_files' \
199 'commands:command:_normal' && return 0
206 _systemd_analyze_command(){
207 local -a _systemd_analyze_cmds
208 # Descriptions taken from systemd-analyze --help.
209 _systemd_analyze_cmds=(
210 'time:Print time spent in the kernel before reaching userspace'
211 'blame:Print list of running units ordered by time to init'
212 'critical-chain:Print a tree of the time critical chain of units'
213 'plot:Output SVG graphic showing service initialization'
214 'dot:Dump dependency graph (in dot(1) format)'
217 if (( CURRENT == 1 )); then
218 _describe "options" _systemd_analyze_cmds
220 _message "no more options"
224 _hosts_or_user_at_host()
227 'users-hosts:: _user_at_host' \
232 local -a _output_opts
233 _output_opts=(short short-monotonic verbose export json json-pretty json-see cat)
234 _describe -t output 'output mode' _output_opts || compadd "$@"
237 _timedatectl_set-timezone(){
239 _timezones=( ${(f)"$(_call_program timezones "${service}" list-timezones)"} )
240 compadd "$_timezones[@]"
243 _timedatectl_set-time(){
244 _message "YYYY-MM-DD HH:MM:SS"
247 _timedatectl_set-local-rtc(){
250 '0:Maintain RTC in universal time'
251 '1:Maintain RTC in local time'
253 _describe options _options
256 _timedatectl_set-ntp(){
259 '0:Disable NTP based network time configuration'
260 '1:Enable NTP based network time configuration'
262 _describe options _options
265 _timedatectl_command(){
266 local -a _timedatectl_cmds
268 'status:Show current time settings'
269 'set-time:Set system time'
270 'set-timezone:Set system timezone'
271 'list-timezones:Show known timezones'
272 'set-local-rtc:Control whether RTC is in local time'
273 'set-ntp:Control whether NTP is enabled'
275 if (( CURRENT == 1 )); then
276 _describe -t commands 'timedatectl command' _timedatectl_cmds
278 local curcontext="$curcontext"
279 cmd="${${_timedatectl_cmds[(r)$words[1]:*]%%:*}}"
281 if (( $+functions[_timedatectl_$cmd] )); then
284 _message "no more options"
287 _message "unknown timedatectl command: $words[1]"
291 _systemd-coredumpctl_command(){
292 local -a _systemd_coredumpctl_cmds
293 _systemd_coredumpctl_cmds=(
294 'list:List available coredumps'
295 'dump:Print coredump to std'
297 if (( CURRENT == 1 )); then
298 _describe -t commands 'systemd-coredumpctl command' _systemd_coredumpctl_cmds
300 local curcontext="$curcontext"
302 cmd="${${_systemd_coredumpctl_cmds[(r)$words[1]:*]%%:*}}"
304 # user can set zstyle ':completion:*:*:systemd-coredumpctl:*' sort no for coredumps to be ordered by date, otherwise they get ordered by pid
305 _dumps=( "${(foa)$(systemd-coredumpctl list | awk 'BEGIN{OFS=":"} /^\s/ {sub(/[[ \t]+/, ""); print $5,$0}' 2>/dev/null)}" )
306 if [[ -n "$_dumps" ]]; then
307 _describe -t pids 'coredumps' _dumps
309 _message "no coredumps"
312 _message "no more options"
319 (( $+functions[_machinectl_command] )) || _machinectl_command()
321 local -a _machinectl_cmds
323 "list:List currently running VMs/containers"
324 "status:Show VM/container status"
325 "show:Show properties of one or more VMs/containers"
326 "terminate:Terminate one or more VMs/containers"
327 "kill:Send signal to process or a VM/container"
329 if (( CURRENT == 1 )); then
330 _describe -t commands 'machinectl command' _machinectl_cmds || compadd "$@"
332 local curcontext="$curcontext"
333 cmd="${${_machinectl_cmds[(r)$words[1]:*]%%:*}}"
336 list) msg="no options" ;;
338 _machines=( "${(foa)$(machinectl list | awk '{print $1}')}" )
339 if [[ -n "$_machines" ]]; then
340 _describe 'machines' _machines
342 _message 'no machines'
346 _message "no more options"
353 '--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)' \
354 '--path=[The devpath of the device to query.]:sys files:_files -P /sys/ -W /sys' \
355 '--name=[The name of the device node or a symlink to query]:device files:_files -P /dev/ -W /dev' \
356 '--root[Print absolute paths in name or symlink query.]' \
357 '--attribute-walk[Print all sysfs properties of the specified device that can be used in udev rules to match the specified device]' \
358 '--export[Print output as key/value pairs.]' \
359 '--export-prefix=[Add a prefix to the key name of exported values.]:prefix' \
360 '--device-id-of-file=[Print major/minor numbers of the underlying device, where the file lives on.]:files:_udevadm_mounts' \
361 '--export-db[Export the content of the udev database.]' \
362 '--cleanup-db[Cleanup the udev database.]'
367 '--verbose[Print the list of devices which will be triggered.]' \
368 '--dry-run[Do not actually trigger the event.]' \
369 '--type=[Trigger a specific type of devices.]:types:(devices subsystems failed)' \
370 '--action=[Type of event to be triggered.]:actions:(add change remove)' \
371 '--subsystem-match=[Trigger events for devices which belong to a matching subsystem.]' \
372 '--subsystem-nomatch=[Do not trigger events for devices which belong to a matching subsystem.]' \
373 '--attr-match=attribute=[Trigger events for devices with a matching sysfs attribute.]' \
374 '--attr-nomatch=attribute=[Do not trigger events for devices with a matching sysfs attribute.]' \
375 '--property-match=[Trigger events for devices with a matching property value.]' \
376 '--tag-match=property[Trigger events for devices with a matching tag.]' \
377 '--sysname-match=[Trigger events for devices with a matching sys device name.]' \
378 '--parent-match=[Trigger events for all children of a given device.]'
383 '--timeout=[Maximum number of seconds to wait for the event queue to become empty.]' \
384 '--seq-start=[Wait only for events after the given sequence number.]' \
385 '--seq-end=[Wait only for events before the given sequence number.]' \
386 '--exit-if-exists=[Stop waiting if file exists.]:files:_files' \
387 '--quiet[Do not print any output, like the remaining queue entries when reaching the timeout.]' \
388 '--help[Print help text.]'
393 '--exit[Signal and wait for systemd-udevd to exit.]' \
394 '--log-priority=[Set the internal log level of systemd-udevd.]:priorities:(err info debug)' \
395 '--stop-exec-queue[Signal systemd-udevd to stop executing new events. Incoming events will be queued.]' \
396 '--start-exec-queue[Signal systemd-udevd to enable the execution of events.]' \
397 '--reload[Signal systemd-udevd to reload the rules files and other databases like the kernel module index.]' \
398 '--property=[Set a global property for all events.]' \
399 '--children-max=[Set the maximum number of events.]' \
400 '--timeout=[The maximum number of seconds to wait for a reply from systemd-udevd.]' \
401 '--help[Print help text.]'
406 '--kernel[Print the kernel uevents.]' \
407 '--udev[Print the udev event after the rule processing.]' \
408 '--property[Also print the properties of the event.]' \
409 '--subsystem-match=[Filter events by subsystem/\[devtype\].]' \
410 '--tag-match=[Filter events by property.]' \
411 '--help[Print help text.]'
416 '--action=[The action string.]:actions:(add change remove)' \
417 '--subsystem=[The subsystem string.]' \
418 '--help[Print help text.]' \
419 '*::devpath:_files -P /sys/ -W /sys'
422 _udevadm_test-builtin(){
423 if (( CURRENT == 2 )); then
425 '--help[Print help text]' \
426 '*::builtins:(blkid btrfs hwdb input_id kmod path_id usb_id uaccess)'
427 elif (( CURRENT == 3 )); then
429 '--help[Print help text]' \
430 '*::syspath:_files -P /sys -W /sys'
433 '--help[Print help text]'
438 local dev_tmp dpath_tmp mp_tmp mline
440 tmp=( "${(@f)$(< /etc/mtab)}" )
441 dev_tmp=( "${(@)${(@)tmp%% *}:#none}" )
442 mp_tmp=( "${(@)${(@)tmp#* }%% *}" )
445 mp_tmp=("${(@q)mp_tmp//(#m)\\[0-7](#c3)/${(#)$(( 8#${MATCH[2,-1]} ))}}")
446 dpath_tmp=( "${(@Mq)dev_tmp:#/*}" )
447 dev_tmp=( "${(@q)dev_tmp:#/*}" )
450 'device-paths: device path:compadd -a dpath_tmp' \
451 'directories:mount point:compadd -a mp_tmp'
456 local -a _udevadm_cmds
458 'info:query sysfs or the udev database'
459 'trigger:request events from the kernel'
460 'settle:wait for the event queue to finish'
461 'control:control the udev daemon'
462 'monitor:listen to kernel and udev events'
463 'test:test an event run'
464 'test-builtin:test a built-in command'
467 if ((CURRENT == 1)); then
468 _describe -t commands 'udevadm commands' _udevadm_cmds
470 local curcontext="$curcontext"
471 cmd="${${_udevadm_cmds[(r)$words[1]:*]%%:*}}"
473 if (( $+functions[_udevadm_$cmd] )); then
476 _message "no options for $cmd"
479 _message "no more options"
486 #vim: set ft=zsh sw=4 ts=4 et