#compdef appspec-bash

# Generated with perl module App::Spec v0.013

_appspec-bash() {
    local program=appspec-bash
    typeset -A opt_args
    local curcontext="$curcontext" state line context


        # ---- Command: 
        _arguments -s  \
            '1: :->cmd1' \
            '*: :->args' \
            && ret=0


        case $state in
        cmd1)
            _alternative 'args:cmd2:((generate\:"Generate parser, help" help\:"Show command help" new\:"Generate new app"))'
        ;;

        args)
            case $line[1] in
            _meta)

                # ---- Command: _meta
                _arguments -s -C \
                    '1: :->cmd1' \
                    '2: :->cmd2' \
                    '*: :->args' \
                    && ret=0


                case $state in
                cmd2)
                    _alternative 'args:cmd3:((completion\:"Shell completion functions" pod\:"Pod documentation"))'
                ;;

                args)
                    case $line[2] in
                    completion)

                        # ---- Command: _meta completion
                        _arguments -s -C \
                            '1: :->cmd1' \
                            '2: :->cmd2' \
                            '3: :->cmd3' \
                            '*: :->args' \
                            && ret=0


                        case $state in
                        cmd3)
                            _alternative 'args:cmd4:((generate\:"Generate self completion"))'
                        ;;

                        args)
                            case $line[3] in
                            generate)

                                # ---- Command: _meta completion generate
                                _arguments -s -C \
                                    '1: :->cmd1' \
                                    '2: :->cmd2' \
                                    '3: :->cmd3' \
                                    '--help[Show command help]' \
                                    '-h[Show command help]' \
                                    '--name[name of the program (optional, override name in spec)]:name' \
                                    '--zsh[for zsh]' \
                                    '--bash[for bash]' \
                                    && ret=0


                            ;;
                            esac

                        ;;

                        esac
                    ;;
                    pod)

                        # ---- Command: _meta pod
                        _arguments -s -C \
                            '1: :->cmd1' \
                            '2: :->cmd2' \
                            '3: :->cmd3' \
                            '*: :->args' \
                            && ret=0


                        case $state in
                        cmd3)
                            _alternative 'args:cmd4:((generate\:"Generate self pod"))'
                        ;;

                        args)
                            case $line[3] in
                            generate)

                                # ---- Command: _meta pod generate
                                _arguments -s -C \
                                    '1: :->cmd1' \
                                    '2: :->cmd2' \
                                    '3: :->cmd3' \
                                    '--help[Show command help]' \
                                    '-h[Show command help]' \
                                    && ret=0


                            ;;
                            esac

                        ;;

                        esac
                    ;;
                    esac

                ;;

                esac
            ;;
            generate)

                # ---- Command: generate
                _arguments -s -C \
                    '1: :->cmd1' \
                    '2: :->cmd2' \
                    '*: :->args' \
                    && ret=0


                case $state in
                cmd2)
                    _alternative 'args:cmd3:((help\:"Generate help functions" parser\:"Generate main commandline parser script"))'
                ;;

                args)
                    case $line[2] in
                    help)

                        # ---- Command: generate help
                        _arguments -s -C \
                            '1: :->cmd1' \
                            '2: :->cmd2' \
                            '3: :->spec' \
                            '4: :->output' \
                            '--help[Show command help]' \
                            '-h[Show command help]' \
                            && ret=0

                        case $state in
                        spec)
_files
                        ;;
                        output)
_files
                        ;;
                        esac

                    ;;
                    parser)

                        # ---- Command: generate parser
                        _arguments -s -C \
                            '1: :->cmd1' \
                            '2: :->cmd2' \
                            '3: :->spec' \
                            '4: :->output' \
                            '--help[Show command help]' \
                            '-h[Show command help]' \
                            && ret=0

                        case $state in
                        spec)
_files
                        ;;
                        output)
