PageRenderTime 27ms CodeModel.GetById 25ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/bash_completion.d/msynctool

http://github.com/brinkman83/bashrc
#! | 55 lines | 49 code | 6 blank | 0 comment | 0 complexity | bf91d1c6e3250b50460407028fe8cdf1 MD5 | raw file
 1# bash completion for msynctool
 2
 3have msynctool &&
 4_msynctool()
 5{
 6    local cur prev anteprev
 7
 8    COMPREPLY=()
 9    cur=`_get_cword`
10    prev=${COMP_WORDS[COMP_CWORD-1]}
11    if [ $COMP_CWORD -ge 2 ]; then
12        anteprev=${COMP_WORDS[COMP_CWORD-2]}
13    fi
14
15    case $anteprev in
16        --configure)
17            COMPREPLY=( $( compgen -W "$(msynctool --showgroup \
18                $prev | awk '/^Member/ {print $2}' | sed \
19                -e 's/:$//' )" -- "$cur" ) )
20            return 0
21            ;;
22        --addmember)
23            COMPREPLY=( $( compgen -W '$(msynctool --listplugins \
24                | sed -e '1d' )' -- "$cur" ) )
25            return 0
26            ;;
27    esac
28
29    case $prev in
30        --@(configure|@(add|del|show)group|sync|addmember))
31            COMPREPLY=( $( compgen -W '$(msynctool --listgroups \
32                | sed -e '1d' )' -- "$cur" ) )
33            return 0
34            ;;
35        --@(showformats|filter-objtype|slow-sync))
36            COMPREPLY=( $( compgen -W '$(msynctool --listobjects \
37                | sed -e '1d' )' -- "$cur" ) )
38            return 0
39            ;;
40    esac
41
42    COMPREPLY=( $( compgen -W '--listgroups --listplugins --listobjects \
43        --showformats --showgroup --sync --filter-objtype --slow-sync \
44        --wait --multi --addgroup --delgroup --addmember --configure \
45        --manual --configdir --conflict' -- "$cur" ) )
46} &&
47complete -F _msynctool msynctool
48
49# Local variables:
50# mode: shell-script
51# sh-basic-offset: 4
52# sh-indent-comment: t
53# indent-tabs-mode: nil
54# End:
55# ex: ts=4 sw=4 et filetype=sh