blob: 62e1d4073649ef87a069642cc6e64c7467734ecd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# bash completion for ponysay -*- shell-script -*-
_ponysay()
{
local cur prev words cword
_init_completion -n = || return
options='--version --help --list --altlist --pony --wrap --quote --balloonlist --balloon --file ++file ++pony ++list ++altlist'
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
if [ $prev = "-f" ] || [ $prev = "--pony" ] || [ $prev = "--file" ]; then
ponies=$('/usr/bin/ponysay' --onelist)
COMPREPLY=( $( compgen -W "$ponies" -- "$cur" ) )
elif [ $prev = "-F" ] || [ $prev = "++pony" ] || [ $prev = "++file" ]; then
extraponies=$('/usr/bin/ponysay' ++onelist)
COMPREPLY=( $( compgen -W "$extraponies" -- "$cur" ) )
elif [ $prev = "-q" ] || [ $prev = "--quote" ]; then
quoters=$('/usr/bin/ponysay' --quoters)
COMPREPLY=( $( compgen -W "$quoters" -- "$cur" ) )
elif [ $prev = "-b" ] || [ $prev = "--balloon" ]; then
balloons=$('/usr/bin/ponysay' --balloonlist)
COMPREPLY=( $( compgen -W "$balloons" -- "$cur" ) )
elif [ $prev = "-W" ] || [ $prev = "--wrap" ]; then
cols=$(( `stty size | cut -d ' ' -f 2` - 10 ))
COMPREPLY=( $cols $(( $cols / 2 )) 100 60 )
fi
}
complete -o default -F _ponysay ponysay
|