_files
                        ;;
                        esac

                    ;;
                    esac

                ;;

                esac
            ;;
            help)

                # ---- Command: help
                _arguments -s -C \
                    '1: :->cmd1' \
                    '2: :->cmd2' \
                    '*: :->args' \
                    && ret=0


                case $state in
                cmd2)
                    _alternative 'args:cmd3:((generate new))'
                ;;

                args)
                    case $line[2] in
                    _meta)

                        # ---- Command: help _meta
                        _arguments -s -C \
                            '1: :->cmd1' \
                            '2: :->cmd2' \
                            '3: :->cmd3' \
                            '*: :->args' \
                            && ret=0


                        case $state in
                        cmd3)
                            _alternative 'args:cmd4:((completion pod))'
                        ;;

                        args)
                            case $line[3] in
                            completion)

                                # ---- Command: help _meta completion
                                _arguments -s -C \
                                    '1: :->cmd1' \
                                    '2: :->cmd2' \
                                    '3: :->cmd3' \
                                    '4: :->cmd4' \
                                    '*: :->args' \
                                    && ret=0


                                case $state in
                                cmd4)
                                    _alternative 'args:cmd5:((generate))'
                                ;;

                                args)
                                    case $line[4] in
                                    generate)

                                        # ---- Command: help _meta completion generate
                                        _arguments -s -C \
                                            '1: :->cmd1' \
                                            '2: :->cmd2' \
                                            '3: :->cmd3' \
                                            '4: :->cmd4' \
                                            '--help[Show command help]' \
                                            '-h[Show command help]' \
                                            '--all[]' \
                                            && ret=0


                                    ;;
                                    esac

                                ;;

                                esac
                            ;;
                            pod)

                                # ---- Command: help _meta pod
                                _arguments -s -C \
                                    '1: :->cmd1' \
                                    '2: :->cmd2' \
                                    '3: :->cmd3' \
                                    '4: :->cmd4' \
                                    '*: :->args' \
                                    && ret=0


                                case $state in
                                cmd4)
                                    _alternative 'args:cmd5:((generate))'
                                ;;

                                args)
                                    case $line[4] in
                                    generate)

                                        # ---- Command: help _meta pod generate
                                        _arguments -s -C \
                                            '1: :->cmd1' \
                                            '2: :->cmd2' \
                                            '3: :->cmd3' \
                                            '4: :->cmd4' \
                                            '--help[Show command help]' \
                                            '-h[Show command help]' \
                                            '--all[]' \
                                            && ret=0


                                    ;;
                                    esac

                                ;;

                                esac
                            ;;
                            esac

                        ;;

                        esac
                    ;;
                    generate)

                        # ---- Command: help generate
                        _arguments -s -C \
                            '1: :->cmd1' \
                            '2: :->cmd2' \
                            '3: :->cmd3' \
                            '*: :->args' \
                            && ret=0


                        case $state in
                        cmd3)
                            _alternative 'args:cmd4:((parser))'
                        ;;

                        args)
                            case $line[3] in
                            parser)

                                # ---- Command: help generate parser
                                _arguments -s -C \
                                    '1: :->cmd1' \
                                    '2: :->cmd2' \
                                    '3: :->cmd3' \
                                    '--help[Show command help]' \
                                    '-h[Show command help]' \
                                    '--all[]' \
                                    && ret=0


                            ;;
                            esac

                        ;;

                        esac
                    ;;
                    new)

                        # ---- Command: help new
                        _arguments -s -C \
                            '1: :->cmd1' \
                            '2: :->cmd2' \
                            '--help[Show command help]' \
                            '-h[Show command help]' \
                            '--all[]' \
                            && ret=0


                    ;;
                    esac

                ;;

                esac
            ;;
            new)

                # ---- Command: new
                _arguments -s -C \
                    '1: :->cmd1' \
                    '2: :->path' \
                    '--help[Show command help]' \
                    '-h[Show command help]' \
                    '--name[The (file) name of the app]:name' \
                    '-n[The (file) name of the app]:name' \
                    '--class[The main "class" (function prefix) for your app implementation]:class' \
                    '-c[The main "class" (function prefix) for your app implementation]:class' \
                    '--overwrite[Overwrite existing dist directory]' \
                    '-o[Overwrite existing dist directory]' \
                    && ret=0

                case $state in
                path)
_path_files -/
                ;;
                esac

            ;;
            esac

        ;;

        esac

}


__appspec-bash_dynamic_comp() {
    local argname="$1"
    local arg="$2"
    local comp="arg:$argname:(("
    local line
    while read -r line; do
        local name="$line"
        local desc="$line"
        name="${name%$'\t'*}"
        desc="${desc/*$'\t'}"
        comp="$comp$name"
        if [[ -n "$desc" && "$name" != "$desc" ]]; then
            comp="$comp\\:"'"'"$desc"'"'
        fi
        comp="$comp "
    done <<< "$arg"

    comp="$comp))"
    _alternative "$comp"
}

