#compdef maturin

autoload -U is-at-least

_maturin() {
    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[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
'-V[Print version information]' \
'--version[Print version information]' \
":: :_maturin_commands" \
"*::: :->maturin" \
&& ret=0
    case $state in
    (maturin)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:maturin-command-$line[1]:"
        case $line[1] in
            (build)
_arguments "${_arguments_options[@]}" \
'--compatibility=[Control the platform tag on linux]:compatibility: ' \
'*-i+[The python versions to build wheels for, given as the names of the interpreters. Uses autodiscovery if not explicitly set]:INTERPRETER: ' \
'*--interpreter=[The python versions to build wheels for, given as the names of the interpreters. Uses autodiscovery if not explicitly set]:INTERPRETER: ' \
'-b+[Which kind of bindings to use. Possible values are pyo3, rust-cpython, cffi and bin]:BINDINGS: ' \
'--bindings=[Which kind of bindings to use. Possible values are pyo3, rust-cpython, cffi and bin]:BINDINGS: ' \
'-m+[The path to the Cargo.toml]:PATH: ' \
'--manifest-path=[The path to the Cargo.toml]:PATH: ' \
'-o+[The directory to store the built wheels in. Defaults to a new "wheels" directory in the project'\''s target directory]:OUT: ' \
'--out=[The directory to store the built wheels in. Defaults to a new "wheels" directory in the project'\''s target directory]:OUT: ' \
'--target=[The --target option for cargo]:TRIPLE: ' \
'*--cargo-extra-args=[Extra arguments that will be passed to cargo as `cargo rustc \[...\] \[arg1\] \[arg2\] -- \[...\]`]:CARGO_EXTRA_ARGS: ' \
'*--rustc-extra-args=[Extra arguments that will be passed to rustc as `cargo rustc \[...\] -- \[...\] \[arg1\] \[arg2\]`]:RUSTC_EXTRA_ARGS: ' \
'--skip-auditwheel[Don'\''t check for manylinux compliance]' \
'--zig[For manylinux targets, use zig to ensure compliance for the chosen manylinux version]' \
'--universal2[Control whether to build universal2 wheel for macOS or not. Only applies to macOS targets, do nothing otherwise]' \
'-r[Pass --release to cargo]' \
'--release[Pass --release to cargo]' \
'--strip[Strip the library for minimum file size]' \
'--no-sdist[Don'\''t build a source distribution]' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(publish)
_arguments "${_arguments_options[@]}" \
'--compatibility=[Control the platform tag on linux]:compatibility: ' \
'*-i+[The python versions to build wheels for, given as the names of the interpreters. Uses autodiscovery if not explicitly set]:INTERPRETER: ' \
'*--interpreter=[The python versions to build wheels for, given as the names of the interpreters. Uses autodiscovery if not explicitly set]:INTERPRETER: ' \
'-b+[Which kind of bindings to use. Possible values are pyo3, rust-cpython, cffi and bin]:BINDINGS: ' \
'--bindings=[Which kind of bindings to use. Possible values are pyo3, rust-cpython, cffi and bin]:BINDINGS: ' \
'-m+[The path to the Cargo.toml]:PATH: ' \
'--manifest-path=[The path to the Cargo.toml]:PATH: ' \
'-o+[The directory to store the built wheels in. Defaults to a new "wheels" directory in the project'\''s target directory]:OUT: ' \
'--out=[The directory to store the built wheels in. Defaults to a new "wheels" directory in the project'\''s target directory]:OUT: ' \
'--target=[The --target option for cargo]:TRIPLE: ' \
'*--cargo-extra-args=[Extra arguments that will be passed to cargo as `cargo rustc \[...\] \[arg1\] \[arg2\] -- \[...\]`]:CARGO_EXTRA_ARGS: ' \
'*--rustc-extra-args=[Extra arguments that will be passed to rustc as `cargo rustc \[...\] -- \[...\] \[arg1\] \[arg2\]`]:RUSTC_EXTRA_ARGS: ' \
'-r+[The URL of the registry where the wheels are uploaded to. Note than you can also pass the URL through MATURIN_REPOSITORY_URL variable]:REGISTRY: ' \
'--repository-url=[The URL of the registry where the wheels are uploaded to. Note than you can also pass the URL through MATURIN_REPOSITORY_URL variable]:REGISTRY: ' \
'-u+[Username for pypi or your custom registry. Note that you can also pass the username through MATURIN_USERNAME variable]:USERNAME: ' \
'--username=[Username for pypi or your custom registry. Note that you can also pass the username through MATURIN_USERNAME variable]:USERNAME: ' \
'-p+[Password for pypi or your custom registry. Note that you can also pass the password through MATURIN_PASSWORD variable]:PASSWORD: ' \
'--password=[Password for pypi or your custom registry. Note that you can also pass the password through MATURIN_PASSWORD variable]:PASSWORD: ' \
'--skip-auditwheel[Don'\''t check for manylinux compliance]' \
'--zig[For manylinux targets, use zig to ensure compliance for the chosen manylinux version]' \
'--universal2[Control whether to build universal2 wheel for macOS or not. Only applies to macOS targets, do nothing otherwise]' \
'--debug[Do not pass --release to cargo]' \
'--no-strip[Do not strip the library for minimum file size]' \
'--no-sdist[Don'\''t build a source distribution]' \
'--skip-existing[Continue uploading files if one already exists. (Only valid when uploading to PyPI. Other implementations may not support this.)]' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(list-python)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(develop)
_arguments "${_arguments_options[@]}" \
'-b+[Which kind of bindings to use. Possible values are pyo3, rust-cpython, cffi and bin]:BINDINGS: ' \
'--bindings=[Which kind of bindings to use. Possible values are pyo3, rust-cpython, cffi and bin]:BINDINGS: ' \
'-m+[The path to the Cargo.toml]:MANIFEST_PATH: ' \
'--manifest-path=[The path to the Cargo.toml]:MANIFEST_PATH: ' \
'*--cargo-extra-args=[Extra arguments that will be passed to cargo as `cargo rustc \[...\] \[arg1\] \[arg2\] --`]:CARGO_EXTRA_ARGS: ' \
'*--rustc-extra-args=[Extra arguments that will be passed to rustc as `cargo rustc \[...\] -- \[arg1\] \[arg2\]`]:RUSTC_EXTRA_ARGS: ' \
'-E+[Install extra requires aka. optional dependencies]:EXTRAS: ' \
'--extras=[Install extra requires aka. optional dependencies]:EXTRAS: ' \
'-r[Pass --release to cargo]' \
'--release[Pass --release to cargo]' \
'--strip[Strip the library for minimum file size]' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(sdist)
_arguments "${_arguments_options[@]}" \
'-m+[The path to the Cargo.toml]:MANIFEST_PATH: ' \
'--manifest-path=[The path to the Cargo.toml]:MANIFEST_PATH: ' \
'-o+[The directory to store the built wheels in. Defaults to a new "wheels" directory in the project'\''s target directory]:OUT: ' \
'--out=[The directory to store the built wheels in. Defaults to a new "wheels" directory in the project'\''s target directory]:OUT: ' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(init)
_arguments "${_arguments_options[@]}" \
'--name=[Set the resulting package name, defaults to the directory name]:NAME: ' \
'-b+[Which kind of bindings to use]:BINDINGS:(pyo3 rust-cpython cffi bin)' \
'--bindings=[Which kind of bindings to use]:BINDINGS:(pyo3 rust-cpython cffi bin)' \
'--mixed[Use mixed Rust/Python project layout]' \
'-h[Print help information]' \
'--help[Print help information]' \
'::path -- Project path:' \
&& ret=0
;;
(new)
_arguments "${_arguments_options[@]}" \
'--name=[Set the resulting package name, defaults to the directory name]:NAME: ' \
'-b+[Which kind of bindings to use]:BINDINGS:(pyo3 rust-cpython cffi bin)' \
'--bindings=[Which kind of bindings to use]:BINDINGS:(pyo3 rust-cpython cffi bin)' \
'--mixed[Use mixed Rust/Python project layout]' \
'-h[Print help information]' \
'--help[Print help information]' \
':path -- Project path:' \
&& ret=0
;;
(upload)
_arguments "${_arguments_options[@]}" \
'-r+[The URL of the registry where the wheels are uploaded to. Note than you can also pass the URL through MATURIN_REPOSITORY_URL variable]:REGISTRY: ' \
'--repository-url=[The URL of the registry where the wheels are uploaded to. Note than you can also pass the URL through MATURIN_REPOSITORY_URL variable]:REGISTRY: ' \
'-u+[Username for pypi or your custom registry. Note that you can also pass the username through MATURIN_USERNAME variable]:USERNAME: ' \
'--username=[Username for pypi or your custom registry. Note that you can also pass the username through MATURIN_USERNAME variable]:USERNAME: ' \
'-p+[Password for pypi or your custom registry. Note that you can also pass the password through MATURIN_PASSWORD variable]:PASSWORD: ' \
'--password=[Password for pypi or your custom registry. Note that you can also pass the password through MATURIN_PASSWORD variable]:PASSWORD: ' \
'--skip-existing[Continue uploading files if one already exists. (Only valid when uploading to PyPI. Other implementations may not support this.)]' \
'-h[Print help information]' \
'--help[Print help information]' \
'*::FILE -- The python packages to upload:' \
&& ret=0
;;
(pep517)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
":: :_maturin__pep517_commands" \
"*::: :->pep517" \
&& ret=0

    case $state in
    (pep517)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:maturin-pep517-command-$line[1]:"
        case $line[1] in
            (write-dist-info)
