#compdef bodhi-cli

autoload -U is-at-least

_bodhi-cli() {
    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[@]}" \
'(--staging)--bodhi-url=[Manually specify bodhi server URL]:BODHI_URL: ' \
'(--staging)--login-url=[Manually specify OpenID endpoint URL]:LOGIN_URL: ' \
'--staging[Use the fedora staging instance of bodhi]' \
'-n[Don'\''t store password in session keyring]' \
'--no-store-password[Don'\''t store password in session keyring]' \
'-k[Ignore password stored in session keyring]' \
'--ignore-keyring[Ignore password stored in session keyring]' \
'-v[Make output more verbose]' \
'--verbose[Make output more verbose]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
":: :_bodhi-cli_commands" \
"*::: :->bodhi-cli" \
&& ret=0
    case $state in
    (bodhi-cli)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:bodhi-cli-command-$line[1]:"
        case $line[1] in
            (comment)
_arguments "${_arguments_options[@]}" \
'--update=[ID of the update to comment on]:UPDATE: ' \
'--text=[Publicly visible comment text]:TEXT: ' \
'--karma=[Karma submitted with this comment (-1/0/+1)]:KARMA: ' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(compose-info)
_arguments "${_arguments_options[@]}" \
'--format=[Output format (plain, JSON)]:FORMAT: ' \
'-h[Print help]' \
'--help[Print help]' \
':release -- release string:' \
':request -- request string ("stable" or "testing"):' \
&& ret=0
;;
(compose-list)
_arguments "${_arguments_options[@]}" \
'--format=[Output format (plain, JSON)]:FORMAT: ' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(create-override)
_arguments "${_arguments_options[@]}" \
'--duration=[duration (in days) it should be active]:DURATION: ' \
'--notes=[publicly visible notes]:NOTES: ' \
'-h[Print help]' \
'--help[Print help]' \
':nvr -- NVR of the override:' \
&& ret=0
;;
(create-update-override)
_arguments "${_arguments_options[@]}" \
'--duration=[duration (in days) it should be active]:DURATION: ' \
'--notes=[publicly visible notes]:NOTES: ' \
'-h[Print help]' \
'--help[Print help]' \
':alias -- alias of the update (i.e. "FEDORA-2022-XXXXXXXXXX"):' \
&& ret=0
;;
(create-update)
_arguments "${_arguments_options[@]}" \
'--autokarma=[Push to stable based on karma]:AUTOKARMA:(true false)' \
'--autotime=[Push to stable based on time]:AUTOTIME:(true false)' \
'*--bugs=[Bugs fixed by this update]:BUGS: ' \
'(--from-tag)*--builds=[Builds that are part of this update]:BUILDS: ' \
'--close-bugs=[Close bugs when pushed to stable]:CLOSE_BUGS:(true false)' \
'--display-name=[Override displayed update name]:DISPLAY_NAME: ' \
'(--builds)--from-tag=[Koji tag to create this update from]:FROM_TAG: ' \
'--notes=[Publicly visible update notes]:NOTES: ' \
'--require-bugs=[Require bug feedback for karma to count]:REQUIRE_BUGS:(true false)' \
'--require-testcases=[Require test case feedback for karma to count]:REQUIRE_TESTCASES:(true false)' \
'*--requirements=[List of required gating tests]:REQUIREMENTS: ' \
'--severity=[Update severity]:SEVERITY: ' \
'--stable-days=[Days until it can be pushed to stable]:STABLE_DAYS: ' \
'--stable-karma=[Karma until it can be pushed to stable]:STABLE_KARMA: ' \
'--suggestion=[Logout / reboot suggestion]:SUGGESTION: ' \
'--unstable-karma=[Karma until it will be unpushed]:UNSTABLE_KARMA: ' \
'--update-type=[Type of the update]:type: ' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(edit-override)
_arguments "${_arguments_options[@]}" \
'--duration=[duration it will still be active]:DURATION: ' \
'--notes=[publicly visible notes]:NOTES: ' \
'-h[Print help]' \
'--help[Print help]' \
':nvr -- NVR of the override:' \
&& ret=0
;;
(edit-update)
_arguments "${_arguments_options[@]}" \
'*--add-bugs=[Add bugs to this update]:ADD_BUGS: ' \
'*--add-builds=[Add builds to this update]:ADD_BUILDS: ' \
'--autokarma=[Push to stable based on karma]:AUTOKARMA:(true false)' \
'--autotime=[Push to stable based on time]:AUTOTIME:(true false)' \
'--close-bugs=[Close bugs when pushed to stable]:CLOSE_BUGS:(true false)' \
'--display-name=[Override displayed update name]:DISPLAY_NAME: ' \
'--notes=[Publicly visible update notes]:NOTES: ' \
'*--remove-bugs=[Remove bugs from this update]:REMOVE_BUGS: ' \
'*--remove-builds=[Remove builds from this update]:REMOVE_BUILDS: ' \
'*--requirements=[List of required gating tests]:REQUIREMENTS: ' \
'--severity=[Update severity]:SEVERITY: ' \
'--stable-days=[Days until it can be pushed to stable]:STABLE_DAYS: ' \
'--stable-karma=[Karma until it can be pushed to stable]:STABLE_KARMA: ' \
'--suggestion=[Logout / reboot suggestion]:SUGGESTION: ' \
'--unstable-karma=[Karma until it will be unpushed]:UNSTABLE_KARMA: ' \
'--update-type=[Type of the update]:type: ' \
'-h[Print help]' \
'--help[Print help]' \
':alias -- Alias of the edited update:' \
&& ret=0
;;
(expire-override)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
':nvr -- NVR of the override:' \
&& ret=0
;;
(query-overrides)
_arguments "${_arguments_options[@]}" \
'*--builds=[Query for this build / these builds]:BUILDS: ' \
'--expired=[Query for expired overrides]:EXPIRED:(true false)' \
'--format=[Output format (plain, JSON)]:FORMAT: ' \
'*--releases=[Query for this release / these releases]:RELEASES: ' \
'*--users=[Query for overrides submitted by these users]:USERS: ' \
'-f[Force long-running queries]' \
'--force[Force long-running queries]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(query-updates)
_arguments "${_arguments_options[@]}" \
'--alias=[update with this alias]:ALIAS: ' \
'*--bugs=[updates associated with these bugs]:BUGS: ' \
'*--builds=[updates associated with these builds]:BUILDS: ' \
'--critpath=[updates for critpath packages]:CRITPATH:(true false)' \
'--content-type=[RPM / module / flatpak updates]:CONTENT_TYPE: ' \
'--format=[Output format (plain, JSON)]:FORMAT: ' \
'--locked=[locked updates]:LOCKED:(true false)' \
'--modified-before=[updates modified before this date]:MODIFIED_BEFORE: ' \
'--modified-since=[updates modified after this date]:MODIFIED_SINCE: ' \
'*--packages=[updates for these packages]:PACKAGES: ' \
'--pushed=[pushed updates]:PUSHED:(true false)' \
'--pushed-before=[updates pushed before this date]:PUSHED_BEFORE: ' \
'--pushed-since=[updates pushed after this date]:PUSHED_SINCE: ' \
'*--releases=[updates for these releases]:RELEASES: ' \
'--request=[updates with this status request]:REQUEST: ' \
'--severity=[updates with this severity]:SEVERITY: ' \
'--status=[updates with this status]:STATUS: ' \
'--submitted-before=[updates submitted before this date]:SUBMITTED_BEFORE: ' \
'--submitted-since=[updates submitted after this date]:SUBMITTED_SINCE: ' \
'--suggestion=[updates with logout / reboot suggestion]:SUGGESTION: ' \
'--type=[updates with this type]:type: ' \
'*--users=[updates submitted by this user]:USERS: ' \
'-f[Force long-running queries]' \
'--force[Force long-running queries]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(release-info)
_arguments "${_arguments_options[@]}" \
'--format=[Output format (plain, JSON)]:FORMAT: ' \
'-h[Print help]' \
'--help[Print help]' \
':release -- ID of the release:' \
&& ret=0
;;
(release-list)
_arguments "${_arguments_options[@]}" \
'--format=[Output format (plain, JSON)]:FORMAT: ' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(update-request)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
':alias -- ID of the update:' \
':request -- (obsolete, revoke, stable, testing, unpush):' \
&& ret=0
;;
(waive-tests)
_arguments "${_arguments_options[@]}" \
'*--tests=[test results to be waived (default\: empty / all)]:TESTS: ' \
'-h[Print help]' \
'--help[Print help]' \
':alias -- ID of the update:' \
':comment -- comment submitted with the waiver:' \
&& ret=0
;;
        esac
    ;;
