PageRenderTime 39ms CodeModel.GetById 35ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/bash_completion.d/cowsay

http://github.com/brinkman83/bashrc
#! | 32 lines | 26 code | 6 blank | 0 comment | 0 complexity | 6df1a768e4d228e449e5b3a378cb0e31 MD5 | raw file
 1# bash completion for cowsay
 2
 3have cowsay &&
 4_cowsay()
 5{
 6    local cur prev
 7
 8    COMPREPLY=()
 9    cur=`_get_cword`
10    prev=${COMP_WORDS[COMP_CWORD-1]}
11
12    case $prev in
13        -f)
14            COMPREPLY=( $( compgen -W '$( cowsay -l | tail -n +2)' -- "$cur" ) )
15            return 0
16            ;;
17    esac
18
19    # relevant options completion
20    COMPREPLY=( $( compgen -W '-b -d -g -p -s -t -w -y -e -f -h -l -n -T -W' \
21        -- "$cur" ) )
22
23} &&
24complete -F _cowsay $default cowsay cowthink
25
26# Local variables:
27# mode: shell-script
28# sh-basic-offset: 4
29# sh-indent-comment: t
30# indent-tabs-mode: nil
31# End:
32# ex: ts=4 sw=4 et filetype=sh