#compdef meli

autoload -U is-at-least

_meli() {
    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+[use specified configuration file]' \
'--config=[use specified configuration file]' \
'--varlink=[]' \
'--varlink-replace[]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-v[Prints version information]' \
'--version[Prints version information]' \
":: :_meli_commands" \
"*::: :->meli" \
&& ret=0
    case $state in
    (meli)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:meli-command-$line[1]:"
        case $line[1] in
            (print-default-theme)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(print-loaded-themes)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(print-app-directories)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(print-config-path)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(edit-config)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(create-config)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'::path:_files' \
&& ret=0
;;
(test-config)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'::path:_files' \
&& ret=0
;;
(tools)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
":: :_meli__tools_commands" \
"*::: :->tools" \
&& ret=0
case $state in
    (tools)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:meli-tools-command-$line[1]:"
        case $line[1] in
            (imap-shell)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':account:_files' \
&& ret=0
;;
(managesieve-shell)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':account:_files' \
&& ret=0
;;
(smtp-shell)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':account:_files' \
&& ret=0
;;
(jmap-shell)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':account:_files' \
&& ret=0
;;
(public-inbox)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
":: :_meli__tools__public-inbox_commands" \
"*::: :->public-inbox" \
&& ret=0
case $state in
    (public-inbox)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:meli-tools-public-inbox-command-$line[1]:"
        case $line[1] in
            (mbox)
_arguments "${_arguments_options[@]}" \
'--url=[]' \
'--list=[]' \
'--output=[Default: save to mbox in current directory. Use - for stdout]' \
'-t[If set, the whole thread containing the given Message-ID will be fetched]' \
'--thread[If set, the whole thread containing the given Message-ID will be fetched]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':message-id:_files' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
        esac
    ;;
esac
;;
(migration)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
":: :_meli__tools__migration_commands" \
"*::: :->migration" \
&& ret=0
case $state in
    (migration)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:meli-tools-migration-command-$line[1]:"
        case $line[1] in
            (list)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(apply)
_arguments "${_arguments_options[@]}" \
'-d[]' \
'--dry-run[]' \
'-v[]' \
'--verbose[]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':migration:_files' \
&& ret=0
;;
(revert)
_arguments "${_arguments_options[@]}" \
'-d[]' \
'--dry-run[]' \
'-v[]' \
'--verbose[]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':migration:_files' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
        esac
    ;;
esac
;;
(help)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
        esac
    ;;
esac
;;
(docs)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(docs)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(manpage)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(manpages)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(man)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(install-man)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'::destination-path:_files' \
&& ret=0
;;
(compiled-with)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':shell -- Shell to generate completions for:(zsh bash fish powershell elvish)' \
&& ret=0
;;
(print-log-path)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
(view)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
':path:_files' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
&& ret=0
;;
        esac
    ;;
esac
}

