#compdef openqa-cli

# Generated with perl module App::Spec vv0.15.0

_openqa-cli() {
    local program=openqa-cli
    typeset -A opt_args
    local curcontext="$curcontext" state line context


        # ---- Command: 
        _arguments -s  \
            '1: :->cmd1' \
            '*: :->args' \
            && ret=0


        case $state in
        cmd1)
            _alternative 'args:cmd2:((api\:"Issue an arbitrary request to the API" archive\:"Download assets and test results from a job" monitor\:"Monitors a set of jobs" reservation\:"Manage worker reservations" schedule\:"Schedules a set of jobs (via \"isos post\" creating a schedule product)"))'
        ;;

        args)
            case $line[1] in
            api)

                # ---- Command: api
                _arguments -s -C \
                    '1: :->cmd1' \
                    '2: :->path' \
                    '3: :->parameters' \
                    '--apibase[API base, defaults to /api/v1]:apibase' \
                    '--apikey[API key. Use is discouraged due to risk of leaking credentials. Prefer config file or env variables.]:apikey' \
                    '--apisecret[API secret. Use is discouraged due to risk of leaking credentials. Prefer config file or env variables.]:apisecret' \
                    '--host[Target host, defaults to http://localhost]:host' \
                    '--help[Get more information on a specific command]' \
                    '-h[Get more information on a specific command]' \
                    '--osd[Set target host to http://openqa.suse.de]' \
                    '--o3[Set target host to https://openqa.opensuse.org]' \
                    '--odn[Set target host to https://openqa.debian.net]' \
                    '--links[Print pagination links to STDERR]' \
                    '-L[Print pagination links to STDERR]' \
                    '--name[Name of this client, used by openQA to identify different clients via User-Agent header, defaults to "openqa-cli" ]:name' \
                    '--pretty[Pretty print JSON content]' \
                    '-p[Pretty print JSON content]' \
                    '--quiet[Do not print error messages to STDERR]' \
                    '-q[Do not print error messages to STDERR]' \
                    '--verbose[Print HTTP response headers]' \
                    '-v[Print HTTP response headers]' \
                    '*--header[One or more additional HTTP headers (<name:value>)]:header' \
                    '*-a[One or more additional HTTP headers (<name:value>)]:header' \
                    '--data-file[Load content to send with request from file]:data-file:_files' \
                    '-D[Load content to send with request from file]:data-file:_files' \
                    '--data[Content to send with request]:data' \
                    '-d[Content to send with request]:data' \
                    '--form[Turn JSON object into form parameters]' \
                    '-f[Turn JSON object into form parameters]' \
                    '--json[Request content is JSON]' \
                    '-j[Request content is JSON]' \
                    '--verbose[Print HTTP response headers]' \
                    '-v[Print HTTP response headers]' \
                    '*--param-file[Load content of params from files instead of from command line arguments. Multiple params may be specified by adding the option multiple times ]:param-file' \
                    '--retries[Retry up to the specified value on some errors. Retries can also be set by the environment variable '"'"'OPENQA_CLI_RETRIES'"'"', defaults to no retry. Set '"'"'OPENQA_CLI_RETRY_SLEEP_TIME_S'"'"' to configure the sleep time between retries. ]:retries' \
                    '-r[Retry up to the specified value on some errors. Retries can also be set by the environment variable '"'"'OPENQA_CLI_RETRIES'"'"', defaults to no retry. Set '"'"'OPENQA_CLI_RETRY_SLEEP_TIME_S'"'"' to configure the sleep time between retries. ]:retries' \
                    '--method[HTTP method to use, defaults to GET]:method:("GET" "HEAD" "OPTIONS" "TRACE" "PUT" "DELETE" "POST" "PATCH" "CONNECT")' \
                    '-X[HTTP method to use, defaults to GET]:method:("GET" "HEAD" "OPTIONS" "TRACE" "PUT" "DELETE" "POST" "PATCH" "CONNECT")' \
                    && ret=0

                case $state in
                path)

                ;;
                parameters)

                ;;
                esac

            ;;
            archive)

                # ---- Command: archive
                _arguments -s -C \
                    '1: :->cmd1' \
                    '--apibase[API base, defaults to /api/v1]:apibase' \
                    '--apikey[API key. Use is discouraged due to risk of leaking credentials. Prefer config file or env variables.]:apikey' \
                    '--apisecret[API secret. Use is discouraged due to risk of leaking credentials. Prefer config file or env variables.]:apisecret' \
                    '--host[Target host, defaults to http://localhost]:host' \
                    '--help[Get more information on a specific command]' \
                    '-h[Get more information on a specific command]' \
                    '--osd[Set target host to http://openqa.suse.de]' \
                    '--o3[Set target host to https://openqa.opensuse.org]' \
                    '--odn[Set target host to https://openqa.debian.net]' \
                    '--links[Print pagination links to STDERR]' \
                    '-L[Print pagination links to STDERR]' \
                    '--name[Name of this client, used by openQA to identify different clients via User-Agent header, defaults to "openqa-cli" ]:name' \
                    '--pretty[Pretty print JSON content]' \
                    '-p[Pretty print JSON content]' \
                    '--quiet[Do not print error messages to STDERR]' \
                    '-q[Do not print error messages to STDERR]' \
                    '--verbose[Print HTTP response headers]' \
                    '-v[Print HTTP response headers]' \
                    '--asset-size-limit[Asset size limit in bytes]:asset-size-limit' \
                    '-l[Asset size limit in bytes]:asset-size-limit' \
                    '--with-thumbnails[Download thumbnails as well]' \
                    '-t[Download thumbnails as well]' \
                    && ret=0


            ;;
            monitor)

                # ---- Command: monitor
                _arguments -s -C \
                    '1: :->cmd1' \
                    '--apibase[API base, defaults to /api/v1]:apibase' \
                    '--apikey[API key. Use is discouraged due to risk of leaking credentials. Prefer config file or env variables.]:apikey' \
                    '--apisecret[API secret. Use is discouraged due to risk of leaking credentials. Prefer config file or env variables.]:apisecret' \
                    '--host[Target host, defaults to http://localhost]:host' \
                    '--help[Get more information on a specific command]' \
                    '-h[Get more information on a specific command]' \
                    '--osd[Set target host to http://openqa.suse.de]' \
                    '--o3[Set target host to https://openqa.opensuse.org]' \
                    '--odn[Set target host to https://openqa.debian.net]' \
                    '--links[Print pagination links to STDERR]' \
                    '-L[Print pagination links to STDERR]' \
                    '--name[Name of this client, used by openQA to identify different clients via User-Agent header, defaults to "openqa-cli" ]:name' \
                    '--pretty[Pretty print JSON content]' \
                    '-p[Pretty print JSON content]' \
                    '--quiet[Do not print error messages to STDERR]' \
                    '-q[Do not print error messages to STDERR]' \
                    '--verbose[Print HTTP response headers]' \
                    '-v[Print HTTP response headers]' \
                    '--poll-interval[Specifies the poll interval used with --monitor]:poll-interval' \
                    '-i[Specifies the poll interval used with --monitor]:poll-interval' \
                    '--follow[Use the newest clone of each monitored job]' \
                    '-f[Use the newest clone of each monitored job]' \
                    && ret=0


            ;;
            reservation)

                # ---- Command: reservation
                _arguments -s -C \
                    '1: :->cmd1' \
                    '--apibase[API base, defaults to /api/v1]:apibase' \
                    '--apikey[API key. Use is discouraged due to risk of leaking credentials. Prefer config file or env variables.]:apikey' \
                    '--apisecret[API secret. Use is discouraged due to risk of leaking credentials. Prefer config file or env variables.]:apisecret' \
                    '--host[Target host, defaults to http://localhost]:host' \
                    '--help[Get more information on a specific command]' \
                    '-h[Get more information on a specific command]' \
                    '--osd[Set target host to http://openqa.suse.de]' \
                    '--o3[Set target host to https://openqa.opensuse.org]' \
                    '--odn[Set target host to https://openqa.debian.net]' \
                    '--links[Print pagination links to STDERR]' \
                    '-L[Print pagination links to STDERR]' \
                    '--name[Name of this client, used by openQA to identify different clients via User-Agent header, defaults to "openqa-cli" ]:name' \
                    '--pretty[Pretty print JSON content]' \
                    '-p[Pretty print JSON content]' \
                    '--quiet[Do not print error messages to STDERR]' \
                    '-q[Do not print error messages to STDERR]' \
                    '--verbose[Print HTTP response headers]' \
                    '-v[Print HTTP response headers]' \
                    '--class[Optional class for verification jobs]:class' \
                    '-C[Optional class for verification jobs]:class' \
                    '--comment[Comment describing the reason for reservation]:comment' \
                    '-c[Comment describing the reason for reservation]:comment' \
                    '--duration[Duration of the reservation (e.g. 5h, 30m, 2d, 0 for indefinite)]:duration' \
                    '-d[Duration of the reservation (e.g. 5h, 30m, 2d, 0 for indefinite)]:duration' \
                    '--force[Force reservation even if worker is already reserved]' \
                    '-f[Force reservation even if worker is already reserved]' \
                    '--release[Release an existing reservation]' \
                    '-r[Release an existing reservation]' \
                    && ret=0


            ;;
            schedule)

                # ---- Command: schedule
                _arguments -s -C \
                    '1: :->cmd1' \
                    '--apibase[API base, defaults to /api/v1]:apibase' \
                    '--apikey[API key. Use is discouraged due to risk of leaking credentials. Prefer config file or env variables.]:apikey' \
                    '--apisecret[API secret. Use is discouraged due to risk of leaking credentials. Prefer config file or env variables.]:apisecret' \
                    '--host[Target host, defaults to http://localhost]:host' \
                    '--help[Get more information on a specific command]' \
                    '-h[Get more information on a specific command]' \
                    '--osd[Set target host to http://openqa.suse.de]' \
                    '--o3[Set target host to https://openqa.opensuse.org]' \
                    '--odn[Set target host to https://openqa.debian.net]' \
                    '--links[Print pagination links to STDERR]' \
                    '-L[Print pagination links to STDERR]' \
                    '--name[Name of this client, used by openQA to identify different clients via User-Agent header, defaults to "openqa-cli" ]:name' \
                    '--pretty[Pretty print JSON content]' \
                    '-p[Pretty print JSON content]' \
                    '--quiet[Do not print error messages to STDERR]' \
                    '-q[Do not print error messages to STDERR]' \
                    '--verbose[Print HTTP response headers]' \
                    '-v[Print HTTP response headers]' \
                    '*--param-file[Load content of params from files instead of from command line arguments. Multiple params may be specified by adding the option multiple times ]:param-file' \
                    '--monitor[Wait until all jobs are done/cancelled and return non-zero exit code if at least on job has not passed/softfailed ]' \
                    '-m[Wait until all jobs are done/cancelled and return non-zero exit code if at least on job has not passed/softfailed ]' \
                    '--follow[Use the newest clone of each monitored job]' \
                    '-f[Use the newest clone of each monitored job]' \
                    '--poll-interval[Specifies the poll interval used with --monitor]:poll-interval' \
                    '-i[Specifies the poll interval used with --monitor]:poll-interval' \
                    && ret=0


            ;;
            esac

        ;;

        esac

}


__openqa-cli_dynamic_comp() {
    local argname="$1"
    local arg="$2"
    local comp="arg:$argname:(("
    local line
    while read -r line; do
        local name="$line"
        local desc="$line"
        name="${name%$'\t'*}"
        desc="${desc/*$'\t'}"
        comp="$comp$name"
        if [[ -n "$desc" && "$name" != "$desc" ]]; then
            comp="$comp\\:"'"'"$desc"'"'
        fi
        comp="$comp "
    done <<< "$arg"

    comp="$comp))"
    _alternative "$comp"
}

