#compdef systemd-hwdb # SPDX-License-Identifier: LGPL-2.1-or-later local context state state_descr line typeset -A opt_args local -a opt_common=( {-h,--help}'[show this help]' '--version[show package version]' {-s,--strict}'[when updating, return non-zero exit value on any parsing error]' '--usr[generate in /usr/lib/udev instead of /etc/udev]' {-r+,--root=}'[alternative root path in the filesystem]:path:_directories' ) local -a hwdb_commands=( 'update:update the hwdb database' 'query:query database and print result' ) local ret=1 _arguments -s -A '-*' "$opt_common[@]" \ ':command:->command' \ '*:: :->option-or-argument' && ret=0 case $state in command) _describe -t command 'systemd-hwdb command' hwdb_commands && ret=0 ;; option-or-argument) case $words[1] in update) _arguments -s "$opt_common[@]" && ret=0 ;; query) _arguments -s "$opt_common[@]" ':modalias:' && ret=0 ;; esac ;; esac return ret