| 1 |
#compdef systemd-hwdb |
| 2 |
# SPDX-License-Identifier: LGPL-2.1-or-later |
| 3 |
|
| 4 |
local context state state_descr line |
| 5 |
typeset -A opt_args |
| 6 |
|
| 7 |
local -a opt_common=( |
| 8 |
{-h,--help}'[show this help]' |
| 9 |
'--version[show package version]' |
| 10 |
{-s,--strict}'[when updating, return non-zero exit value on any parsing error]' |
| 11 |
'--usr[generate in /usr/lib/udev instead of /etc/udev]' |
| 12 |
{-r+,--root=}'[alternative root path in the filesystem]:path:_directories' |
| 13 |
) |
| 14 |
|
| 15 |
local -a hwdb_commands=( |
| 16 |
'update:update the hwdb database' |
| 17 |
'query:query database and print result' |
| 18 |
) |
| 19 |
|
| 20 |
local ret=1 |
| 21 |
_arguments -s -A '-*' "$opt_common[@]" \ |
| 22 |
':command:->command' \ |
| 23 |
'*:: :->option-or-argument' && ret=0 |
| 24 |
|
| 25 |
case $state in |
| 26 |
command) |
| 27 |
_describe -t command 'systemd-hwdb command' hwdb_commands && ret=0 |
| 28 |
;; |
| 29 |
option-or-argument) |
| 30 |
case $words[1] in |
| 31 |
update) |
| 32 |
_arguments -s "$opt_common[@]" && ret=0 |
| 33 |
;; |
| 34 |
query) |
| 35 |
_arguments -s "$opt_common[@]" ':modalias:' && ret=0 |
| 36 |
;; |
| 37 |
esac |
| 38 |
;; |
| 39 |
esac |
| 40 |
return ret |