(( $+functions[_meli_commands] )) ||
_meli_commands() {
    local commands; commands=(
        "print-default-theme:print default theme in full to stdout and exit" \
"print-loaded-themes:print loaded themes in full to stdout and exit" \
"print-app-directories:print all directories that meli creates/uses" \
"print-config-path:print location of configuration file that will be loaded on normal app startup" \
"edit-config:edit configuration files with EDITOR/VISUAL" \
"create-config:create a sample configuration file with available configuration options. If PATH is not specified, meli will try to create it in XDG_CONFIG_HOME/meli/config.toml. Path - will output to standard output instead" \
"test-config:test a configuration file for syntax issues or missing options. If PATH is not specified, meli will try to read it from XDG_CONFIG_HOME/meli/config.toml. Path - will read input from standard input instead" \
"tools:Testing tools such as IMAP, SMTP shells for debugging" \
"man:print documentation page and exit (Piping to a pager is recommended.)" \
"docs:print documentation page and exit (Piping to a pager is recommended.)" \
"install-man:Install manual pages to the first location provided by MANPATH / manpath(1), unless you specify the directory as an argument" \
"compiled-with:Print compile time feature flags of this binary" \
"completions:Generate shell completions and print them to stdout" \
"print-log-path:Print log file location" \
"view:View mail from input file" \
"help:Prints this message or the help of the given subcommand(s)" \
    )
    _describe -t commands 'meli commands' commands "$@"
}
(( $+functions[_meli__tools__migration__apply_commands] )) ||
_meli__tools__migration__apply_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli tools migration apply commands' commands "$@"
}
(( $+functions[_meli__compiled-with_commands] )) ||
_meli__compiled-with_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli compiled-with commands' commands "$@"
}
(( $+functions[_meli__completions_commands] )) ||
_meli__completions_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli completions commands' commands "$@"
}
(( $+functions[_meli__create-config_commands] )) ||
_meli__create-config_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli create-config commands' commands "$@"
}
(( $+functions[_docs_commands] )) ||
_docs_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'docs commands' commands "$@"
}
(( $+functions[_meli__docs_commands] )) ||
_meli__docs_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli docs commands' commands "$@"
}
(( $+functions[_meli__edit-config_commands] )) ||
_meli__edit-config_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli edit-config commands' commands "$@"
}
(( $+functions[_meli__help_commands] )) ||
_meli__help_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli help commands' commands "$@"
}
(( $+functions[_meli__tools__help_commands] )) ||
_meli__tools__help_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli tools help commands' commands "$@"
}
(( $+functions[_meli__tools__migration__help_commands] )) ||
_meli__tools__migration__help_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli tools migration help commands' commands "$@"
}
(( $+functions[_meli__tools__public-inbox__help_commands] )) ||
_meli__tools__public-inbox__help_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli tools public-inbox help commands' commands "$@"
}
(( $+functions[_meli__tools__imap-shell_commands] )) ||
_meli__tools__imap-shell_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli tools imap-shell commands' commands "$@"
}
(( $+functions[_meli__install-man_commands] )) ||
_meli__install-man_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli install-man commands' commands "$@"
}
(( $+functions[_meli__tools__jmap-shell_commands] )) ||
_meli__tools__jmap-shell_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli tools jmap-shell commands' commands "$@"
}
(( $+functions[_meli__tools__migration__list_commands] )) ||
_meli__tools__migration__list_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli tools migration list commands' commands "$@"
}
(( $+functions[_meli__man_commands] )) ||
_meli__man_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli man commands' commands "$@"
}
(( $+functions[_meli__tools__managesieve-shell_commands] )) ||
_meli__tools__managesieve-shell_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli tools managesieve-shell commands' commands "$@"
}
(( $+functions[_manpage_commands] )) ||
_manpage_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'manpage commands' commands "$@"
}
(( $+functions[_meli__manpage_commands] )) ||
_meli__manpage_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli manpage commands' commands "$@"
}
(( $+functions[_manpages_commands] )) ||
_manpages_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'manpages commands' commands "$@"
}
(( $+functions[_meli__manpages_commands] )) ||
_meli__manpages_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli manpages commands' commands "$@"
}
(( $+functions[_meli__tools__public-inbox__mbox_commands] )) ||
_meli__tools__public-inbox__mbox_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli tools public-inbox mbox commands' commands "$@"
}
(( $+functions[_meli__tools__migration_commands] )) ||
_meli__tools__migration_commands() {
    local commands; commands=(
        "list:List all available migrations" \
"apply:Apply a specific migration" \
"revert:Revert a specific migration" \
"help:Prints this message or the help of the given subcommand(s)" \
    )
    _describe -t commands 'meli tools migration commands' commands "$@"
}
(( $+functions[_meli__print-app-directories_commands] )) ||
_meli__print-app-directories_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli print-app-directories commands' commands "$@"
}
(( $+functions[_meli__print-config-path_commands] )) ||
_meli__print-config-path_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli print-config-path commands' commands "$@"
}
(( $+functions[_meli__print-default-theme_commands] )) ||
_meli__print-default-theme_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli print-default-theme commands' commands "$@"
}
(( $+functions[_meli__print-loaded-themes_commands] )) ||
_meli__print-loaded-themes_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli print-loaded-themes commands' commands "$@"
}
(( $+functions[_meli__print-log-path_commands] )) ||
_meli__print-log-path_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli print-log-path commands' commands "$@"
}
(( $+functions[_meli__tools__public-inbox_commands] )) ||
_meli__tools__public-inbox_commands() {
    local commands; commands=(
        "mbox:Download a single e-mail or a thread as an mbox file from a public-inbox server" \
"help:Prints this message or the help of the given subcommand(s)" \
    )
    _describe -t commands 'meli tools public-inbox commands' commands "$@"
}
(( $+functions[_meli__tools__migration__revert_commands] )) ||
_meli__tools__migration__revert_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli tools migration revert commands' commands "$@"
}
(( $+functions[_meli__tools__smtp-shell_commands] )) ||
_meli__tools__smtp-shell_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli tools smtp-shell commands' commands "$@"
}
(( $+functions[_meli__test-config_commands] )) ||
_meli__test-config_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli test-config commands' commands "$@"
}
(( $+functions[_meli__tools_commands] )) ||
_meli__tools_commands() {
    local commands; commands=(
        "imap-shell:" \
"managesieve-shell:Opens an interactive shell on a managesieve server" \
"smtp-shell:" \
"jmap-shell:" \
"public-inbox:Interact with a public-inbox server (e.g. lore.kernel.org)" \
"migration:List, apply or revert migrations" \
"help:Prints this message or the help of the given subcommand(s)" \
    )
    _describe -t commands 'meli tools commands' commands "$@"
}
(( $+functions[_meli__view_commands] )) ||
_meli__view_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'meli view commands' commands "$@"
}

_meli "$@"