|
1 | | -#compdef 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 |
| 1 | +#compdef 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 |
2 | 2 |
|
3 | 3 | _ctls() |
4 | 4 | { |
5 | 5 | local curcontext="$curcontext" state lstate line |
6 | 6 | case "$service" in |
7 | | - udevadm) |
8 | | - _arguments \ |
9 | | - '--debug[Print debug messages to stderr]' \ |
10 | | - '--version[Print version number]' \ |
11 | | - '--help[Print help text]' \ |
12 | | - '*::udevadm commands:_udevadm_command' |
13 | | - ;; |
14 | 7 | systemd-analyze) |
15 | 8 | _arguments \ |
16 | 9 | {-h,--help}'[Show help text.]' \ |
@@ -247,139 +240,6 @@ _outputmodes() { |
247 | 240 | fi |
248 | 241 | } |
249 | 242 |
|
250 | | -_udevadm_info(){ |
251 | | - _arguments \ |
252 | | - '--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)' \ |
253 | | - '--path=[The devpath of the device to query.]:sys files:_files -P /sys/ -W /sys' \ |
254 | | - '--name=[The name of the device node or a symlink to query]:device files:_files -P /dev/ -W /dev' \ |
255 | | - '--root[Print absolute paths in name or symlink query.]' \ |
256 | | - '--attribute-walk[Print all sysfs properties of the specified device that can be used in udev rules to match the specified device]' \ |
257 | | - '--export[Print output as key/value pairs.]' \ |
258 | | - '--export-prefix=[Add a prefix to the key name of exported values.]:prefix' \ |
259 | | - '--device-id-of-file=[Print major/minor numbers of the underlying device, where the file lives on.]:files:_udevadm_mounts' \ |
260 | | - '--export-db[Export the content of the udev database.]' \ |
261 | | - '--cleanup-db[Cleanup the udev database.]' |
262 | | -} |
263 | | - |
264 | | -_udevadm_trigger(){ |
265 | | - _arguments \ |
266 | | - '--verbose[Print the list of devices which will be triggered.]' \ |
267 | | - '--dry-run[Do not actually trigger the event.]' \ |
268 | | - '--type=[Trigger a specific type of devices.]:types:(devices subsystems failed)' \ |
269 | | - '--action=[Type of event to be triggered.]:actions:(add change remove)' \ |
270 | | - '--subsystem-match=[Trigger events for devices which belong to a matching subsystem.]' \ |
271 | | - '--subsystem-nomatch=[Do not trigger events for devices which belong to a matching subsystem.]' \ |
272 | | - '--attr-match=attribute=[Trigger events for devices with a matching sysfs attribute.]' \ |
273 | | - '--attr-nomatch=attribute=[Do not trigger events for devices with a matching sysfs attribute.]' \ |
274 | | - '--property-match=[Trigger events for devices with a matching property value.]' \ |
275 | | - '--tag-match=property[Trigger events for devices with a matching tag.]' \ |
276 | | - '--sysname-match=[Trigger events for devices with a matching sys device name.]' \ |
277 | | - '--parent-match=[Trigger events for all children of a given device.]' |
278 | | -} |
279 | | - |
280 | | -_udevadm_settle(){ |
281 | | - _arguments \ |
282 | | - '--timeout=[Maximum number of seconds to wait for the event queue to become empty.]' \ |
283 | | - '--seq-start=[Wait only for events after the given sequence number.]' \ |
284 | | - '--seq-end=[Wait only for events before the given sequence number.]' \ |
285 | | - '--exit-if-exists=[Stop waiting if file exists.]:files:_files' \ |
286 | | - '--quiet[Do not print any output, like the remaining queue entries when reaching the timeout.]' \ |
287 | | - '--help[Print help text.]' |
288 | | -} |
289 | | - |
290 | | -_udevadm_control(){ |
291 | | - _arguments \ |
292 | | - '--exit[Signal and wait for systemd-udevd to exit.]' \ |
293 | | - '--log-priority=[Set the internal log level of systemd-udevd.]:priorities:(err info debug)' \ |
294 | | - '--stop-exec-queue[Signal systemd-udevd to stop executing new events. Incoming events will be queued.]' \ |
295 | | - '--start-exec-queue[Signal systemd-udevd to enable the execution of events.]' \ |
296 | | - '--reload[Signal systemd-udevd to reload the rules files and other databases like the kernel module index.]' \ |
297 | | - '--property=[Set a global property for all events.]' \ |
298 | | - '--children-max=[Set the maximum number of events.]' \ |
299 | | - '--timeout=[The maximum number of seconds to wait for a reply from systemd-udevd.]' \ |
300 | | - '--help[Print help text.]' |
301 | | -} |
302 | | - |
303 | | -_udevadm_monitor(){ |
304 | | - _arguments \ |
305 | | - '--kernel[Print the kernel uevents.]' \ |
306 | | - '--udev[Print the udev event after the rule processing.]' \ |
307 | | - '--property[Also print the properties of the event.]' \ |
308 | | - '--subsystem-match=[Filter events by subsystem/\[devtype\].]' \ |
309 | | - '--tag-match=[Filter events by property.]' \ |
310 | | - '--help[Print help text.]' |
311 | | -} |
312 | | - |
313 | | -_udevadm_test(){ |
314 | | - _arguments \ |
315 | | - '--action=[The action string.]:actions:(add change remove)' \ |
316 | | - '--subsystem=[The subsystem string.]' \ |
317 | | - '--help[Print help text.]' \ |
318 | | - '*::devpath:_files -P /sys/ -W /sys' |
319 | | -} |
320 | | - |
321 | | -_udevadm_test-builtin(){ |
322 | | - if (( CURRENT == 2 )); then |
323 | | - _arguments \ |
324 | | - '--help[Print help text]' \ |
325 | | - '*::builtins:(blkid btrfs hwdb input_id kmod path_id usb_id uaccess)' |
326 | | - elif (( CURRENT == 3 )); then |
327 | | - _arguments \ |
328 | | - '--help[Print help text]' \ |
329 | | - '*::syspath:_files -P /sys -W /sys' |
330 | | - else |
331 | | - _arguments \ |
332 | | - '--help[Print help text]' |
333 | | - fi |
334 | | -} |
335 | | - |
336 | | -_udevadm_mounts(){ |
337 | | - local dev_tmp dpath_tmp mp_tmp mline |
338 | | - |
339 | | - tmp=( "${(@f)$(< /etc/mtab)}" ) |
340 | | - dev_tmp=( "${(@)${(@)tmp%% *}:#none}" ) |
341 | | - mp_tmp=( "${(@)${(@)tmp#* }%% *}" ) |
342 | | - |
343 | | - local MATCH |
344 | | - mp_tmp=("${(@q)mp_tmp//(#m)\\[0-7](#c3)/${(#)$(( 8#${MATCH[2,-1]} ))}}") |
345 | | - dpath_tmp=( "${(@Mq)dev_tmp:#/*}" ) |
346 | | - dev_tmp=( "${(@q)dev_tmp:#/*}" ) |
347 | | - |
348 | | - _alternative \ |
349 | | - 'device-paths: device path:compadd -a dpath_tmp' \ |
350 | | - 'directories:mount point:compadd -a mp_tmp' |
351 | | -} |
352 | | - |
353 | | - |
354 | | -_udevadm_command(){ |
355 | | - local -a _udevadm_cmds |
356 | | - _udevadm_cmds=( |
357 | | - 'info:query sysfs or the udev database' |
358 | | - 'trigger:request events from the kernel' |
359 | | - 'settle:wait for the event queue to finish' |
360 | | - 'control:control the udev daemon' |
361 | | - 'monitor:listen to kernel and udev events' |
362 | | - 'test:test an event run' |
363 | | - 'test-builtin:test a built-in command' |
364 | | - ) |
365 | | - |
366 | | - if ((CURRENT == 1)); then |
367 | | - _describe -t commands 'udevadm commands' _udevadm_cmds |
368 | | - else |
369 | | - local curcontext="$curcontext" |
370 | | - cmd="${${_udevadm_cmds[(r)$words[1]:*]%%:*}}" |
371 | | - if (($#cmd)); then |
372 | | - if (( $+functions[_udevadm_$cmd] )); then |
373 | | - _udevadm_$cmd |
374 | | - else |
375 | | - _message "no options for $cmd" |
376 | | - fi |
377 | | - else |
378 | | - _message "no more options" |
379 | | - fi |
380 | | - fi |
381 | | -} |
382 | | - |
383 | 243 | _ctls "$@" |
384 | 244 |
|
385 | 245 | #vim: set ft=zsh sw=4 ts=4 et |
0 commit comments