#compdef flawz

autoload -U is-at-least

_flawz() {
    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[@]}" : \
'--url=[A URL where NIST CVE 1.1 feeds can be found]:URL:_default' \
'*-f+[List of feeds that are going to be synced]' \
'*--feeds=[List of feeds that are going to be synced]' \
'-d+[Path to the SQLite database used to store the synced CVE data]:DB:_default' \
'--db=[Path to the SQLite database used to store the synced CVE data]:DB:_default' \
'-q+[Start with a search query]:QUERY:_default' \
'--query=[Start with a search query]:QUERY:_default' \
'-t+[Set the theme]:THEME:((dracula\:"Dracula"
nord\:"Nord"
one-dark\:"One Dark"
solarized-dark\:"Solarized Dark"
gruvbox-light\:"Gruvbox Light"))' \
'--theme=[Set the theme]:THEME:((dracula\:"Dracula"
nord\:"Nord"
one-dark\:"One Dark"
solarized-dark\:"Solarized Dark"
gruvbox-light\:"Gruvbox Light"))' \
'-u[Always fetch feeds]' \
'--force-update[Always fetch feeds]' \
'-o[Do not fetch feeds]' \
'--offline[Do not fetch feeds]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
&& ret=0
}

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

if [ "$funcstack[1]" = "_flawz" ]; then
    _flawz "$@"
else
    compdef _flawz flawz
fi
