#compdef mysimpleapp

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

_mysimpleapp() {
    local program=mysimpleapp
    typeset -A opt_args
    local curcontext="$curcontext" state line context


        # ---- Command: 
        _arguments -s  \
            '1: :->foo' \
            '2: :->bar' \
            '*--verbose[be verbose]' \
            '*-v[be verbose]' \
            '--wc[word count]' \
            '--lc[line count]' \
            '--with[with ...]:with:("ab" "cd" "ef")' \
            '--file1[existing file]:file1:_files' \
            '--file2[possible file]:file2:_files' \
            '--dir1[existing dir]:dir1:_path_files -/' \
            '--dir2[possible dir]:dir2:_path_files -/' \
            '--longoption[some long option description split over several lines to demonstrate ]' \
            '--longoption2[some other long option description split over several lines to demonstrate ]:longoption2' \
            '--help[Show command help]' \
            '-h[Show command help]' \
            && ret=0

        case $state in
        foo)
                compadd -X 'foo:' 'dist.ini' 'Makefile.PL' 'Changes'
        ;;
        bar)
                compadd -X 'bar:' 'a' 'b' 'c'
        ;;
        esac


}


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

