#compdef rake

autoload -U is-at-least

_rake() {
    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[@]}" : \
'-f+[Path to the Rakefile]:FILE:_files' \
'--file=[Path to the Rakefile]:FILE:_files' \
'--dry-run[Print the targets and commands that would run without executing anything. Tool checks and toolchain operations are also skipped. Configuration errors (unknown targets, missing shell variants) are still reported]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_rake_commands" \
"*::: :->rake" \
&& ret=0
    case $state in
    (rake)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:rake-command-$line[1]:"
        case $line[1] in
            (list)
_arguments "${_arguments_options[@]}" : \
'-f+[Path to the Rakefile]:FILE:_files' \
'--file=[Path to the Rakefile]:FILE:_files' \
'--dry-run[Print the targets and commands that would run without executing anything. Tool checks and toolchain operations are also skipped. Configuration errors (unknown targets, missing shell variants) are still reported]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(syntax)
_arguments "${_arguments_options[@]}" : \
'-f+[Path to the Rakefile]:FILE:_files' \
'--file=[Path to the Rakefile]:FILE:_files' \
'--dry-run[Print the targets and commands that would run without executing anything. Tool checks and toolchain operations are also skipped. Configuration errors (unknown targets, missing shell variants) are still reported]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(license)
_arguments "${_arguments_options[@]}" : \
'-f+[Path to the Rakefile]:FILE:_files' \
'--file=[Path to the Rakefile]:FILE:_files' \
'--dry-run[Print the targets and commands that would run without executing anything. Tool checks and toolchain operations are also skipped. Configuration errors (unknown targets, missing shell variants) are still reported]' \
'-h[Print help (see more with '\''--help'\'')]' \
'--help[Print help (see more with '\''--help'\'')]' \
":: :_rake__subcmd__license_commands" \
"*::: :->license" \
&& ret=0

    case $state in
    (license)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:rake-license-command-$line[1]:"
        case $line[1] in
            (remove)
_arguments "${_arguments_options[@]}" : \
'-f+[Path to the Rakefile]:FILE:_files' \
'--file=[Path to the Rakefile]:FILE:_files' \
'--dry-run[Print the targets and commands that would run without executing anything. Tool checks and toolchain operations are also skipped. Configuration errors (unknown targets, missing shell variants) are still reported]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(info)
_arguments "${_arguments_options[@]}" : \
'-f+[Path to the Rakefile]:FILE:_files' \
'--file=[Path to the Rakefile]:FILE:_files' \
'--dry-run[Print the targets and commands that would run without executing anything. Tool checks and toolchain operations are also skipped. Configuration errors (unknown targets, missing shell variants) are still reported]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_rake__subcmd__license__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:rake-license-help-command-$line[1]:"
        case $line[1] in
            (remove)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(info)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
;;
(basic)
_arguments "${_arguments_options[@]}" : \
'-f+[Path to the Rakefile]:FILE:_files' \
'--file=[Path to the Rakefile]:FILE:_files' \
'--dry-run[Print the targets and commands that would run without executing anything. Tool checks and toolchain operations are also skipped. Configuration errors (unknown targets, missing shell variants) are still reported]' \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_rake__subcmd__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:rake-help-command-$line[1]:"
        case $line[1] in
            (list)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(syntax)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(license)
_arguments "${_arguments_options[@]}" : \
":: :_rake__subcmd__help__subcmd__license_commands" \
"*::: :->license" \
&& ret=0

    case $state in
    (license)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:rake-help-license-command-$line[1]:"
        case $line[1] in
            (remove)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(info)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
