#compdef poetry

_poetry_4b73b18e50e0e1c8_complete()
{
    local state com cur

    cur=${words[${#words[@]}]}

    # lookup for command
    for word in ${words[@]:1}; do
        if [[ $word != -* ]]; then
            com=$word
            break
        fi
    done

    if [[ ${cur} == --* ]]; then
        state="option"
        opts=("--ansi:Force ANSI output" "--help:Display this help message" "--no-ansi:Disable ANSI output" "--no-interaction:Do not ask any interactive question" "--quiet:Do not output any message" "--verbose:Increase the verbosity of messages: \\\"-v\\\" for normal output, \\\"-vv\\\" for more verbose output and \\\"-vvv\\\" for debug" "--version:Display this application version")
    elif [[ $cur == $com ]]; then
        state="command"
        coms=("about:Shows information about Poetry." "add:Adds a new dependency to pyproject.toml." "build:Builds a package, as a tarball and a wheel by default." "cache:Interact with Poetry\'s cache" "check:Checks the validity of the pyproject.toml file." "config:Manages configuration settings." "debug:Debug various elements of Poetry." "env:Interact with Poetry\'s project environments." "export:Exports the lock file to alternative formats." "help:Display the manual of a command" "init:Creates a basic pyproject.toml file in the current directory." "install:Installs the project dependencies." "lock:Locks the project dependencies." "new:Creates a new Python project at <path\>." "publish:Publishes a package to a remote repository." "remove:Removes a package from the project dependencies." "run:Runs a command in the appropriate environment." "search:Searches for packages on remote repositories." "self:Interact with Poetry directly." "shell:Spawns a shell within the virtual environment." "show:Shows information about packages." "update:Update the dependencies as according to the pyproject.toml file." "version:Shows the version of the project or bumps it when a valid bump rule is provided.")
    fi

    case $state in
        (command)
            _describe 'command' coms
        ;;
        (option)
            case "$com" in

            (about)
            opts+=()
            ;;

            (add)
            opts+=("--allow-prereleases:Accept prereleases." "--dev:Add as a development dependency." "--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--extras:Extras to activate for the dependency." "--lock:Do not perform operations \(only update the lockfile\)." "--optional:Add as an optional dependency." "--platform:Platforms for which the dependency must be installed." "--python:Python version for which the dependency must be installed." "--source:Name of the source to use to install the package.")
            ;;

            (build)
            opts+=("--format:Limit the format to either sdist or wheel.")
            ;;

            (cache)
            opts+=()
            ;;

            (check)
            opts+=()
            ;;

            (config)
            opts+=("--list:List configuration settings." "--local:Set/Get from the project\'s local configuration." "--unset:Unset configuration setting.")
            ;;

            (debug)
            opts+=()
            ;;

            (env)
            opts+=()
            ;;

            (export)
            opts+=("--dev:Include development dependencies." "--extras:Extra sets of dependencies to include." "--format:Format to export to. Currently, only requirements.txt is supported." "--output:The name of the output file." "--with-credentials:Include credentials for extra indices." "--without-hashes:Exclude hashes from the exported file.")
            ;;

            (help)
            opts+=()
            ;;

            (init)
            opts+=("--author:Author name of the package." "--dependency:Package to require, with an optional version constraint, e.g. requests:\^2.10.0 or requests=2.11.1." "--description:Description of the package." "--dev-dependency:Package to require for development, with an optional version constraint, e.g. requests:\^2.10.0 or requests=2.11.1." "--license:License of the package." "--name:Name of the package." "--python:Compatible Python versions.")
            ;;

            (install)
            opts+=("--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--extras:Extra sets of dependencies to install." "--no-dev:Do not install the development dependencies." "--no-root:Do not install the root package \(the current project\)." "--remove-untracked:Removes packages not present in the lock file.")
            ;;

            (lock)
            opts+=("--no-update:Do not update locked versions, only refresh lock file.")
            ;;

            (new)
            opts+=("--name:Set the resulting package name." "--src:Use the src layout for the project.")
            ;;

            (publish)
            opts+=("--build:Build the package before publishing." "--cert:Certificate authority to access the repository." "--client-cert:Client certificate to access the repository." "--dry-run:Perform all actions except upload the package." "--password:The password to access the repository." "--repository:The repository to publish the package to." "--username:The username to access the repository.")
            ;;

            (remove)
            opts+=("--dev:Remove a package from the development dependencies." "--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\).")
            ;;

            (run)
            opts+=()
            ;;

            (search)
            opts+=()
            ;;

            (self)
            opts+=()
            ;;

            (shell)
            opts+=()
            ;;

            (show)
            opts+=("--all:Show all packages \(even those not compatible with current system\)." "--latest:Show the latest version." "--no-dev:Do not list the development dependencies." "--outdated:Show the latest version but only for packages that are outdated." "--tree:List the dependencies as a tree.")
            ;;

            (update)
            opts+=("--dry-run:Output the operations but do not execute anything \(implicitly enables --verbose\)." "--lock:Do not perform operations \(only update the lockfile\)." "--no-dev:Do not update the development dependencies.")
            ;;

            (version)
            opts+=("--short:Output the version number only")
            ;;

            esac

            _describe 'option' opts
        ;;
        *)
            # fallback to file completion
            _arguments '*:file:_files'
    esac
}

_poetry_4b73b18e50e0e1c8_complete "$@"
