PageRenderTime 84ms CodeModel.GetById 41ms app.highlight 0ms RepoModel.GetById 40ms app.codeStats 0ms

/bash_completion.d/lzma

http://github.com/brinkman83/bashrc
#! | 47 lines | 39 code | 8 blank | 0 comment | 0 complexity | 4e4a3a6f21967260b66810a98aa5a6ea MD5 | raw file
 1# lzma(1) completion by Per Øyvind Karlsen <peroyvind@mandriva.org>
 2
 3have lzma &&
 4_lzma()
 5{
 6    local cur prev xspec
 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            -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 --text' -- "$cur" ) )
18        return 0
19    fi
20
21    local IFS=$'\t\n'
22
23    xspec="*.lzma"
24    if [[ "$prev" == --* ]]; then
25        [[ "$prev" == --decompress || \
26            "$prev" == --list || \
27            "$prev" == --test ]] && xspec="!"$xspec
28        [[ "$prev" == --compress ]] && xspec=
29    elif [[ "$prev" == -* ]]; then
30        [[ "$prev" == -*[dt]* ]] && xspec="!"$xspec
31        [[ "$prev" == -*z* ]] && xspec=
32    fi
33
34    _expand || return 0
35
36    COMPREPLY=( $( compgen -f -X "$xspec" -- "$cur" ) \
37        $( compgen -d -- "$cur" ) )
38} &&
39complete -F _lzma $filenames lzma
40
41# Local variables:
42# mode: shell-script
43# sh-basic-offset: 4
44# sh-indent-comment: t
45# indent-tabs-mode: nil
46# End:
47# ex: ts=4 sw=4 et filetype=sh