HALF ECHO LEARN / REFERENCE COLLECTION

v262.2

shell-completion/zsh/_systemd-hwdb

1,084 bytesGit mode 100644Download original fileLGPL-2.1-or-later

Git blob: 92238d63ad3c7aaaeef6f186c2e8d7e16204cf37

Lines 1–41 of 41

#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