#compdef wpaperd

autoload -U is-at-least

_wpaperd() {
    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+[Path to the configuration (XDG_CONFIG_HOME/wpaperd/config.toml by default)]:CONFIG:_files' \
'--config=[Path to the configuration (XDG_CONFIG_HOME/wpaperd/config.toml by default)]:CONFIG:_files' \
'--notify=[Readiness fd used by wpaperd to signal that it has started correctly]:NOTIFY:_default' \
'-d[Detach from the current terminal and run in the background]' \
'--daemon[Detach from the current terminal and run in the background]' \
'-v[Increase the verbosity of wpaperd]' \
'--verbose[Increase the verbosity of wpaperd]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
&& ret=0
}

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

if [ "$funcstack[1]" = "_wpaperd" ]; then
    _wpaperd "$@"
else
    compdef _wpaperd wpaperd
fi
