PageRenderTime 185ms CodeModel.GetById 182ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/bash_completion.d/mc

http://github.com/brinkman83/bashrc
#! | 50 lines | 43 code | 7 blank | 0 comment | 0 complexity | a96e0604ea650ff46579096f49f0eb83 MD5 | raw file
 1# bash completion for mc
 2
 3have mc &&
 4_mc()
 5{
 6    local cur prev split=false
 7
 8    COMPREPLY=()
 9    cur=`_get_cword`
10    prev=${COMP_WORDS[COMP_CWORD-1]}
11
12    _split_longopt && split=true
13
14    case "$prev" in
15        -e|--edit|-v|--view|-l|--ftplog|-P|--printwd)
16            _filedir
17            return 0
18            ;;
19        -C|--colors|-D|--debuglevel)
20            # argument required but no completions available
21            return 0
22            ;;
23        -h|--help|-V|--version)
24            # all other arguments are noop with these
25            return 0
26            ;;
27    esac
28
29    $split && return 0
30
31    if [[ "$cur" == -* ]]; then
32        COMPREPLY=( $( compgen -W '-a --stickchars -b --nocolor -c \
33            --color -C --colors -d --nomouse -e --edit -f \
34            --datadir -k --resetsoft -l --ftplog -P --printwd \
35            -s --slow -t --termcap -u --nosubshell -U --subshell \
36            -v --view -V --version -x --xterm -D --debuglevel -h \
37            --help' -- "$cur" ) )
38    else
39        _filedir -d
40    fi
41} &&
42complete -F _mc $filenames mc
43
44# Local variables:
45# mode: shell-script
46# sh-basic-offset: 4
47# sh-indent-comment: t
48# indent-tabs-mode: nil
49# End:
50# ex: ts=4 sw=4 et filetype=sh