#compdef quipu

autoload -U is-at-least

_quipu() {
    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[@]}" : \
'-c+[Path to your configuration file]:FILE:_files' \
'--config=[Path to your configuration file]:FILE:_files' \
'-l+[Sets the logging level]:LEVEL:_default' \
'--level=[Sets the logging level]:LEVEL:_default' \
'-i+[instance name from your quipu configuration]:INSTANCE:_default' \
'--instance=[instance name from your quipu configuration]:INSTANCE:_default' \
'-u+[alternative url to contact]:URL:_default' \
'--url=[alternative url to contact]:URL:_default' \
'-g[If true show output beyond the local repository]' \
'--global[If true show output beyond the local repository]' \
'-j[Prefer JSON output where appliciable]' \
'--json[Prefer JSON output where appliciable]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_quipu_commands" \
"*::: :->quipu" \
&& ret=0
    case $state in
    (quipu)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:quipu-command-$line[1]:"
        case $line[1] in
            (ping)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(query)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
':resource:_default' \
&& ret=0
;;
(collections)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
":: :_quipu__subcmd__collections_commands" \
"*::: :->collections" \
&& ret=0

    case $state in
    (collections)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:quipu-collections-command-$line[1]:"
        case $line[1] in
            (scan)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_quipu__subcmd__collections__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:quipu-collections-help-command-$line[1]:"
        case $line[1] in
            (scan)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
;;
(build)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
":: :_quipu__subcmd__build_commands" \
"*::: :->build" \
&& ret=0

    case $state in
    (build)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:quipu-build-command-$line[1]:"
        case $line[1] in
            (logs)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'::manifest:_default' \
'::step:_default' \
&& ret=0
;;
(list)
_arguments "${_arguments_options[@]}" : \
'-l+[Limit the number of results]:LIMIT:_default' \
'--limit=[Limit the number of results]:LIMIT:_default' \
'-o+[Only show results larger than this ID]:OFFSET:_default' \
'--offset=[Only show results larger than this ID]:OFFSET:_default' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(inspect)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'::id -- Manifest identifier:_default' \
&& ret=0
;;
(output)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
":: :_quipu__subcmd__build__subcmd__output_commands" \
"*::: :->output" \
&& ret=0

    case $state in
    (output)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:quipu-build-output-command-$line[1]:"
        case $line[1] in
            (cat)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
':output_id -- Output identifier:_default' \
&& ret=0
;;
(export)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
':workflow_id -- Workflow identifier:_default' \
':archive_path -- Path to the archive file:_files' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_quipu__subcmd__build__subcmd__output__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:quipu-build-output-help-command-$line[1]:"
        case $line[1] in
            (cat)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(export)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_quipu__subcmd__build__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:quipu-build-help-command-$line[1]:"
        case $line[1] in
            (logs)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(inspect)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(output)
_arguments "${_arguments_options[@]}" : \
":: :_quipu__subcmd__build__subcmd__help__subcmd__output_commands" \
"*::: :->output" \
&& ret=0

    case $state in
    (output)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:quipu-build-help-output-command-$line[1]:"
        case $line[1] in
            (cat)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(export)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
;;
(events)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_quipu__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:quipu-help-command-$line[1]:"
        case $line[1] in
            (ping)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(query)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(collections)
_arguments "${_arguments_options[@]}" : \
":: :_quipu__subcmd__help__subcmd__collections_commands" \
"*::: :->collections" \
&& ret=0

    case $state in
    (collections)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:quipu-help-collections-command-$line[1]:"
        case $line[1] in
            (scan)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
(build)
_arguments "${_arguments_options[@]}" : \
":: :_quipu__subcmd__help__subcmd__build_commands" \
"*::: :->build" \
&& ret=0

    case $state in
    (build)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:quipu-help-build-command-$line[1]:"
        case $line[1] in
            (logs)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(inspect)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(output)
_arguments "${_arguments_options[@]}" : \
":: :_quipu__subcmd__help__subcmd__build__subcmd__output_commands" \
"*::: :->output" \
&& ret=0

    case $state in
    (output)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:quipu-help-build-output-command-$line[1]:"
        case $line[1] in
            (cat)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(export)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
