#compdef rebuildctl

autoload -U is-at-least

_rebuildctl() {
    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+[rebuilderd endpoint to talk to]' \
'--endpoint=[rebuilderd endpoint to talk to]' \
'-c+[Configuration file path]' \
'--config=[Configuration file path]' \
'-C[Bypass tty detection and always use colors]' \
'--color[Bypass tty detection and always use colors]' \
'-v[Verbose logging]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
":: :_rebuildctl_commands" \
"*::: :->rebuildctl" \
&& ret=0
    case $state in
    (rebuildctl)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:rebuildctl-command-$line[1]:"
        case $line[1] in
            (status)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'-C[Bypass tty detection and always use colors]' \
'--color[Bypass tty detection and always use colors]' \
&& ret=0
;;
(pkgs)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'-C[Bypass tty detection and always use colors]' \
'--color[Bypass tty detection and always use colors]' \
":: :_rebuildctl__pkgs_commands" \
"*::: :->pkgs" \
&& ret=0
case $state in
    (pkgs)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:rebuildctl-pkgs-command-$line[1]:"
        case $line[1] in
            (sync)
_arguments "${_arguments_options[@]}" \
'*--architecture=[]' \
'*--maintainer=[]' \
'*--release=[]' \
'*--pkg=[]' \
'*--exclude=[]' \
'--print-json[]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'-C[Bypass tty detection and always use colors]' \
'--color[Bypass tty detection and always use colors]' \
':distro:_files' \
':suite:_files' \
':source:_files' \
&& ret=0
;;
(ls)
_arguments "${_arguments_options[@]}" \
'--name=[Filter packages matching this name]' \
'--status=[Filter packages matching this status]: :(GOOD BAD UNKWN)' \
'--distro=[Filter packages matching this distro]' \
'--suite=[Filter packages matching this suite]' \
'--architecture=[Filter packages matching this architecture]' \
'--json[]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'-C[Bypass tty detection and always use colors]' \
'--color[Bypass tty detection and always use colors]' \
&& ret=0
;;
(sync-profile)
_arguments "${_arguments_options[@]}" \
'--sync-config=[]' \
'--print-json[]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'-C[Bypass tty detection and always use colors]' \
'--color[Bypass tty detection and always use colors]' \
':profile:_files' \
&& ret=0
;;
(sync-stdin)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'-C[Bypass tty detection and always use colors]' \
'--color[Bypass tty detection and always use colors]' \
':distro:_files' \
':suite:_files' \
&& ret=0
;;
(requeue)
_arguments "${_arguments_options[@]}" \
'--name=[Filter packages matching this name]' \
'--status=[Filter packages matching this status]: :(GOOD BAD UNKWN)' \
'--distro=[Filter packages matching this distro]' \
'--suite=[Filter packages matching this suite]' \
'--architecture=[Filter packages matching this architecture]' \
'--priority=[Requeue with given priority]' \
'--reset[Reset the status back to UNKWN]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'-C[Bypass tty detection and always use colors]' \
'--color[Bypass tty detection and always use colors]' \
&& ret=0
;;
(log)
_arguments "${_arguments_options[@]}" \
'--name=[Filter packages matching this name]' \
'--status=[Filter packages matching this status]: :(GOOD BAD UNKWN)' \
'--distro=[Filter packages matching this distro]' \
'--suite=[Filter packages matching this suite]' \
'--architecture=[Filter packages matching this architecture]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'-C[Bypass tty detection and always use colors]' \
'--color[Bypass tty detection and always use colors]' \
&& ret=0
;;
(diffoscope)
_arguments "${_arguments_options[@]}" \
'--name=[Filter packages matching this name]' \
'--status=[Filter packages matching this status]: :(GOOD BAD UNKWN)' \
'--distro=[Filter packages matching this distro]' \
'--suite=[Filter packages matching this suite]' \
'--architecture=[Filter packages matching this architecture]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'-C[Bypass tty detection and always use colors]' \
'--color[Bypass tty detection and always use colors]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'-C[Bypass tty detection and always use colors]' \
'--color[Bypass tty detection and always use colors]' \
&& ret=0
;;
        esac
    ;;
esac
;;
(queue)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'-C[Bypass tty detection and always use colors]' \
'--color[Bypass tty detection and always use colors]' \
":: :_rebuildctl__queue_commands" \
"*::: :->queue" \
&& ret=0
case $state in
    (queue)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:rebuildctl-queue-command-$line[1]:"
        case $line[1] in
            (ls)
_arguments "${_arguments_options[@]}" \
'--head[]' \
'--json[]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'-C[Bypass tty detection and always use colors]' \
'--color[Bypass tty detection and always use colors]' \
&& ret=0
;;
(push)
_arguments "${_arguments_options[@]}" \
'--architecture=[]' \
'--priority=[]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'-C[Bypass tty detection and always use colors]' \
'--color[Bypass tty detection and always use colors]' \
':distro:_files' \
':suite:_files' \
':name:_files' \
'::version:_files' \
&& ret=0
;;
(drop)
_arguments "${_arguments_options[@]}" \
'--architecture=[]' \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'-C[Bypass tty detection and always use colors]' \
'--color[Bypass tty detection and always use colors]' \
':distro:_files' \
':suite:_files' \
':name:_files' \
'::version:_files' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'-C[Bypass tty detection and always use colors]' \
'--color[Bypass tty detection and always use colors]' \
&& ret=0
;;
        esac
    ;;
esac
;;
(completions)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'-C[Bypass tty detection and always use colors]' \
'--color[Bypass tty detection and always use colors]' \
':shell:(zsh bash fish powershell elvish)' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
'-h[Prints help information]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'-C[Bypass tty detection and always use colors]' \
'--color[Bypass tty detection and always use colors]' \
&& ret=0
;;
        esac
    ;;
esac
}

