#compdef nometa

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

_nometa() {
    local program=nometa
    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:((foo\:"Test command" help\:"Show command help" longsubcommand\:"A subcommand with a very long summary split over multiple lines "))'
        ;;

        args)
            case $line[1] in
            foo)

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

                case $state in
                test)
                        compadd -X 'test:' 'a' 'b' 'c'
                ;;
                esac

            ;;
            help)

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


                case $state in
                cmd2)
                    _alternative 'args:cmd3:((foo longsubcommand))'
                ;;

                args)
                    case $line[2] in
                    foo)

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


                    ;;
                    longsubcommand)

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


                    ;;
                    esac

                ;;

                esac
            ;;
            longsubcommand)

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

                case $state in
                longparam)

                ;;
                esac

            ;;
            esac

        ;;

        esac

}


__nometa_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"
}

