#compdef swww

autoload -U is-at-least

_swww() {
    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[@]}" \
'-h[Print help information (use `--help` for more detail)]' \
'--help[Print help information (use `--help` for more detail)]' \
'-V[Print version information]' \
'--version[Print version information]' \
":: :_swww_commands" \
"*::: :->swww" \
&& ret=0
    case $state in
    (swww)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:swww-command-$line[1]:"
        case $line[1] in
            (clear)
_arguments "${_arguments_options[@]}" \
'-o+[Comma separated list of outputs to display the image at]:OUTPUTS: ' \
'--outputs=[Comma separated list of outputs to display the image at]:OUTPUTS: ' \
'-h[Print help information (use `--help` for more detail)]' \
'--help[Print help information (use `--help` for more detail)]' \
'::color -- Color to fill the screen with:' \
&& ret=0
;;
(img)
_arguments "${_arguments_options[@]}" \
'-o+[Comma separated list of outputs to display the image at]:OUTPUTS: ' \
'--outputs=[Comma separated list of outputs to display the image at]:OUTPUTS: ' \
'-f+[Filter to use when scaling images (run swww img --help to see options)]:FILTER: ' \
'--filter=[Filter to use when scaling images (run swww img --help to see options)]:FILTER: ' \
'-t+[Sets the type of transition. Default is '\''simple'\'', that fades into the new image]:TRANSITION_TYPE: ' \
'--transition-type=[Sets the type of transition. Default is '\''simple'\'', that fades into the new image]:TRANSITION_TYPE: ' \
'--transition-step=[How fast the transition approaches the new image]:TRANSITION_STEP: ' \
'--transition-speed=[How fast the transition '\''sweeps'\'' through the screen]:TRANSITION_SPEED: ' \
'--transition-fps=[Frame rate for the transition effect]:TRANSITION_FPS: ' \
'-h[Print help information (use `--help` for more detail)]' \
'--help[Print help information (use `--help` for more detail)]' \
':path -- Path to the image to display:_files -g "*.png|*.jpg|*.jpeg|*.gif|*.bmp|*.tif|*.tiff|*.ico|*.webp|*.pnm|*.pbm|*.pgm|*.ppm|*.tga|*.ff|*.farbfeld"_files' \
&& ret=0
;;
(init)
_arguments "${_arguments_options[@]}" \
'--no-daemon[Don'\''t fork the daemon. This will keep it running in the current terminal]' \
'-h[Print help information (use `--help` for more detail)]' \
'--help[Print help information (use `--help` for more detail)]' \
&& ret=0
;;
(kill)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(query)
_arguments "${_arguments_options[@]}" \
'-h[Print help information (use `--help` for more detail)]' \
'--help[Print help information (use `--help` for more detail)]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
":: :_swww__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:swww-help-command-$line[1]:"
        case $line[1] in
            (clear)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(img)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(init)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(kill)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(query)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_swww_commands] )) ||
_swww_commands() {
    local commands; commands=(
'clear:Fills the specified outputs with the given color' \
'img:Send an image (or animated gif) for the daemon to display' \
'init:Initialize the daemon' \
'kill:Kills the daemon' \
'query:Asks the daemon to print output information (names and dimensions)' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'swww commands' commands "$@"
}
(( $+functions[_swww__clear_commands] )) ||
_swww__clear_commands() {
    local commands; commands=()
    _describe -t commands 'swww clear commands' commands "$@"
}
(( $+functions[_swww__help__clear_commands] )) ||
_swww__help__clear_commands() {
    local commands; commands=()
    _describe -t commands 'swww help clear commands' commands "$@"
}
(( $+functions[_swww__help_commands] )) ||
_swww__help_commands() {
    local commands; commands=(
'clear:Fills the specified outputs with the given color' \
'img:Send an image (or animated gif) for the daemon to display' \
'init:Initialize the daemon' \
'kill:Kills the daemon' \
'query:Asks the daemon to print output information (names and dimensions)' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'swww help commands' commands "$@"
}
(( $+functions[_swww__help__help_commands] )) ||
_swww__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'swww help help commands' commands "$@"
}
(( $+functions[_swww__help__img_commands] )) ||
_swww__help__img_commands() {
    local commands; commands=()
    _describe -t commands 'swww help img commands' commands "$@"
}
(( $+functions[_swww__img_commands] )) ||
_swww__img_commands() {
    local commands; commands=()
    _describe -t commands 'swww img commands' commands "$@"
}
(( $+functions[_swww__help__init_commands] )) ||
_swww__help__init_commands() {
    local commands; commands=()
    _describe -t commands 'swww help init commands' commands "$@"
}
(( $+functions[_swww__init_commands] )) ||
_swww__init_commands() {
    local commands; commands=()
    _describe -t commands 'swww init commands' commands "$@"
}
(( $+functions[_swww__help__kill_commands] )) ||
_swww__help__kill_commands() {
    local commands; commands=()
    _describe -t commands 'swww help kill commands' commands "$@"
}
(( $+functions[_swww__kill_commands] )) ||
_swww__kill_commands() {
    local commands; commands=()
    _describe -t commands 'swww kill commands' commands "$@"
}
(( $+functions[_swww__help__query_commands] )) ||
_swww__help__query_commands() {
    local commands; commands=()
    _describe -t commands 'swww help query commands' commands "$@"
}
(( $+functions[_swww__query_commands] )) ||
_swww__query_commands() {
    local commands; commands=()
    _describe -t commands 'swww query commands' commands "$@"
}

_swww "$@"
