#compdef acme-redirect

autoload -U is-at-least

_acme-redirect() {
    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+[]' \
'--config=[]' \
'--config-dir=[]' \
'--chall-dir=[]' \
'--data-dir=[]' \
'--acme-url=[]' \
'--acme-email=[]' \
'*-v[]' \
'*--verbose[]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
":: :_acme-redirect_commands" \
"*::: :->acme-redirect" \
&& ret=0
    case $state in
    (acme-redirect)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:acme-redirect-command-$line[1]:"
        case $line[1] in
            (daemon)
_arguments "${_arguments_options[@]}" \
'--chroot=[]' \
'--user=[]' \
'-B+[]' \
'--bind-addr=[]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'*-v[]' \
'*--verbose[]' \
&& ret=0
;;
(status)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'*-v[]' \
'*--verbose[]' \
&& ret=0
;;
(renew)
_arguments "${_arguments_options[@]}" \
'-n[]' \
'--dry-run[]' \
'--force-renew[]' \
'--skip-restarts[]' \
'--skip-cleanup[Don'\''t clean up old certs that are not live anymore]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'*-v[]' \
'*--verbose[]' \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'*-v[]' \
'*--verbose[]' \
':shell:(zsh bash fish powershell elvish)' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'*-v[]' \
'*--verbose[]' \
&& ret=0
;;
        esac
    ;;
esac
}

(( $+functions[_acme-redirect_commands] )) ||
_acme-redirect_commands() {
    local commands; commands=(
        "daemon:Run the redirect daemon" \
"status:Show the status of our certificates" \
"renew:Request new certificates if needed" \
"completions:Generate shell completions" \
"help:Prints this message or the help of the given subcommand(s)" \
    )
    _describe -t commands 'acme-redirect commands' commands "$@"
}
(( $+functions[_acme-redirect__completions_commands] )) ||
_acme-redirect__completions_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'acme-redirect completions commands' commands "$@"
}
(( $+functions[_acme-redirect__daemon_commands] )) ||
_acme-redirect__daemon_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'acme-redirect daemon commands' commands "$@"
}
(( $+functions[_acme-redirect__help_commands] )) ||
_acme-redirect__help_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'acme-redirect help commands' commands "$@"
}
(( $+functions[_acme-redirect__renew_commands] )) ||
_acme-redirect__renew_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'acme-redirect renew commands' commands "$@"
}
(( $+functions[_acme-redirect__status_commands] )) ||
_acme-redirect__status_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'acme-redirect status commands' commands "$@"
}

_acme-redirect "$@"