PageRenderTime 161ms CodeModel.GetById 147ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 10ms

/bash_completion_lib/complete -o filenames/mc

http://github.com/brinkman83/bashrc
#! | 44 lines | 36 code | 8 blank | 0 comment | 0 complexity | 4dfdbb314d331863daef27d45f594dd7 MD5 | raw file
 1# mc(1) completion
 2
 3
 4comp_include _filedir _get_cword
 5
 6
 7_mc()
 8{
 9    local cur prev
10
11    COMPREPLY=()
12    cur=`_get_cword`
13    prev=${COMP_WORDS[COMP_CWORD-1]}
14
15    # -name value style option
16    case "$prev" in
17        -@(e|v|l|P))
18            _filedir
19            return 0
20            ;;
21    esac
22
23    # --name=value style option
24    if [[ "$cur" == *=* ]]; then
25        prev=${cur/=*/}
26        cur=${cur/*=/}
27        case "$prev" in
28            --@(edit|view|ftplog|printwd))
29                _filedir
30                return 0
31                ;;
32        esac
33    fi
34
35    if [[ "$cur" == -* ]]; then
36        COMPREPLY=( $( compgen -W '-a --stickchars -b --nocolor -c \
37            --color -C --colors= -d --nomouse -e --edit= -f \
38            --datadir -k --resetsoft -l --ftplog= -P --printwd= \
39            -s --slow -t --termcap -u --nosubshell -U --subshell \
40            -v --view= -V --version -x --xterm -h --help' -- $cur ) )
41    else
42        _filedir -d
43    fi
44} # _mc()