#compdef flavours

autoload -U is-at-least

_flavours() {
    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+[Specify a configuration file (Defaults to ~/.config/flavours/config.toml)]: :_files' \
'--config=[Specify a configuration file (Defaults to ~/.config/flavours/config.toml)]: :_files' \
'-d+[Specify a data directory (Defaults to ~/.local/share/flavours)]: :_files -/' \
'--directory=[Specify a data directory (Defaults to ~/.local/share/flavours)]: :_files -/' \
'--completions=[Generates completion for given shell, outputs to stdout]: :(bash elvish fish powershell zsh)' \
'-v[Be more verbose]' \
'--verbose[Be more verbose]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
":: :_flavours_commands" \
"*::: :->flavours" \
&& ret=0
    case $state in
    (flavours)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:flavours-command-$line[1]:"
        case $line[1] in
            (current)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
&& ret=0
;;
(list)
_arguments "${_arguments_options[@]}" \
'-l[Print each scheme on its own line]' \
'--lines[Print each scheme on its own line]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'*::pattern -- Scheme name or glob pattern to match when listing scheme(s). If ommited, defaults to * (all installed schemes).:($(flavours list))' \
&& ret=0
;;
(info)
_arguments "${_arguments_options[@]}" \
'-r[Don'\''t pretty print the colors.]' \
'--raw[Don'\''t pretty print the colors.]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'*::pattern -- Scheme name or glob pattern to match when showing scheme(s). If ommited, defaults to * (all installed schemes).:($(flavours list))' \
&& ret=0
;;
(generate)
_arguments "${_arguments_options[@]}" \
'-s+[Scheme slug (the name you specify when applying schemes) to output to. If ommited, defaults to '\''generated'\'']: :($(flavours list))' \
'--slug=[Scheme slug (the name you specify when applying schemes) to output to. If ommited, defaults to '\''generated'\'']: :($(flavours list))' \
'-n+[Scheme display name (can include spaces and capitalization) to write, defaults to '\''Generated'\'']: :( )' \
'--name=[Scheme display name (can include spaces and capitalization) to write, defaults to '\''Generated'\'']: :( )' \
'-a+[Scheme author info (name, email, etc) to write, defaults to '\''Flavours'\'']: :( )' \
'--author=[Scheme author info (name, email, etc) to write, defaults to '\''Flavours'\'']: :( )' \
'--stdout[Outputs scheme to stdout instead of writing it to a file.]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
':mode -- Whether to generate a dark or light scheme:(dark light)' \
':file -- Which image file to use.:_files' \
&& ret=0
;;
(apply)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'*::pattern -- Scheme to be applied, supports glob. If more than one is specified (or if glob pattern matched more than one), chooses one randomly. If ommited, defaults to * (all installed schemes).:($(flavours list))' \
&& ret=0
;;
(update)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
':operation -- Update sources lists from repositories or (re)download schemes/templates specified in the lists. Default repositories for lists, and the lists themselves, can be manually changed.:(lists schemes templates all)' \
&& ret=0
;;
        esac
    ;;
esac
}

(( $+functions[_flavours_commands] )) ||
_flavours_commands() {
    local commands; commands=(
        "current:Prints last applied scheme name" \
"list:Prints a list with all matching schemes" \
"info:Shows scheme colors for all schemes matching pattern. Optionally uses truecolor" \
"generate:Generates a scheme based on an image" \
"apply:Applies scheme, according to user configuration" \
"update:Downloads schemes, templates, or updates their lists (from repos specified in sources.yml)" \
    )
    _describe -t commands 'flavours commands' commands "$@"
}
(( $+functions[_flavours__apply_commands] )) ||
_flavours__apply_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'flavours apply commands' commands "$@"
}
(( $+functions[_flavours__current_commands] )) ||
_flavours__current_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'flavours current commands' commands "$@"
}
(( $+functions[_flavours__generate_commands] )) ||
_flavours__generate_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'flavours generate commands' commands "$@"
}
(( $+functions[_flavours__info_commands] )) ||
_flavours__info_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'flavours info commands' commands "$@"
}
(( $+functions[_flavours__list_commands] )) ||
_flavours__list_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'flavours list commands' commands "$@"
}
(( $+functions[_flavours__update_commands] )) ||
_flavours__update_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'flavours update commands' commands "$@"
}

_flavours "$@"