_arguments "${_arguments_options[@]}" \
'--compatibility=[Control the platform tag on linux]:compatibility: ' \
'*-i+[The python versions to build wheels for, given as the names of the interpreters. Uses autodiscovery if not explicitly set]:INTERPRETER: ' \
'*--interpreter=[The python versions to build wheels for, given as the names of the interpreters. Uses autodiscovery if not explicitly set]:INTERPRETER: ' \
'-b+[Which kind of bindings to use. Possible values are pyo3, rust-cpython, cffi and bin]:BINDINGS: ' \
'--bindings=[Which kind of bindings to use. Possible values are pyo3, rust-cpython, cffi and bin]:BINDINGS: ' \
'-m+[The path to the Cargo.toml]:PATH: ' \
'--manifest-path=[The path to the Cargo.toml]:PATH: ' \
'-o+[The directory to store the built wheels in. Defaults to a new "wheels" directory in the project'\''s target directory]:OUT: ' \
'--out=[The directory to store the built wheels in. Defaults to a new "wheels" directory in the project'\''s target directory]:OUT: ' \
'--target=[The --target option for cargo]:TRIPLE: ' \
'*--cargo-extra-args=[Extra arguments that will be passed to cargo as `cargo rustc \[...\] \[arg1\] \[arg2\] -- \[...\]`]:CARGO_EXTRA_ARGS: ' \
'*--rustc-extra-args=[Extra arguments that will be passed to rustc as `cargo rustc \[...\] -- \[...\] \[arg1\] \[arg2\]`]:RUSTC_EXTRA_ARGS: ' \
'--metadata-directory=[The metadata_directory argument to prepare_metadata_for_build_wheel]:METADATA_DIRECTORY: ' \
'--skip-auditwheel[Don'\''t check for manylinux compliance]' \
'--zig[For manylinux targets, use zig to ensure compliance for the chosen manylinux version]' \
'--universal2[Control whether to build universal2 wheel for macOS or not. Only applies to macOS targets, do nothing otherwise]' \
'--strip[Strip the library for minimum file size]' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(build-wheel)
_arguments "${_arguments_options[@]}" \
'--compatibility=[Control the platform tag on linux]:compatibility: ' \
'*-i+[The python versions to build wheels for, given as the names of the interpreters. Uses autodiscovery if not explicitly set]:INTERPRETER: ' \
'*--interpreter=[The python versions to build wheels for, given as the names of the interpreters. Uses autodiscovery if not explicitly set]:INTERPRETER: ' \
'-b+[Which kind of bindings to use. Possible values are pyo3, rust-cpython, cffi and bin]:BINDINGS: ' \
'--bindings=[Which kind of bindings to use. Possible values are pyo3, rust-cpython, cffi and bin]:BINDINGS: ' \
'-m+[The path to the Cargo.toml]:PATH: ' \
'--manifest-path=[The path to the Cargo.toml]:PATH: ' \
'-o+[The directory to store the built wheels in. Defaults to a new "wheels" directory in the project'\''s target directory]:OUT: ' \
'--out=[The directory to store the built wheels in. Defaults to a new "wheels" directory in the project'\''s target directory]:OUT: ' \
'--target=[The --target option for cargo]:TRIPLE: ' \
'*--cargo-extra-args=[Extra arguments that will be passed to cargo as `cargo rustc \[...\] \[arg1\] \[arg2\] -- \[...\]`]:CARGO_EXTRA_ARGS: ' \
'*--rustc-extra-args=[Extra arguments that will be passed to rustc as `cargo rustc \[...\] -- \[...\] \[arg1\] \[arg2\]`]:RUSTC_EXTRA_ARGS: ' \
'--skip-auditwheel[Don'\''t check for manylinux compliance]' \
'--zig[For manylinux targets, use zig to ensure compliance for the chosen manylinux version]' \
'--universal2[Control whether to build universal2 wheel for macOS or not. Only applies to macOS targets, do nothing otherwise]' \
'--strip[Strip the library for minimum file size]' \
'--editable[Build editable wheels]' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(write-sdist)
_arguments "${_arguments_options[@]}" \
'--sdist-directory=[The sdist_directory argument to build_sdist]:SDIST_DIRECTORY: ' \
'-m+[The path to the Cargo.toml]:PATH: ' \
'--manifest-path=[The path to the Cargo.toml]:PATH: ' \
'-h[Print help information]' \
'--help[Print help information]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'*::subcommand -- The subcommand whose help message to display:' \
&& ret=0
;;
        esac
    ;;
