#compdef makewiz

autoload -U is-at-least

_makewiz() {
    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+[Set the compiler name for this Makefile]:COMPILER_NAME: ' \
'--compiler=[Set the compiler name for this Makefile]:COMPILER_NAME: ' \
'-e+[Set the executable name for this Makefile]:EXECUTABLE_NAME: ' \
'--executable=[Set the executable name for this Makefile]:EXECUTABLE_NAME: ' \
'-m[Add the math library(-lm) to this Makefile]' \
'--math[Add the math library(-lm) to this Makefile]' \
'-t[Add the thread library(-lpthread) to this Makefile]' \
'--thread[Add the thread library(-lpthread) to this Makefile]' \
'-r[Add the crypto library(-lcrypto) to this Makefile]' \
'--crypto[Add the crypto library(-lcrypto) to this Makefile]' \
'--cunit[Add the CUnit library(-lcunit) to this Makefile]' \
'--cppunit[Add the CPPUnit library(-lcppunit) to this Makefile]' \
'-h[Print help]' \
'--help[Print help]' \
'-V[Print version]' \
'--version[Print version]' \
":: :_makewiz_commands" \
"*::: :->makewiz" \
&& ret=0
    case $state in
    (makewiz)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:makewiz-command-$line[1]:"
        case $line[1] in
            (set-compiler)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
':name:' \
&& ret=0
;;
(set-executable)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
':name:' \
&& ret=0
;;
(default)
_arguments "${_arguments_options[@]}" \
'-h[Print help]' \
'--help[Print help]' \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
":: :_makewiz__help_commands" \
"*::: :->help" \
&& ret=0

    case $state in
    (help)
        words=($line[1] "${words[@]}")
        (( CURRENT += 1 ))
        curcontext="${curcontext%:*:*}:makewiz-help-command-$line[1]:"
        case $line[1] in
            (set-compiler)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(set-executable)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(default)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
(help)
_arguments "${_arguments_options[@]}" \
&& ret=0
;;
        esac
    ;;
esac
;;
        esac
    ;;
esac
}

(( $+functions[_makewiz_commands] )) ||
_makewiz_commands() {
    local commands; commands=(
'set-compiler:Set the default compiler name' \
'set-executable:Set the default executable name' \
'default:Show default values' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'makewiz commands' commands "$@"
}
(( $+functions[_makewiz__default_commands] )) ||
_makewiz__default_commands() {
    local commands; commands=()
    _describe -t commands 'makewiz default commands' commands "$@"
}
(( $+functions[_makewiz__help__default_commands] )) ||
_makewiz__help__default_commands() {
    local commands; commands=()
    _describe -t commands 'makewiz help default commands' commands "$@"
}
(( $+functions[_makewiz__help_commands] )) ||
_makewiz__help_commands() {
    local commands; commands=(
'set-compiler:Set the default compiler name' \
'set-executable:Set the default executable name' \
'default:Show default values' \
'help:Print this message or the help of the given subcommand(s)' \
    )
    _describe -t commands 'makewiz help commands' commands "$@"
}
(( $+functions[_makewiz__help__help_commands] )) ||
_makewiz__help__help_commands() {
    local commands; commands=()
    _describe -t commands 'makewiz help help commands' commands "$@"
}
(( $+functions[_makewiz__help__set-compiler_commands] )) ||
_makewiz__help__set-compiler_commands() {
    local commands; commands=()
    _describe -t commands 'makewiz help set-compiler commands' commands "$@"
}
(( $+functions[_makewiz__set-compiler_commands] )) ||
_makewiz__set-compiler_commands() {
    local commands; commands=()
    _describe -t commands 'makewiz set-compiler commands' commands "$@"
}
(( $+functions[_makewiz__help__set-executable_commands] )) ||
_makewiz__help__set-executable_commands() {
    local commands; commands=()
    _describe -t commands 'makewiz help set-executable commands' commands "$@"
}
(( $+functions[_makewiz__set-executable_commands] )) ||
_makewiz__set-executable_commands() {
    local commands; commands=()
    _describe -t commands 'makewiz set-executable commands' commands "$@"
}

if [ "$funcstack[1]" = "_makewiz" ]; then
    _makewiz "$@"
else
    compdef _makewiz makewiz
fi
