#compdef release-plz

autoload -U is-at-least

_release-plz() {
    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[@]}" \
'-v[Print source location and additional information in logs. To change the log level, use the \`RUST_FLAG\` environment variable]' \
'--verbose[Print source location and additional information in logs. To change the log level, use the \`RUST_FLAG\` environment variable]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_release-plz_commands" \
"*::: :->release-plz" \
&& ret=0
    case $state in
    (release-plz)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:release-plz-command-$line[1]:"
        case $line[1] in
            (update)
_arguments "${_arguments_options[@]}" \
'--manifest-path=[Path to the Cargo.toml of the project you want to update. If not provided, release-plz will use the Cargo.toml of the current directory. Both Cargo workspaces and single packages are supported]:MANIFEST_PATH:_files' \
'--registry-manifest-path=[Path to the Cargo.toml contained in the released version of the project you want to update. If not provided, the packages of your project will be compared with the ones published in the cargo registry. Normally, this parameter is used only if the published version of your project is already available locally. For example, it could be the path to the project with a \`git checkout\` on its latest tag. The git history of this project should be behind the one of the project you want to update]:REGISTRY_MANIFEST_PATH:_files' \
'-p+[Package to update. Use it when you want to update a single package rather than all the packages contained in the workspace]:PACKAGE: ' \
'--package=[Package to update. Use it when you want to update a single package rather than all the packages contained in the workspace]:PACKAGE: ' \
'(--no-changelog)--release-date=[Date of the release. Format\: %Y-%m-%d. It defaults to current Utc date]:RELEASE_DATE: ' \
'(--registry-manifest-path)--registry=[Registry where the packages are stored. The registry name needs to be present in the Cargo config. If unspecified, crates.io is used]:REGISTRY: ' \
'(--no-changelog)--changelog-config=[Path to the git-cliff configuration file. If not provided, \`dirs\:\:config_dir()/git-cliff/cliff.toml\` is used if present]:PATH:_files' \
'--repo-url=[GitHub/Gitea repository url where your project is hosted. It is used to generate the changelog release link. It defaults to the url of the default remote]:REPO_URL: ' \
'--config=[Path to the release-plz config file. Default\: \`./release-plz.toml\`. If no config file is found, the default configuration is used]:PATH:_files' \
'(--release-date)--no-changelog[Don'\''t create/update changelog]' \
'-u[Update all the dependencies in the Cargo.lock file by running \`cargo update\`. If this flag is not specified, only update the workspace packages by running \`cargo update --workspace\`]' \
'--update-deps[Update all the dependencies in the Cargo.lock file by running \`cargo update\`. If this flag is not specified, only update the workspace packages by running \`cargo update --workspace\`]' \
'--allow-dirty[Allow dirty working directories to be updated. The uncommitted changes will be part of the update]' \
'-v[Print source location and additional information in logs. To change the log level, use the \`RUST_FLAG\` environment variable]' \
'--verbose[Print source location and additional information in logs. To change the log level, use the \`RUST_FLAG\` environment variable]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(release-pr)
_arguments "${_arguments_options[@]}" \
'--manifest-path=[Path to the Cargo.toml of the project you want to update. If not provided, release-plz will use the Cargo.toml of the current directory. Both Cargo workspaces and single packages are supported]:MANIFEST_PATH:_files' \
'--registry-manifest-path=[Path to the Cargo.toml contained in the released version of the project you want to update. If not provided, the packages of your project will be compared with the ones published in the cargo registry. Normally, this parameter is used only if the published version of your project is already available locally. For example, it could be the path to the project with a \`git checkout\` on its latest tag. The git history of this project should be behind the one of the project you want to update]:REGISTRY_MANIFEST_PATH:_files' \
'-p+[Package to update. Use it when you want to update a single package rather than all the packages contained in the workspace]:PACKAGE: ' \
'--package=[Package to update. Use it when you want to update a single package rather than all the packages contained in the workspace]:PACKAGE: ' \
'(--no-changelog)--release-date=[Date of the release. Format\: %Y-%m-%d. It defaults to current Utc date]:RELEASE_DATE: ' \
'(--registry-manifest-path)--registry=[Registry where the packages are stored. The registry name needs to be present in the Cargo config. If unspecified, crates.io is used]:REGISTRY: ' \
'(--no-changelog)--changelog-config=[Path to the git-cliff configuration file. If not provided, \`dirs\:\:config_dir()/git-cliff/cliff.toml\` is used if present]:PATH:_files' \
'--repo-url=[GitHub/Gitea repository url where your project is hosted. It is used to generate the changelog release link. It defaults to the url of the default remote]:REPO_URL: ' \
'--config=[Path to the release-plz config file. Default\: \`./release-plz.toml\`. If no config file is found, the default configuration is used]:PATH:_files' \
'--git-token=[Git token used to create the pull request]:GIT_TOKEN: ' \
'--github-token=[Git token used to create the pull request]:GIT_TOKEN: ' \
'--backend=[Kind of git host where your project is hosted]:BACKEND:(github gitea)' \
'-o+[Output format. If specified, prints the branch, URL and number of the release PR, if any]:OUTPUT:(json)' \
'--output=[Output format. If specified, prints the branch, URL and number of the release PR, if any]:OUTPUT:(json)' \
'(--release-date)--no-changelog[Don'\''t create/update changelog]' \
'-u[Update all the dependencies in the Cargo.lock file by running \`cargo update\`. If this flag is not specified, only update the workspace packages by running \`cargo update --workspace\`]' \
'--update-deps[Update all the dependencies in the Cargo.lock file by running \`cargo update\`. If this flag is not specified, only update the workspace packages by running \`cargo update --workspace\`]' \
'--allow-dirty[Allow dirty working directories to be updated. The uncommitted changes will be part of the update]' \
'-v[Print source location and additional information in logs. To change the log level, use the \`RUST_FLAG\` environment variable]' \
'--verbose[Print source location and additional information in logs. To change the log level, use the \`RUST_FLAG\` environment variable]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(release)
_arguments "${_arguments_options[@]}" \
'--manifest-path=[Path to the Cargo.toml of the project you want to release. If not provided, release-plz will use the Cargo.toml of the current directory. Both Cargo workspaces and single packages are supported]:MANIFEST_PATH:_files' \
'--registry=[Registry where you want to publish the packages. The registry name needs to be present in the Cargo config. If unspecified, the \`publish\` field of the package manifest is used. If the \`publish\` field is empty, crates.io is used]:REGISTRY: ' \
'--token=[Token used to publish to the cargo registry]:TOKEN: ' \
'--repo-url=[GitHub/Gitea/Gitlab repository url where your project is hosted. It is used to create the git release. It defaults to the url of the default remote]:REPO_URL: ' \
'--git-token=[Git token used to publish the GitHub release]:GIT_TOKEN: ' \
'--backend=[Kind of git backend]:BACKEND:(github gitea gitlab)' \
'--config=[Path to the release-plz config file. Default\: \`./release-plz.toml\`. If no config file is found, the default configuration is used]:PATH:_files' \
'-o+[Output format. If specified, prints the version and the tag of the released packages]:OUTPUT:(json)' \
'--output=[Output format. If specified, prints the version and the tag of the released packages]:OUTPUT:(json)' \
'--dry-run[Perform all checks without uploading]' \
'--no-verify[Don'\''t verify the contents by building them. When you pass this flag, \`release-plz\` adds the \`--no-verify\` flag to \`cargo publish\`]' \
'--allow-dirty[Allow dirty working directories to be packaged. When you pass this flag, \`release-plz\` adds the \`--allow-dirty\` flag to \`cargo publish\`]' \
'-v[Print source location and additional information in logs. To change the log level, use the \`RUST_FLAG\` environment variable]' \
'--verbose[Print source location and additional information in logs. To change the log level, use the \`RUST_FLAG\` environment variable]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(generate-completions)
_arguments "${_arguments_options[@]}" \
'-v[Print source location and additional information in logs. To change the log level, use the \`RUST_FLAG\` environment variable]' \
'--verbose[Print source location and additional information in logs. To change the log level, use the \`RUST_FLAG\` environment variable]' \
'-h[Print help]' \
'--help[Print help]' \
'::shell -- Shell option:(bash elvish fish powershell zsh)' \
&& ret=0
;;
(check-updates)
_arguments "${_arguments_options[@]}" \
'-v[Print source location and additional information in logs. To change the log level, use the \`RUST_FLAG\` environment variable]' \
'--verbose[Print source location and additional information in logs. To change the log level, use the \`RUST_FLAG\` environment variable]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(generate-schema)
_arguments "${_arguments_options[@]}" \
'-v[Print source location and additional information in logs. To change the log level, use the \`RUST_FLAG\` environment variable]' \
'--verbose[Print source location and additional information in logs. To change the log level, use the \`RUST_FLAG\` environment variable]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(init)
_arguments "${_arguments_options[@]}" \
'-v[Print source location and additional information in logs. To change the log level, use the \`RUST_FLAG\` environment variable]' \
'--verbose[Print source location and additional information in logs. To change the log level, use the \`RUST_FLAG\` environment variable]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
":: :_release-plz__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:release-plz-help-command-$line[1]:"
        case $line[1] in
            (update)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(release-pr)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(release)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(generate-completions)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(check-updates)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(generate-schema)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(init)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_release-plz_commands] )) ||
_release-plz_commands() {
    local commands; commands=(
'update:Update packages version and changelogs based on commit messages' \
'release-pr:Create a Pull Request representing the next release. The Pull request contains updated packages version and changelog based on commit messages. Close old PRs opened by release-plz, too' \
'release:For each package not published to the cargo registry yet\: - create and push upstream a tag in the format of \`<package>-v<version>\`. - publish the package to the cargo registry. You can run this command in the CI on every commit in the main branch' \
'generate-completions:Generate command autocompletions for various shells' \
'check-updates:Check if a newer version of release-plz is available' \
'generate-schema:Write the JSON schema of the release-plz.toml configuration to .schema/latest.json' \
'init:Initialize release-plz for the current GitHub repository, by storing the necessary tokens in the GitHub repository secrets and generating the release-plz.yml GitHub Actions workflow file' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'release-plz commands' commands "$@"
}
(( $+functions[_release-plz__check-updates_commands] )) ||
_release-plz__check-updates_commands() {
    local commands; commands=()
    _describe -t commands 'release-plz check-updates commands' commands "$@"
}
(( $+functions[_release-plz__help__check-updates_commands] )) ||
_release-plz__help__check-updates_commands() {
    local commands; commands=()
    _describe -t commands 'release-plz help check-updates commands' commands "$@"
}
(( $+functions[_release-plz__generate-completions_commands] )) ||
_release-plz__generate-completions_commands() {
    local commands; commands=()
    _describe -t commands 'release-plz generate-completions commands' commands "$@"
}
(( $+functions[_release-plz__help__generate-completions_commands] )) ||
_release-plz__help__generate-completions_commands() {
    local commands; commands=()
    _describe -t commands 'release-plz help generate-completions commands' commands "$@"
}
(( $+functions[_release-plz__generate-schema_commands] )) ||
_release-plz__generate-schema_commands() {
    local commands; commands=()
    _describe -t commands 'release-plz generate-schema commands' commands "$@"
}
(( $+functions[_release-plz__help__generate-schema_commands] )) ||
_release-plz__help__generate-schema_commands() {
    local commands; commands=()
    _describe -t commands 'release-plz help generate-schema commands' commands "$@"
}
(( $+functions[_release-plz__help_commands] )) ||
_release-plz__help_commands() {
    local commands; commands=(
'update:Update packages version and changelogs based on commit messages' \
'release-pr:Create a Pull Request representing the next release. The Pull request contains updated packages version and changelog based on commit messages. Close old PRs opened by release-plz, too' \
'release:For each package not published to the cargo registry yet\: - create and push upstream a tag in the format of \`<package>-v<version>\`. - publish the package to the cargo registry. You can run this command in the CI on every commit in the main branch' \
'generate-completions:Generate command autocompletions for various shells' \
'check-updates:Check if a newer version of release-plz is available' \
'generate-schema:Write the JSON schema of the release-plz.toml configuration to .schema/latest.json' \
'init:Initialize release-plz for the current GitHub repository, by storing the necessary tokens in the GitHub repository secrets and generating the release-plz.yml GitHub Actions workflow file' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'release-plz help commands' commands "$@"
}
(( $+functions[_release-plz__help__help_commands] )) ||
_release-plz__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'release-plz help help commands' commands "$@"
}
(( $+functions[_release-plz__help__init_commands] )) ||
_release-plz__help__init_commands() {
    local commands; commands=()
    _describe -t commands 'release-plz help init commands' commands "$@"
}
(( $+functions[_release-plz__init_commands] )) ||
_release-plz__init_commands() {
    local commands; commands=()
    _describe -t commands 'release-plz init commands' commands "$@"
}
(( $+functions[_release-plz__help__release_commands] )) ||
_release-plz__help__release_commands() {
    local commands; commands=()
    _describe -t commands 'release-plz help release commands' commands "$@"
}
(( $+functions[_release-plz__release_commands] )) ||
_release-plz__release_commands() {
    local commands; commands=()
    _describe -t commands 'release-plz release commands' commands "$@"
}
(( $+functions[_release-plz__help__release-pr_commands] )) ||
_release-plz__help__release-pr_commands() {
    local commands; commands=()
    _describe -t commands 'release-plz help release-pr commands' commands "$@"
}
(( $+functions[_release-plz__release-pr_commands] )) ||
_release-plz__release-pr_commands() {
    local commands; commands=()
    _describe -t commands 'release-plz release-pr commands' commands "$@"
}
(( $+functions[_release-plz__help__update_commands] )) ||
_release-plz__help__update_commands() {
    local commands; commands=()
    _describe -t commands 'release-plz help update commands' commands "$@"
}
(( $+functions[_release-plz__update_commands] )) ||
_release-plz__update_commands() {
    local commands; commands=()
    _describe -t commands 'release-plz update commands' commands "$@"
}

if [ "$funcstack[1]" = "_release-plz" ]; then
    _release-plz "$@"
else
    compdef _release-plz release-plz
fi