(( $+functions[_rebuildctl_commands] )) ||
_rebuildctl_commands() {
    local commands; commands=(
        "status:Show worker status" \
"pkgs:Package related subcommands" \
"queue:Queue related subcommands" \
"completions:Generate shell completions" \
"help:Prints this message or the help of the given subcommand(s)" \
    )
    _describe -t commands 'rebuildctl commands' commands "$@"
}
(( $+functions[_rebuildctl__completions_commands] )) ||
_rebuildctl__completions_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'rebuildctl completions commands' commands "$@"
}
(( $+functions[_rebuildctl__pkgs__diffoscope_commands] )) ||
_rebuildctl__pkgs__diffoscope_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'rebuildctl pkgs diffoscope commands' commands "$@"
}
(( $+functions[_rebuildctl__queue__drop_commands] )) ||
_rebuildctl__queue__drop_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'rebuildctl queue drop commands' commands "$@"
}
(( $+functions[_rebuildctl__help_commands] )) ||
_rebuildctl__help_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'rebuildctl help commands' commands "$@"
}
(( $+functions[_rebuildctl__pkgs__help_commands] )) ||
_rebuildctl__pkgs__help_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'rebuildctl pkgs help commands' commands "$@"
}
(( $+functions[_rebuildctl__queue__help_commands] )) ||
_rebuildctl__queue__help_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'rebuildctl queue help commands' commands "$@"
}
(( $+functions[_rebuildctl__pkgs__log_commands] )) ||
_rebuildctl__pkgs__log_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'rebuildctl pkgs log commands' commands "$@"
}
(( $+functions[_rebuildctl__pkgs__ls_commands] )) ||
_rebuildctl__pkgs__ls_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'rebuildctl pkgs ls commands' commands "$@"
}
(( $+functions[_rebuildctl__queue__ls_commands] )) ||
_rebuildctl__queue__ls_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'rebuildctl queue ls commands' commands "$@"
}
(( $+functions[_rebuildctl__pkgs_commands] )) ||
_rebuildctl__pkgs_commands() {
    local commands; commands=(
        "sync:Sync package index" \
"ls:List known packages" \
"sync-profile:Sync package index with profile" \
"sync-stdin:Read a package sync from stdin" \
"requeue:Requeue a given package" \
"log:Access the build log of the last rebuild" \
"diffoscope:Access the diffoscope of the last rebuild (if there is any)" \
"help:Prints this message or the help of the given subcommand(s)" \
    )
    _describe -t commands 'rebuildctl pkgs commands' commands "$@"
}
(( $+functions[_rebuildctl__queue__push_commands] )) ||
_rebuildctl__queue__push_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'rebuildctl queue push commands' commands "$@"
}
(( $+functions[_rebuildctl__queue_commands] )) ||
_rebuildctl__queue_commands() {
    local commands; commands=(
        "ls:List the current build queue" \
"push:Add a new task to the queue manually" \
"drop:Drop packages from queue matching given filter" \
"help:Prints this message or the help of the given subcommand(s)" \
    )
    _describe -t commands 'rebuildctl queue commands' commands "$@"
}
(( $+functions[_rebuildctl__pkgs__requeue_commands] )) ||
_rebuildctl__pkgs__requeue_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'rebuildctl pkgs requeue commands' commands "$@"
}
(( $+functions[_rebuildctl__status_commands] )) ||
_rebuildctl__status_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'rebuildctl status commands' commands "$@"
}
(( $+functions[_rebuildctl__pkgs__sync_commands] )) ||
_rebuildctl__pkgs__sync_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'rebuildctl pkgs sync commands' commands "$@"
}
(( $+functions[_rebuildctl__pkgs__sync-profile_commands] )) ||
_rebuildctl__pkgs__sync-profile_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'rebuildctl pkgs sync-profile commands' commands "$@"
}
(( $+functions[_rebuildctl__pkgs__sync-stdin_commands] )) ||
_rebuildctl__pkgs__sync-stdin_commands() {
    local commands; commands=(
        
    )
    _describe -t commands 'rebuildctl pkgs sync-stdin commands' commands "$@"
}

_rebuildctl "$@"