#compdef roast

autoload -U is-at-least

_roast() {
    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[@]}" : \
'-t+[Target directory to archive. This will be set as the root directory of the archive. Supports globbing.]:TARGET:_files' \
'--target=[Target directory to archive. This will be set as the root directory of the archive. Supports globbing.]:TARGET:_files' \
'*-i+[Additional paths such as files or directories in the target directory to include to the archive. Their parent directory will be put next to the target directory'\''s work directory. The work directory is based on the preserve root option. This is different from \`--additional_paths\`. Useful to override excluded directories. ⚠️ Careful if the archive has whether preserved root set when it was created.]:INCLUDE:_files' \
'*--include=[Additional paths such as files or directories in the target directory to include to the archive. Their parent directory will be put next to the target directory'\''s work directory. The work directory is based on the preserve root option. This is different from \`--additional_paths\`. Useful to override excluded directories. ⚠️ Careful if the archive has whether preserved root set when it was created.]:INCLUDE:_files' \
'*-E+[Additional paths such as files or directories from within target directory'\''s work directory to exclude when generating the archive.]:EXCLUDE:_files' \
'*--exclude=[Additional paths such as files or directories from within target directory'\''s work directory to exclude when generating the archive.]:EXCLUDE:_files' \
'*-A+[Additional paths such as files or directories to add to the archive. Their parent directory will be put next to the target directory. This is different from \`--include\`. Optionally, one can add a path to a directory inside the archive e.g. \`-A some/file/to/archive,put/where/in/archive\`. If directory does not exist, it will be created.]:ADDITIONAL_PATHS:_default' \
'*--additional-paths=[Additional paths such as files or directories to add to the archive. Their parent directory will be put next to the target directory. This is different from \`--include\`. Optionally, one can add a path to a directory inside the archive e.g. \`-A some/file/to/archive,put/where/in/archive\`. If directory does not exist, it will be created.]:ADDITIONAL_PATHS:_default' \
'-f+[Output file of the generated archive with path.]:OUTFILE:_files' \
'--outfile=[Output file of the generated archive with path.]:OUTFILE:_files' \
'-d+[Output path of the generated archive.]:OUTDIR:_files' \
'--outdir=[Output path of the generated archive.]:OUTDIR:_files' \
'-p+[Preserve root directory instead of only archiving relative paths.]:PRESERVE_ROOT:(true false)' \
'--preserve-root=[Preserve root directory instead of only archiving relative paths.]:PRESERVE_ROOT:(true false)' \
'-r+[Allow reproducibility for Reproducible Builds.]:REPRODUCIBLE:(true false)' \
'--reproducible=[Allow reproducibility for Reproducible Builds.]:REPRODUCIBLE:(true false)' \
'-g+[Whether to ignore git related metadata, files and directories.]:IGNORE_GIT:(true false)' \
'--ignore-git=[Whether to ignore git related metadata, files and directories.]:IGNORE_GIT:(true false)' \
'-I+[Whether to ignore hidden directories and files or what we call dotfiles. Does not affect \`--ignore-git\`.]:IGNORE_HIDDEN:(true false)' \
'--ignore-hidden=[Whether to ignore hidden directories and files or what we call dotfiles. Does not affect \`--ignore-git\`.]:IGNORE_HIDDEN:(true false)' \
'-S+[Whether to silence the output or not.]:SILENT:(true false)' \
'--silent=[Whether to silence the output or not.]:SILENT:(true false)' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_roast_commands" \
"*::: :->roast" \
&& ret=0
    case $state in
    (roast)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:roast-command-$line[1]:"
        case $line[1] in
            (generate-completions-for)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
':shell:(bash elvish fish powershell zsh)' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_roast__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:roast-help-command-$line[1]:"
        case $line[1] in
            (generate-completions-for)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_roast_commands] )) ||
_roast_commands() {
    local commands; commands=(
'generate-completions-for:Generate shell completions' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'roast commands' commands "$@"
}
(( $+functions[_roast__generate-completions-for_commands] )) ||
_roast__generate-completions-for_commands() {
    local commands; commands=()
    _describe -t commands 'roast generate-completions-for commands' commands "$@"
}
(( $+functions[_roast__help_commands] )) ||
_roast__help_commands() {
    local commands; commands=(
'generate-completions-for:Generate shell completions' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'roast help commands' commands "$@"
}
(( $+functions[_roast__help__generate-completions-for_commands] )) ||
_roast__help__generate-completions-for_commands() {
    local commands; commands=()
    _describe -t commands 'roast help generate-completions-for commands' commands "$@"
}
(( $+functions[_roast__help__help_commands] )) ||
_roast__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'roast help help commands' commands "$@"
}

if [ "$funcstack[1]" = "_roast" ]; then
    _roast "$@"
else
    compdef _roast roast
fi