esac
;;
(completions)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
':SHELL:' \
&& ret=0
;;
(zig)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
":: :_maturin__zig_commands" \
"*::: :->zig" \
&& ret=0

    case $state in
    (zig)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:maturin-zig-command-$line[1]:"
        case $line[1] in
            (cc)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
'*::args -- `zig cc` arguments:' \
&& ret=0
;;
(c++)
_arguments "${_arguments_options[@]}" \
'-h[Print help information]' \
'--help[Print help information]' \
'*::args -- `zig c++` arguments:' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'*::subcommand -- The subcommand whose help message to display:' \
&& ret=0
;;
        esac
    ;;
esac
;;
(help)
_arguments "${_arguments_options[@]}" \
'*::subcommand -- The subcommand whose help message to display:' \
&& ret=0
;;
        esac
    ;;
esac
}

(( $+functions[_maturin_commands] )) ||
_maturin_commands() {
    local commands; commands=(
'build:Build the crate into python packages' \
'publish:Build and publish the crate as python packages to pypi' \
'list-python:Searches and lists the available python installations' \
'develop:Installs the crate as module in the current virtualenv' \
'sdist:Build only a source distribution (sdist) without compiling' \
'init:Create a new cargo project in an existing directory' \
'new:Create a new cargo project' \
'upload:Uploads python packages to pypi' \
'pep517:Backend for the PEP 517 integration. Not for human consumption' \
'completions:Generate shell completions' \
'zig:Zig linker wrapper' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'maturin commands' commands "$@"
}
(( $+functions[_maturin__build_commands] )) ||
_maturin__build_commands() {
    local commands; commands=()
    _describe -t commands 'maturin build commands' commands "$@"
}
(( $+functions[_maturin__pep517__build-wheel_commands] )) ||
_maturin__pep517__build-wheel_commands() {
    local commands; commands=()
    _describe -t commands 'maturin pep517 build-wheel commands' commands "$@"
}
(( $+functions[_maturin__zig__c++_commands] )) ||
_maturin__zig__c++_commands() {
    local commands; commands=()
    _describe -t commands 'maturin zig c++ commands' commands "$@"
}
(( $+functions[_maturin__zig__cc_commands] )) ||
_maturin__zig__cc_commands() {
    local commands; commands=()
    _describe -t commands 'maturin zig cc commands' commands "$@"
}
(( $+functions[_maturin__completions_commands] )) ||
_maturin__completions_commands() {
    local commands; commands=()
    _describe -t commands 'maturin completions commands' commands "$@"
}
(( $+functions[_maturin__develop_commands] )) ||
_maturin__develop_commands() {
    local commands; commands=()
    _describe -t commands 'maturin develop commands' commands "$@"
}
(( $+functions[_maturin__help_commands] )) ||
_maturin__help_commands() {
    local commands; commands=()
    _describe -t commands 'maturin help commands' commands "$@"
}
(( $+functions[_maturin__pep517__help_commands] )) ||
_maturin__pep517__help_commands() {
    local commands; commands=()
    _describe -t commands 'maturin pep517 help commands' commands "$@"
}
(( $+functions[_maturin__zig__help_commands] )) ||
_maturin__zig__help_commands() {
    local commands; commands=()
    _describe -t commands 'maturin zig help commands' commands "$@"
}
(( $+functions[_maturin__init_commands] )) ||
_maturin__init_commands() {
    local commands; commands=()
    _describe -t commands 'maturin init commands' commands "$@"
}
(( $+functions[_maturin__list-python_commands] )) ||
_maturin__list-python_commands() {
    local commands; commands=()
    _describe -t commands 'maturin list-python commands' commands "$@"
}
(( $+functions[_maturin__new_commands] )) ||
_maturin__new_commands() {
    local commands; commands=()
    _describe -t commands 'maturin new commands' commands "$@"
}
(( $+functions[_maturin__pep517_commands] )) ||
_maturin__pep517_commands() {
    local commands; commands=(
'write-dist-info:The implementation of prepare_metadata_for_build_wheel' \
'build-wheel:Implementation of build_wheel' \
'write-sdist:The implementation of build_sdist' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'maturin pep517 commands' commands "$@"
}
(( $+functions[_maturin__publish_commands] )) ||
_maturin__publish_commands() {
    local commands; commands=()
    _describe -t commands 'maturin publish commands' commands "$@"
}
(( $+functions[_maturin__sdist_commands] )) ||
_maturin__sdist_commands() {
    local commands; commands=()
    _describe -t commands 'maturin sdist commands' commands "$@"
}
(( $+functions[_maturin__upload_commands] )) ||
_maturin__upload_commands() {
    local commands; commands=()
    _describe -t commands 'maturin upload commands' commands "$@"
}
(( $+functions[_maturin__pep517__write-dist-info_commands] )) ||
_maturin__pep517__write-dist-info_commands() {
    local commands; commands=()
    _describe -t commands 'maturin pep517 write-dist-info commands' commands "$@"
}
(( $+functions[_maturin__pep517__write-sdist_commands] )) ||
_maturin__pep517__write-sdist_commands() {
    local commands; commands=()
    _describe -t commands 'maturin pep517 write-sdist commands' commands "$@"
}
(( $+functions[_maturin__zig_commands] )) ||
_maturin__zig_commands() {
    local commands; commands=(
'cc:`zig cc` wrapper' \
'c++:`zig c++` wrapper' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'maturin zig commands' commands "$@"
}

_maturin "$@"
