App-Spec

 view release on metacpan or  search on metacpan

examples/bash/myapp.bash  view on Meta::CPAN

#!/usr/bin/env bash

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

_myapp() {

    COMPREPLY=()
    local program=myapp
    local cur prev words cword
    _init_completion -n : || return
    declare -a FLAGS
    declare -a OPTIONS
    declare -a MYWORDS

    local INDEX=`expr $cword - 1`
    MYWORDS=("${words[@]:1:$cword}")

    FLAGS=('--verbose' 'be verbose' '-v' 'be verbose' '--help' 'Show command help' '-h' 'Show command help')
    OPTIONS=('--format' 'Format output')
    __myapp_handle_options_flags

    case $INDEX in

    0)
        __comp_current_options || return
        __myapp_dynamic_comp 'commands' 'config'$'\t''configuration'$'\n''convert'$'\t''Various unit conversions'$'\n''cook'$'\t''Cook something'$'\n''data'$'\t''output some data'$'\n''help'$'\t''Show command help'$'\n''palindrome'$'\t''Check if a st...

    ;;
    *)
    # subcmds
    case ${MYWORDS[0]} in
      _meta)
        __myapp_handle_options_flags
        case $INDEX in

        1)
            __comp_current_options || return
            __myapp_dynamic_comp 'commands' 'completion'$'\t''Shell completion functions'$'\n''pod'$'\t''Pod documentation'

        ;;
        *)
        # subcmds
        case ${MYWORDS[1]} in
          completion)
            __myapp_handle_options_flags
            case $INDEX in

            2)
                __comp_current_options || return
                __myapp_dynamic_comp 'commands' 'generate'$'\t''Generate self completion'

            ;;
            *)
            # subcmds
            case ${MYWORDS[2]} in
              generate)
                FLAGS+=('--zsh' 'for zsh' '--bash' 'for bash')
                OPTIONS+=('--name' 'name of the program (optional, override name in spec)')
                __myapp_handle_options_flags
                case ${MYWORDS[$INDEX-1]} in
                  --format)
                    _myapp_compreply "JSON" "YAML" "Table" "Data::Dumper" "Data::Dump"
                    return
                  ;;
                  --name)
                  ;;

                esac
                case $INDEX in

                *)
                    __comp_current_options || return
                ;;
                esac
              ;;
            esac

            ;;
            esac
          ;;
          pod)
            __myapp_handle_options_flags
            case $INDEX in

            2)
                __comp_current_options || return



( run in 1.483 second using v1.01-cache-2.11-cpan-2398b32b56e )