#compdef pixi-pack

autoload -U is-at-least

_pixi-pack() {
    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[@]}" : \
'-e+[Environment to pack]:ENVIRONMENT:_default' \
'--environment=[Environment to pack]:ENVIRONMENT:_default' \
'-p+[Platform to pack]:PLATFORM:_default' \
'--platform=[Platform to pack]:PLATFORM:_default' \
'--auth-file=[Authentication file for fetching packages]:AUTH_FILE:_files' \
'-o+[Output file to write the pack to]:OUTPUT_FILE:_files' \
'--output-file=[Output file to write the pack to]:OUTPUT_FILE:_files' \
'--use-cache=[Use a cache directory for downloaded packages]:USE_CACHE:_files' \
'*-i+[Inject an additional conda package into the final prefix]::INJECT:_files' \
'*--inject=[Inject an additional conda package into the final prefix]::INJECT:_files' \
'--pixi-unpack-source=[Optional path or URL to a pixi-unpack executable]:PIXI_UNPACK_SOURCE:_default' \
'-c+[Rattler config for mirror or S3 configuration]:CONFIG:_files' \
'--config=[Rattler config for mirror or S3 configuration]:CONFIG:_files' \
'--ignore-pypi-non-wheel[PyPI source distributions are not supported. This flag allows packing even if PyPI source distributions are present]' \
'--create-executable[Create self-extracting executable]' \
'(--create-executable)--directory-only[Create pack as a folder instead of a tar]' \
'*-v[Increase logging verbosity]' \
'*--verbose[Increase logging verbosity]' \
'(-v --verbose)*-q[Decrease logging verbosity]' \
'(-v --verbose)*--quiet[Decrease logging verbosity]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
'::manifest_path -- The path to `pixi.toml`, `pyproject.toml`, or the project directory:_files' \
":: :_pixi-pack_commands" \
"*::: :->pixi-pack" \
&& ret=0
    case $state in
    (pixi-pack)
        words=($line[2] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:pixi-pack-command-$line[2]:"
        case $line[2] in
            (completion)
_arguments "${_arguments_options[@]}" : \
'-s+[The shell to generate the completion script for]:SHELL:(bash elvish fish powershell zsh)' \
'--shell=[The shell to generate the completion script for]:SHELL:(bash elvish fish powershell zsh)' \
'*-v[Increase logging verbosity]' \
'*--verbose[Increase logging verbosity]' \
'(-v --verbose)*-q[Decrease logging verbosity]' \
'(-v --verbose)*--quiet[Decrease logging verbosity]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_pixi-pack__help_commands" \
"*::: :->help" \
&& ret=0

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

(( $+functions[_pixi-pack_commands] )) ||
_pixi-pack_commands() {
    local commands; commands=(
'completion:Generate shell completion script' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'pixi-pack commands' commands "$@"
}
(( $+functions[_pixi-pack__completion_commands] )) ||
_pixi-pack__completion_commands() {
    local commands; commands=()
    _describe -t commands 'pixi-pack completion commands' commands "$@"
}
(( $+functions[_pixi-pack__help_commands] )) ||
_pixi-pack__help_commands() {
    local commands; commands=(
'completion:Generate shell completion script' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'pixi-pack help commands' commands "$@"
}
(( $+functions[_pixi-pack__help__completion_commands] )) ||
_pixi-pack__help__completion_commands() {
    local commands; commands=()
    _describe -t commands 'pixi-pack help completion commands' commands "$@"
}
(( $+functions[_pixi-pack__help__help_commands] )) ||
_pixi-pack__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'pixi-pack help help commands' commands "$@"
}

if [ "$funcstack[1]" = "_pixi-pack" ]; then
    _pixi-pack "$@"
else
    compdef _pixi-pack pixi-pack
fi