esac
}

(( $+functions[_bodhi-cli_commands] )) ||
_bodhi-cli_commands() {
    local commands; commands=(
'comment:Comment on an update' \
'compose-info:Query bodhi for information about a compose' \
'compose-list:Query bodhi for running composes' \
'create-override:Create a new buildroot override' \
'create-update-override:Create buildroot overrides from an update' \
'create-update:Create a new update' \
'edit-override:Edit an existing buildroot override' \
'edit-update:Edit an existing update' \
'expire-override:Expire an existing buildroot override' \
'query-overrides:Query bodhi for buildroot overrides' \
'query-updates:Query bodhi for updates' \
'release-info:Query bodhi for information about a release' \
'release-list:Query bodhi for active releases' \
'update-request:Submit an update status request' \
'waive-tests:Waive an update'\''s test results' \
    )
    _describe -t commands 'bodhi-cli commands' commands "$@"
}
(( $+functions[_bodhi-cli__comment_commands] )) ||
_bodhi-cli__comment_commands() {
    local commands; commands=()
    _describe -t commands 'bodhi-cli comment commands' commands "$@"
}
(( $+functions[_bodhi-cli__compose-info_commands] )) ||
_bodhi-cli__compose-info_commands() {
    local commands; commands=()
    _describe -t commands 'bodhi-cli compose-info commands' commands "$@"
}
(( $+functions[_bodhi-cli__compose-list_commands] )) ||
_bodhi-cli__compose-list_commands() {
    local commands; commands=()
    _describe -t commands 'bodhi-cli compose-list commands' commands "$@"
}
(( $+functions[_bodhi-cli__create-override_commands] )) ||
_bodhi-cli__create-override_commands() {
    local commands; commands=()
    _describe -t commands 'bodhi-cli create-override commands' commands "$@"
}
(( $+functions[_bodhi-cli__create-update_commands] )) ||
_bodhi-cli__create-update_commands() {
    local commands; commands=()
    _describe -t commands 'bodhi-cli create-update commands' commands "$@"
}
(( $+functions[_bodhi-cli__create-update-override_commands] )) ||
_bodhi-cli__create-update-override_commands() {
    local commands; commands=()
    _describe -t commands 'bodhi-cli create-update-override commands' commands "$@"
}
(( $+functions[_bodhi-cli__edit-override_commands] )) ||
_bodhi-cli__edit-override_commands() {
    local commands; commands=()
    _describe -t commands 'bodhi-cli edit-override commands' commands "$@"
}
(( $+functions[_bodhi-cli__edit-update_commands] )) ||
_bodhi-cli__edit-update_commands() {
    local commands; commands=()
    _describe -t commands 'bodhi-cli edit-update commands' commands "$@"
}
(( $+functions[_bodhi-cli__expire-override_commands] )) ||
_bodhi-cli__expire-override_commands() {
    local commands; commands=()
    _describe -t commands 'bodhi-cli expire-override commands' commands "$@"
}
(( $+functions[_bodhi-cli__query-overrides_commands] )) ||
_bodhi-cli__query-overrides_commands() {
    local commands; commands=()
    _describe -t commands 'bodhi-cli query-overrides commands' commands "$@"
}
(( $+functions[_bodhi-cli__query-updates_commands] )) ||
_bodhi-cli__query-updates_commands() {
    local commands; commands=()
    _describe -t commands 'bodhi-cli query-updates commands' commands "$@"
}
(( $+functions[_bodhi-cli__release-info_commands] )) ||
_bodhi-cli__release-info_commands() {
    local commands; commands=()
    _describe -t commands 'bodhi-cli release-info commands' commands "$@"
}
(( $+functions[_bodhi-cli__release-list_commands] )) ||
_bodhi-cli__release-list_commands() {
    local commands; commands=()
    _describe -t commands 'bodhi-cli release-list commands' commands "$@"
}
(( $+functions[_bodhi-cli__update-request_commands] )) ||
_bodhi-cli__update-request_commands() {
    local commands; commands=()
    _describe -t commands 'bodhi-cli update-request commands' commands "$@"
}
(( $+functions[_bodhi-cli__waive-tests_commands] )) ||
_bodhi-cli__waive-tests_commands() {
    local commands; commands=()
    _describe -t commands 'bodhi-cli waive-tests commands' commands "$@"
}

if [ "$funcstack[1]" = "_bodhi-cli" ]; then
    _bodhi-cli "$@"
else
    compdef _bodhi-cli bodhi-cli
fi