;;
(events)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_quipu_commands] )) ||
_quipu_commands() {
    local commands; commands=(
'ping:Verify the remote server is functional' \
'query:Perform a webfinger query against the Ayllu instance' \
'collections:Collection and repository management' \
'build:Build management' \
'events:Firehose of events in the forge' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'quipu commands' commands "$@"
}
(( $+functions[_quipu__subcmd__build_commands] )) ||
_quipu__subcmd__build_commands() {
    local commands; commands=(
'logs:Inspect build logs' \
'list:List builds and their current status' \
'inspect:Inspect the status of a build' \
'output:' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'quipu build commands' commands "$@"
}
(( $+functions[_quipu__subcmd__build__subcmd__help_commands] )) ||
_quipu__subcmd__build__subcmd__help_commands() {
    local commands; commands=(
'logs:Inspect build logs' \
'list:List builds and their current status' \
'inspect:Inspect the status of a build' \
'output:' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'quipu build help commands' commands "$@"
}
(( $+functions[_quipu__subcmd__build__subcmd__help__subcmd__help_commands] )) ||
_quipu__subcmd__build__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'quipu build help help commands' commands "$@"
}
(( $+functions[_quipu__subcmd__build__subcmd__help__subcmd__inspect_commands] )) ||
_quipu__subcmd__build__subcmd__help__subcmd__inspect_commands() {
    local commands; commands=()
    _describe -t commands 'quipu build help inspect commands' commands "$@"
}
(( $+functions[_quipu__subcmd__build__subcmd__help__subcmd__list_commands] )) ||
_quipu__subcmd__build__subcmd__help__subcmd__list_commands() {
    local commands; commands=()
    _describe -t commands 'quipu build help list commands' commands "$@"
}
(( $+functions[_quipu__subcmd__build__subcmd__help__subcmd__logs_commands] )) ||
_quipu__subcmd__build__subcmd__help__subcmd__logs_commands() {
    local commands; commands=()
    _describe -t commands 'quipu build help logs commands' commands "$@"
}
(( $+functions[_quipu__subcmd__build__subcmd__help__subcmd__output_commands] )) ||
_quipu__subcmd__build__subcmd__help__subcmd__output_commands() {
    local commands; commands=(
'cat:Write the contents of the output to standard output' \
'export:Write the outputs of the workflow as a tar file to standard output' \
    )
    _describe -t commands 'quipu build help output commands' commands "$@"
}
(( $+functions[_quipu__subcmd__build__subcmd__help__subcmd__output__subcmd__cat_commands] )) ||
_quipu__subcmd__build__subcmd__help__subcmd__output__subcmd__cat_commands() {
    local commands; commands=()
    _describe -t commands 'quipu build help output cat commands' commands "$@"
}
(( $+functions[_quipu__subcmd__build__subcmd__help__subcmd__output__subcmd__export_commands] )) ||
_quipu__subcmd__build__subcmd__help__subcmd__output__subcmd__export_commands() {
    local commands; commands=()
    _describe -t commands 'quipu build help output export commands' commands "$@"
}
(( $+functions[_quipu__subcmd__build__subcmd__inspect_commands] )) ||
_quipu__subcmd__build__subcmd__inspect_commands() {
    local commands; commands=()
    _describe -t commands 'quipu build inspect commands' commands "$@"
}
(( $+functions[_quipu__subcmd__build__subcmd__list_commands] )) ||
_quipu__subcmd__build__subcmd__list_commands() {
    local commands; commands=()
    _describe -t commands 'quipu build list commands' commands "$@"
}
(( $+functions[_quipu__subcmd__build__subcmd__logs_commands] )) ||
_quipu__subcmd__build__subcmd__logs_commands() {
    local commands; commands=()
    _describe -t commands 'quipu build logs commands' commands "$@"
}
(( $+functions[_quipu__subcmd__build__subcmd__output_commands] )) ||
_quipu__subcmd__build__subcmd__output_commands() {
    local commands; commands=(
'cat:Write the contents of the output to standard output' \
'export:Write the outputs of the workflow as a tar file to standard output' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'quipu build output commands' commands "$@"
}
(( $+functions[_quipu__subcmd__build__subcmd__output__subcmd__cat_commands] )) ||
_quipu__subcmd__build__subcmd__output__subcmd__cat_commands() {
    local commands; commands=()
    _describe -t commands 'quipu build output cat commands' commands "$@"
}
(( $+functions[_quipu__subcmd__build__subcmd__output__subcmd__export_commands] )) ||
_quipu__subcmd__build__subcmd__output__subcmd__export_commands() {
    local commands; commands=()
    _describe -t commands 'quipu build output export commands' commands "$@"
}
(( $+functions[_quipu__subcmd__build__subcmd__output__subcmd__help_commands] )) ||
_quipu__subcmd__build__subcmd__output__subcmd__help_commands() {
    local commands; commands=(
'cat:Write the contents of the output to standard output' \
'export:Write the outputs of the workflow as a tar file to standard output' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'quipu build output help commands' commands "$@"
}
(( $+functions[_quipu__subcmd__build__subcmd__output__subcmd__help__subcmd__cat_commands] )) ||
_quipu__subcmd__build__subcmd__output__subcmd__help__subcmd__cat_commands() {
    local commands; commands=()
    _describe -t commands 'quipu build output help cat commands' commands "$@"
}
(( $+functions[_quipu__subcmd__build__subcmd__output__subcmd__help__subcmd__export_commands] )) ||
_quipu__subcmd__build__subcmd__output__subcmd__help__subcmd__export_commands() {
    local commands; commands=()
    _describe -t commands 'quipu build output help export commands' commands "$@"
}
(( $+functions[_quipu__subcmd__build__subcmd__output__subcmd__help__subcmd__help_commands] )) ||
_quipu__subcmd__build__subcmd__output__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'quipu build output help help commands' commands "$@"
}
(( $+functions[_quipu__subcmd__collections_commands] )) ||
_quipu__subcmd__collections_commands() {
    local commands; commands=(
'scan:Scan for repositories in all managed collections' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'quipu collections commands' commands "$@"
}
(( $+functions[_quipu__subcmd__collections__subcmd__help_commands] )) ||
_quipu__subcmd__collections__subcmd__help_commands() {
    local commands; commands=(
'scan:Scan for repositories in all managed collections' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'quipu collections help commands' commands "$@"
}
(( $+functions[_quipu__subcmd__collections__subcmd__help__subcmd__help_commands] )) ||
_quipu__subcmd__collections__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'quipu collections help help commands' commands "$@"
}
(( $+functions[_quipu__subcmd__collections__subcmd__help__subcmd__scan_commands] )) ||
_quipu__subcmd__collections__subcmd__help__subcmd__scan_commands() {
    local commands; commands=()
    _describe -t commands 'quipu collections help scan commands' commands "$@"
}
(( $+functions[_quipu__subcmd__collections__subcmd__scan_commands] )) ||
_quipu__subcmd__collections__subcmd__scan_commands() {
    local commands; commands=()
    _describe -t commands 'quipu collections scan commands' commands "$@"
}
(( $+functions[_quipu__subcmd__events_commands] )) ||
_quipu__subcmd__events_commands() {
    local commands; commands=()
    _describe -t commands 'quipu events commands' commands "$@"
}
(( $+functions[_quipu__subcmd__help_commands] )) ||
_quipu__subcmd__help_commands() {
    local commands; commands=(
'ping:Verify the remote server is functional' \
'query:Perform a webfinger query against the Ayllu instance' \
'collections:Collection and repository management' \
'build:Build management' \
'events:Firehose of events in the forge' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'quipu help commands' commands "$@"
}
(( $+functions[_quipu__subcmd__help__subcmd__build_commands] )) ||
_quipu__subcmd__help__subcmd__build_commands() {
    local commands; commands=(
'logs:Inspect build logs' \
'list:List builds and their current status' \
'inspect:Inspect the status of a build' \
'output:' \
    )
    _describe -t commands 'quipu help build commands' commands "$@"
}
(( $+functions[_quipu__subcmd__help__subcmd__build__subcmd__inspect_commands] )) ||
_quipu__subcmd__help__subcmd__build__subcmd__inspect_commands() {
    local commands; commands=()
    _describe -t commands 'quipu help build inspect commands' commands "$@"
}
(( $+functions[_quipu__subcmd__help__subcmd__build__subcmd__list_commands] )) ||
_quipu__subcmd__help__subcmd__build__subcmd__list_commands() {
    local commands; commands=()
    _describe -t commands 'quipu help build list commands' commands "$@"
}
(( $+functions[_quipu__subcmd__help__subcmd__build__subcmd__logs_commands] )) ||
_quipu__subcmd__help__subcmd__build__subcmd__logs_commands() {
    local commands; commands=()
    _describe -t commands 'quipu help build logs commands' commands "$@"
}
(( $+functions[_quipu__subcmd__help__subcmd__build__subcmd__output_commands] )) ||
_quipu__subcmd__help__subcmd__build__subcmd__output_commands() {
    local commands; commands=(
'cat:Write the contents of the output to standard output' \
'export:Write the outputs of the workflow as a tar file to standard output' \
    )
    _describe -t commands 'quipu help build output commands' commands "$@"
}
(( $+functions[_quipu__subcmd__help__subcmd__build__subcmd__output__subcmd__cat_commands] )) ||
_quipu__subcmd__help__subcmd__build__subcmd__output__subcmd__cat_commands() {
    local commands; commands=()
    _describe -t commands 'quipu help build output cat commands' commands "$@"
}
(( $+functions[_quipu__subcmd__help__subcmd__build__subcmd__output__subcmd__export_commands] )) ||
_quipu__subcmd__help__subcmd__build__subcmd__output__subcmd__export_commands() {
    local commands; commands=()
    _describe -t commands 'quipu help build output export commands' commands "$@"
}
(( $+functions[_quipu__subcmd__help__subcmd__collections_commands] )) ||
_quipu__subcmd__help__subcmd__collections_commands() {
    local commands; commands=(
'scan:Scan for repositories in all managed collections' \
    )
    _describe -t commands 'quipu help collections commands' commands "$@"
}
(( $+functions[_quipu__subcmd__help__subcmd__collections__subcmd__scan_commands] )) ||
_quipu__subcmd__help__subcmd__collections__subcmd__scan_commands() {
    local commands; commands=()
    _describe -t commands 'quipu help collections scan commands' commands "$@"
}
(( $+functions[_quipu__subcmd__help__subcmd__events_commands] )) ||
_quipu__subcmd__help__subcmd__events_commands() {
    local commands; commands=()
    _describe -t commands 'quipu help events commands' commands "$@"
}
(( $+functions[_quipu__subcmd__help__subcmd__help_commands] )) ||
_quipu__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'quipu help help commands' commands "$@"
}
(( $+functions[_quipu__subcmd__help__subcmd__ping_commands] )) ||
_quipu__subcmd__help__subcmd__ping_commands() {
    local commands; commands=()
    _describe -t commands 'quipu help ping commands' commands "$@"
}
(( $+functions[_quipu__subcmd__help__subcmd__query_commands] )) ||
_quipu__subcmd__help__subcmd__query_commands() {
    local commands; commands=()
    _describe -t commands 'quipu help query commands' commands "$@"
}
(( $+functions[_quipu__subcmd__ping_commands] )) ||
_quipu__subcmd__ping_commands() {
    local commands; commands=()
    _describe -t commands 'quipu ping commands' commands "$@"
}
(( $+functions[_quipu__subcmd__query_commands] )) ||
_quipu__subcmd__query_commands() {
    local commands; commands=()
    _describe -t commands 'quipu query commands' commands "$@"
}

if [ "$funcstack[1]" = "_quipu" ]; then
    _quipu "$@"
else
    compdef _quipu quipu
fi
