#compdef fontship

autoload -U is-at-least

_fontship() {
    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[@]}" : \
'-l+[Set language]:LANGUAGE:_default' \
'--language=[Set language]:LANGUAGE:_default' \
'-P+[Set project root path]:PROJECT:_files -/' \
'--project=[Set project root path]:PROJECT:_files -/' \
'-d[Enable extra debug output from tooling]' \
'--debug[Enable extra debug output from tooling]' \
'-p[Eschew all UI output and just pass the subprocess output through]' \
'--passthrough[Eschew all UI output and just pass the subprocess output through]' \
'-q[Discard all non-error output messages]' \
'--quiet[Discard all non-error output messages]' \
'-v[Enable extra verbose output from tooling]' \
'--verbose[Enable extra verbose output from tooling]' \
'-h[Print help]' \
'--help[Print help]' \
":: :_fontship_commands" \
"*::: :->fontship" \
&& ret=0
    case $state in
    (fontship)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:fontship-command-$line[1]:"
        case $line[1] in
            (make)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
'*::target -- Target as defined in Fontship or project rules:_files' \
&& ret=0
;;
(setup)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(status)
_arguments "${_arguments_options[@]}" : \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
":: :_fontship__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:fontship-help-command-$line[1]:"
        case $line[1] in
            (make)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(setup)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(status)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" : \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_fontship_commands] )) ||
_fontship_commands() {
    local commands; commands=(
'make:Build specified target(s) with ‘make’' \
'setup:Configure a font project repository' \
'status:Show status information about setup, configuration, and build state' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'fontship commands' commands "$@"
}
(( $+functions[_fontship__help_commands] )) ||
_fontship__help_commands() {
    local commands; commands=(
'make:Build specified target(s) with ‘make’' \
'setup:Configure a font project repository' \
'status:Show status information about setup, configuration, and build state' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'fontship help commands' commands "$@"
}
(( $+functions[_fontship__help__help_commands] )) ||
_fontship__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'fontship help help commands' commands "$@"
}
(( $+functions[_fontship__help__make_commands] )) ||
_fontship__help__make_commands() {
    local commands; commands=()
    _describe -t commands 'fontship help make commands' commands "$@"
}
(( $+functions[_fontship__help__setup_commands] )) ||
_fontship__help__setup_commands() {
    local commands; commands=()
    _describe -t commands 'fontship help setup commands' commands "$@"
}
(( $+functions[_fontship__help__status_commands] )) ||
_fontship__help__status_commands() {
    local commands; commands=()
    _describe -t commands 'fontship help status commands' commands "$@"
}
(( $+functions[_fontship__make_commands] )) ||
_fontship__make_commands() {
    local commands; commands=()
    _describe -t commands 'fontship make commands' commands "$@"
}
(( $+functions[_fontship__setup_commands] )) ||
_fontship__setup_commands() {
    local commands; commands=()
    _describe -t commands 'fontship setup commands' commands "$@"
}
(( $+functions[_fontship__status_commands] )) ||
_fontship__status_commands() {
    local commands; commands=()
    _describe -t commands 'fontship status commands' commands "$@"
}

if [ "$funcstack[1]" = "_fontship" ]; then
    _fontship "$@"
else
    compdef _fontship fontship
fi
