#compdef repro-env

autoload -U is-at-least

_repro-env() {
    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+[Change the current directory to this path before executing the subcommand]:CONTEXT:_files' \
'--context=[Change the current directory to this path before executing the subcommand]:CONTEXT:_files' \
'*-v[Increase logging output (can be used multiple times)]' \
'*--verbose[Increase logging output (can be used multiple times)]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_repro-env_commands" \
"*::: :->repro-env" \
&& ret=0
    case $state in
    (repro-env)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:repro-env-command-$line[1]:"
        case $line[1] in
            (build)
_arguments "${_arguments_options[@]}" \
'-f+[The dependency lockfile to use]:FILE:_files' \
'--file=[The dependency lockfile to use]:FILE:_files' \
'*-e+[Pass environment variables into the build container (FOO=bar or just FOO to lookup the value)]:ENV: ' \
'*--env=[Pass environment variables into the build container (FOO=bar or just FOO to lookup the value)]:ENV: ' \
'-k[Do not delete the build container, wait for ctrl-c]' \
'--keep[Do not delete the build container, wait for ctrl-c]' \
'*-v[Increase logging output (can be used multiple times)]' \
'*--verbose[Increase logging output (can be used multiple times)]' \
'-h[Print help]' \
'--help[Print help]' \
'*::cmd -- The command to execute inside the build container:' \
&& ret=0
;;
(update)
_arguments "${_arguments_options[@]}" \
'--no-pull[Do not attempt to pull the container tag from registry before resolving it]' \
'-k[Do not delete the build container, wait for ctrl-c]' \
'--keep[Do not delete the build container, wait for ctrl-c]' \
'*-v[Increase logging output (can be used multiple times)]' \
'*--verbose[Increase logging output (can be used multiple times)]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(fetch)
_arguments "${_arguments_options[@]}" \
'-f+[The dependency lockfile to use]:FILE:_files' \
'--file=[The dependency lockfile to use]:FILE:_files' \
'--no-pull[Do not attempt to pull the container tag from registry]' \
'*-v[Increase logging output (can be used multiple times)]' \
'*--verbose[Increase logging output (can be used multiple times)]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" \
'*-v[Increase logging output (can be used multiple times)]' \
'*--verbose[Increase logging output (can be used multiple times)]' \
'-h[Print help]' \
'--help[Print help]' \
':shell:(bash elvish fish powershell zsh)' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
":: :_repro-env__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:repro-env-help-command-$line[1]:"
        case $line[1] in
            (build)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(update)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(fetch)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(completions)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_repro-env_commands] )) ||
_repro-env_commands() {
    local commands; commands=(
'build:Run a build in a reproducible environment' \
'update:Update all dependencies of the reproducible environment' \
'fetch:Fetch dependencies into the local cache' \
'completions:Generate shell completions' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'repro-env commands' commands "$@"
}
(( $+functions[_repro-env__build_commands] )) ||
_repro-env__build_commands() {
    local commands; commands=()
    _describe -t commands 'repro-env build commands' commands "$@"
}
(( $+functions[_repro-env__help__build_commands] )) ||
_repro-env__help__build_commands() {
    local commands; commands=()
    _describe -t commands 'repro-env help build commands' commands "$@"
}
(( $+functions[_repro-env__completions_commands] )) ||
_repro-env__completions_commands() {
    local commands; commands=()
    _describe -t commands 'repro-env completions commands' commands "$@"
}
(( $+functions[_repro-env__help__completions_commands] )) ||
_repro-env__help__completions_commands() {
    local commands; commands=()
    _describe -t commands 'repro-env help completions commands' commands "$@"
}
(( $+functions[_repro-env__fetch_commands] )) ||
_repro-env__fetch_commands() {
    local commands; commands=()
    _describe -t commands 'repro-env fetch commands' commands "$@"
}
(( $+functions[_repro-env__help__fetch_commands] )) ||
_repro-env__help__fetch_commands() {
    local commands; commands=()
    _describe -t commands 'repro-env help fetch commands' commands "$@"
}
(( $+functions[_repro-env__help_commands] )) ||
_repro-env__help_commands() {
    local commands; commands=(
'build:Run a build in a reproducible environment' \
'update:Update all dependencies of the reproducible environment' \
'fetch:Fetch dependencies into the local cache' \
'completions:Generate shell completions' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'repro-env help commands' commands "$@"
}
(( $+functions[_repro-env__help__help_commands] )) ||
_repro-env__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'repro-env help help commands' commands "$@"
}
(( $+functions[_repro-env__help__update_commands] )) ||
_repro-env__help__update_commands() {
    local commands; commands=()
    _describe -t commands 'repro-env help update commands' commands "$@"
}
(( $+functions[_repro-env__update_commands] )) ||
_repro-env__update_commands() {
    local commands; commands=()
    _describe -t commands 'repro-env update commands' commands "$@"
}

if [ "$funcstack[1]" = "_repro-env" ]; then
    _repro-env "$@"
else
    compdef _repro-env repro-env
fi
