#compdef recomprizz

autoload -U is-at-least

_recomprizz() {
    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 tarball file to extract and recompress. Supports globbing.]:TARGET:_files' \
'--target=[Target tarball file to extract and recompress. 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.]: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.]:INCLUDE:_files' \
'*-E+[Additional paths such as files or directories from within target directory'\''s work directory to exclude when generating the archive. ⚠️ Careful if the archive has whether preserved root set when it was created.]:EXCLUDE:_files' \
'*--exclude=[Additional paths such as files or directories from within target directory'\''s work directory to exclude when generating the archive. ⚠️ Careful if the archive has whether preserved root set when it was created.]: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' \
'-d+[Output directory of recompressed archive.]:OUTDIR:_files' \
'--outdir=[Output directory of recompressed archive.]:OUTDIR:_files' \
'-c+[Compression to use.]:COMPRESSION:(gz xz zst zstd bz2 not)' \
'--compression=[Compression to use.]:COMPRESSION:(gz xz zst zstd bz2 not)' \
'-R+[Pass a string or regex value into this flag. This will be used with the \`--renamepattern\` flag. If no value is provided to \`--renamepattern\`, this is assumed to be a hard-coded name.]:RENAME:_default' \
'--rename=[Pass a string or regex value into this flag. This will be used with the \`--renamepattern\` flag. If no value is provided to \`--renamepattern\`, this is assumed to be a hard-coded name.]:RENAME:_default' \
'--renamepattern=[Pass a replacement pattern using the capture groups into this flag. This will be used with the \`--rename\` flag.]:RENAMEPATTERN:_default' \
'-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]' \
":: :_recomprizz_commands" \
"*::: :->recomprizz" \
&& ret=0
    case $state in
    (recomprizz)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:recomprizz-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[@]}" : \
":: :_recomprizz__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:recomprizz-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[_recomprizz_commands] )) ||
_recomprizz_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 'recomprizz commands' commands "$@"
}
(( $+functions[_recomprizz__generate-completions-for_commands] )) ||
_recomprizz__generate-completions-for_commands() {
    local commands; commands=()
    _describe -t commands 'recomprizz generate-completions-for commands' commands "$@"
}
(( $+functions[_recomprizz__help_commands] )) ||
_recomprizz__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 'recomprizz help commands' commands "$@"
}
(( $+functions[_recomprizz__help__generate-completions-for_commands] )) ||
_recomprizz__help__generate-completions-for_commands() {
    local commands; commands=()
    _describe -t commands 'recomprizz help generate-completions-for commands' commands "$@"
}
(( $+functions[_recomprizz__help__help_commands] )) ||
_recomprizz__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'recomprizz help help commands' commands "$@"
}

if [ "$funcstack[1]" = "_recomprizz" ]; then
    _recomprizz "$@"
else
    compdef _recomprizz recomprizz
fi
