#compdef chwd

autoload -U is-at-least

_chwd() {
    typeset -A opt_args
    typeset -a _arguments_options
    local ret=1

    if is-at-least 5.2; then
        _arguments_options=(-s -S -C)
    else
        _arguments_options=(-s -C)
    fi

    local context curcontext="$curcontext" state line
    _arguments "${_arguments_options[@]}" : \
'-c+[Check profile]:profile:_default' \
'--check=[Check profile]:profile:_default' \
'(-r --remove)-i+[Install profile]:profile:_default' \
'(-r --remove)--install=[Install profile]:profile:_default' \
'(-i --install)-r+[Remove profile]:profile:_default' \
'(-i --install)--remove=[Remove profile]:profile:_default' \
'(-i --install -r --remove)-a+[Autoconfigure]::classid:_default' \
'(-i --install -r --remove)--autoconfigure=[Autoconfigure]::classid:_default' \
'--pmcachedir=[]:PMCACHEDIR:_default' \
'--pmconfig=[]:PMCONFIG:_default' \
'--pmroot=[]:PMROOT:_default' \
'-d[Show detailed info for listings]' \
'--detail[Show detailed info for listings]' \
'-f[Force reinstall]' \
'--force[Force reinstall]' \
'--list-installed[List installed kernels]' \
'--list[List available profiles for all devices]' \
'--list-all[List all profiles]' \
'--ai_sdk[Toggle AI SDK profiles]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
&& ret=0
}

(( $+functions[_chwd_commands] )) ||
_chwd_commands() {
    local commands; commands=()
    _describe -t commands 'chwd commands' commands "$@"
}

if [ "$funcstack[1]" = "_chwd" ]; then
    _chwd "$@"
else
    compdef _chwd chwd
fi
