App-Cme

 view release on metacpan or  search on metacpan

contrib/bash_completion.cme  view on Meta::CPAN

_cme_handle_cmd_arg()
{
	[[ $COMP_CWORD -ge 2 ]] && _cme_cmd_${COMP_WORDS[1]} 2> /dev/null ;
}

_cme()
{
    local cur

    COMPREPLY=()
    _get_comp_words_by_ref -n : cur prev

    if [[ $COMP_CWORD -eq 1 ]] ; then
        _cme_commands
    elif _cme_handle_cmd_arg; then
        TRASH=1; # bash does not support empty then/elif
    elif [[ $COMP_CWORD -eq 2 ]] ; then
        _cme_appli
    elif ! _cme_handle_app_arg; then
        case $prev in
            --ui)
                COMPREPLY=( $( compgen -W 'tk curses shell' -- $cur ) )
            ;;
           --dumptype)
                COMPREPLY=( $( compgen -W 'full preset custom' -- $cur ) )
            ;;
           --format)
                COMPREPLY=( $( compgen -W 'yaml json perl cml' -- $cur ) )
            ;;
           --model-dir|-root-dir|-fuse-dir)
                _filedir -d
            ;;
           --file)
                _filedir
            ;;
             *)
            case ${COMP_WORDS[1]} in
                check)
                   COMPREPLY=( $( compgen -W "$global_options --strict" -- $cur ) )
                ;;
                dump)
                   COMPREPLY=( $( compgen -W "$global_options --dumptype --format" -- $cur ) )
                ;;
                edit)
                   COMPREPLY=( $( compgen -W "$global_options --ui --open-item" -- $cur ) )
                ;;
                fix)
                   COMPREPLY=( $( compgen -W "$global_options --from --filter" -- $cur ) )
                ;;
                fusefs)
                   COMPREPLY=( $( compgen -W "$global_options --fuse-dir --dfuse --dir-char" -- $cur ) )
                ;;
                migrate)
                   COMPREPLY=( $( compgen -W "$global_options" -- $cur ) )
                ;;
                update)
                   COMPREPLY=( $( compgen -W "$global_options" -- $cur ) )
                ;;
                # modify completion could be much more elaborate...
                modify)
                   COMPREPLY=( $( compgen -W "$global_options --save --backup --format" -- $cur ) )
                ;;
                run)
                   COMPREPLY=( $( compgen -W "$global_options --doc --cat --no-commit" -- $cur ) )
				;;
                search)
                   COMPREPLY=( $( compgen -W "$global_options --search --narrow-search" -- $cur ) )
				;;
            esac
        esac
    fi
}
complete -F _cme cme



( run in 1.223 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )