PageRenderTime 45ms CodeModel.GetById 43ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/bash_completion.d/minicom

http://github.com/brinkman83/bashrc
#! | 54 lines | 48 code | 6 blank | 0 comment | 0 complexity | aff0b9e2243231a141bed69c11e4c848 MD5 | raw file
 1# bash completion for minicom
 2
 3have minicom &&
 4_minicom()
 5{
 6    local cur prev confdir
 7
 8    COMPREPLY=()
 9    cur=`_get_cword`
10    prev=${COMP_WORDS[COMP_CWORD-1]}
11
12    case $prev in
13        -@(a|c))
14            COMPREPLY=( $( compgen -W 'on off' -- "$cur" ) )
15            return 0
16            ;;
17        -@(S|C))
18            _filedir
19            return 0
20            ;;
21        -P)
22            COMPREPLY=( $( command ls /dev/tty* ) )
23            COMPREPLY=( $( compgen -W '${COMPREPLY[@]} ${COMPREPLY[@]#/dev/}' \
24                -- "$cur" ) )
25            return 0
26            ;;
27    esac
28
29
30    if [[ "$cur" == -* ]]; then
31        COMPREPLY=( $( compgen -W '-s -o -m -M -z -l -L -w -a -t \
32            -c -S -d -p -C -T -7 -8' -- "$cur" ) )
33        return 0
34    else
35        [ -n "$( command ls /etc/minirc.* 2>/dev/null)" ] \
36            && confdir=/etc
37        [ -n "$( command ls /etc/minicom/minirc.* 2>/dev/null)" ] \
38            && confdir=/etc/minicom
39        if [ -n "$confdir" ]; then
40            COMPREPLY=( $( compgen -W '$( command ls $confdir/minirc.* | \
41                sed -e "s|$confdir/minirc.||")' -- "$cur" ) )
42            return 0
43        fi
44    fi
45} &&
46complete -F _minicom $default minicom
47
48# Local variables:
49# mode: shell-script
50# sh-basic-offset: 4
51# sh-indent-comment: t
52# indent-tabs-mode: nil
53# End:
54# ex: ts=4 sw=4 et filetype=sh