PageRenderTime 77ms CodeModel.GetById 74ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/bash_completion_lib/complete -o filenames/bzip2

http://github.com/brinkman83/bashrc
#! | 36 lines | 29 code | 7 blank | 0 comment | 0 complexity | 2413b02e788c463ff81a3804be4f4d7e MD5 | raw file
 1comp_include _expand _get_cword
 2
 3
 4_bzip2()
 5{
 6    local cur prev xspec IFS=$'\t\n'
 7
 8    COMPREPLY=()
 9    cur=`_get_cword`
10    prev=${COMP_WORDS[COMP_CWORD-1]}
11
12    if [[ "$cur" == -* ]]; then
13        COMPREPLY=( $( compgen -W '-c -d -f -h -k -L -q -s \
14            -t -v -V -z -1 -2 -3 -4 -5 -6 -7 -8 -9 \
15            --help --decompress --compress --keep --force \
16            --test --stdout --quiet --verbose --license \
17            --version --small --fast --best' -- $cur ) )
18        return 0
19    fi
20
21    xspec="*.bz2"
22    if [[ "$prev" == --* ]]; then
23        [[ "$prev" == --decompress || \
24            "$prev" == --list || \
25            "$prev" == --test ]] && xspec="!"$xspec
26        [[ "$prev" == --compress ]] && xspec=
27    elif [[ "$prev" == -* ]]; then
28        [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec
29        [[ "$prev" == -*z* ]] && xspec=
30    fi
31
32    _expand || return 0
33
34    COMPREPLY=( $( compgen -f -X "$xspec" -- $cur ) \
35            $( compgen -d -- $cur ) )
36} # bzip2()