#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[@]}" \
'-c[Prints color codes with truecolor.]' \
'--color[Prints color codes with truecolor.]' \
'-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
;;
(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" \
"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__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 "$@"