(basic)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_rake_commands] )) ||
_rake_commands() {
    local commands; commands=(
'list:List the available targets and their commands' \
'syntax:Parse and validate the Rakefile, reporting any errors' \
'license:Activate a license key, remove the stored key, or show license info' \
'basic:Show whether the \`basic\` licensed feature is unlocked' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'rake commands' commands "$@"
}
(( $+functions[_rake__subcmd__basic_commands] )) ||
_rake__subcmd__basic_commands() {
    local commands; commands=()
    _describe -t commands 'rake basic commands' commands "$@"
}
(( $+functions[_rake__subcmd__help_commands] )) ||
_rake__subcmd__help_commands() {
    local commands; commands=(
'list:List the available targets and their commands' \
'syntax:Parse and validate the Rakefile, reporting any errors' \
'license:Activate a license key, remove the stored key, or show license info' \
'basic:Show whether the \`basic\` licensed feature is unlocked' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'rake help commands' commands "$@"
}
(( $+functions[_rake__subcmd__help__subcmd__basic_commands] )) ||
_rake__subcmd__help__subcmd__basic_commands() {
    local commands; commands=()
    _describe -t commands 'rake help basic commands' commands "$@"
}
(( $+functions[_rake__subcmd__help__subcmd__help_commands] )) ||
_rake__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'rake help help commands' commands "$@"
}
(( $+functions[_rake__subcmd__help__subcmd__license_commands] )) ||
_rake__subcmd__help__subcmd__license_commands() {
    local commands; commands=(
'remove:Remove the stored license key (prompts for confirmation)' \
'info:Show the licensee and the enabled/disabled state of every feature flag in the currently active license' \
    )
    _describe -t commands 'rake help license commands' commands "$@"
}
(( $+functions[_rake__subcmd__help__subcmd__license__subcmd__info_commands] )) ||
_rake__subcmd__help__subcmd__license__subcmd__info_commands() {
    local commands; commands=()
    _describe -t commands 'rake help license info commands' commands "$@"
}
(( $+functions[_rake__subcmd__help__subcmd__license__subcmd__remove_commands] )) ||
_rake__subcmd__help__subcmd__license__subcmd__remove_commands() {
    local commands; commands=()
    _describe -t commands 'rake help license remove commands' commands "$@"
}
(( $+functions[_rake__subcmd__help__subcmd__list_commands] )) ||
_rake__subcmd__help__subcmd__list_commands() {
    local commands; commands=()
    _describe -t commands 'rake help list commands' commands "$@"
}
(( $+functions[_rake__subcmd__help__subcmd__syntax_commands] )) ||
_rake__subcmd__help__subcmd__syntax_commands() {
    local commands; commands=()
    _describe -t commands 'rake help syntax commands' commands "$@"
}
(( $+functions[_rake__subcmd__license_commands] )) ||
_rake__subcmd__license_commands() {
    local commands; commands=(
'remove:Remove the stored license key (prompts for confirmation)' \
'info:Show the licensee and the enabled/disabled state of every feature flag in the currently active license' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'rake license commands' commands "$@"
}
(( $+functions[_rake__subcmd__license__subcmd__help_commands] )) ||
_rake__subcmd__license__subcmd__help_commands() {
    local commands; commands=(
'remove:Remove the stored license key (prompts for confirmation)' \
'info:Show the licensee and the enabled/disabled state of every feature flag in the currently active license' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'rake license help commands' commands "$@"
}
(( $+functions[_rake__subcmd__license__subcmd__help__subcmd__help_commands] )) ||
_rake__subcmd__license__subcmd__help__subcmd__help_commands() {
    local commands; commands=()
    _describe -t commands 'rake license help help commands' commands "$@"
}
(( $+functions[_rake__subcmd__license__subcmd__help__subcmd__info_commands] )) ||
_rake__subcmd__license__subcmd__help__subcmd__info_commands() {
    local commands; commands=()
    _describe -t commands 'rake license help info commands' commands "$@"
}
(( $+functions[_rake__subcmd__license__subcmd__help__subcmd__remove_commands] )) ||
_rake__subcmd__license__subcmd__help__subcmd__remove_commands() {
    local commands; commands=()
    _describe -t commands 'rake license help remove commands' commands "$@"
}
(( $+functions[_rake__subcmd__license__subcmd__info_commands] )) ||
_rake__subcmd__license__subcmd__info_commands() {
    local commands; commands=()
    _describe -t commands 'rake license info commands' commands "$@"
}
(( $+functions[_rake__subcmd__license__subcmd__remove_commands] )) ||
_rake__subcmd__license__subcmd__remove_commands() {
    local commands; commands=()
    _describe -t commands 'rake license remove commands' commands "$@"
}
(( $+functions[_rake__subcmd__list_commands] )) ||
_rake__subcmd__list_commands() {
    local commands; commands=()
    _describe -t commands 'rake list commands' commands "$@"
}
(( $+functions[_rake__subcmd__syntax_commands] )) ||
_rake__subcmd__syntax_commands() {
    local commands; commands=()
    _describe -t commands 'rake syntax commands' commands "$@"
}

if [ "$funcstack[1]" = "_rake" ]; then
    _rake "$@"
else
    compdef _rake rake
fi
