2012-05-12 00:57:40 +00:00
|
|
|
# bash completion for ponysay -*- shell-script -*-
|
|
|
|
|
|
|
|
_ponysay()
|
|
|
|
{
|
|
|
|
local cur prev words cword
|
|
|
|
_init_completion -n = || return
|
|
|
|
|
2012-08-22 14:25:35 +00:00
|
|
|
options='--version --help --list --altlist --pony --wrap --quote --balloonlist --balloon --file ++file ++pony ++list ++altlist'
|
2012-07-19 02:32:35 +00:00
|
|
|
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
|
2012-05-12 00:57:40 +00:00
|
|
|
|
2012-08-22 14:25:35 +00:00
|
|
|
if [ $prev = "-f" ] || [ $prev = "--pony" ] || [ $prev = "--file" ]; then
|
2012-08-20 08:11:25 +00:00
|
|
|
ponies=$('/usr/bin/ponysay' --onelist)
|
2012-08-18 14:37:55 +00:00
|
|
|
COMPREPLY=( $( compgen -W "$ponies" -- "$cur" ) )
|
|
|
|
|
2012-08-22 14:25:35 +00:00
|
|
|
elif [ $prev = "-F" ] || [ $prev = "++pony" ] || [ $prev = "++file" ]; then
|
|
|
|
extraponies=$('/usr/bin/ponysay' ++onelist)
|
|
|
|
COMPREPLY=( $( compgen -W "$extraponies" -- "$cur" ) )
|
|
|
|
|
2012-08-19 01:30:11 +00:00
|
|
|
elif [ $prev = "-q" ] || [ $prev = "--quote" ]; then
|
2012-08-20 08:11:25 +00:00
|
|
|
quoters=$('/usr/bin/ponysay' --quoters)
|
2012-08-18 14:37:55 +00:00
|
|
|
COMPREPLY=( $( compgen -W "$quoters" -- "$cur" ) )
|
2012-08-18 00:34:54 +00:00
|
|
|
|
2012-08-25 18:18:53 +00:00
|
|
|
elif [ $prev = "-b" ] || [ $prev = "--balloon" ] || [ $prev = "--bubble" ]; then
|
2012-08-21 15:26:21 +00:00
|
|
|
balloons=$('/usr/bin/ponysay' --balloonlist)
|
|
|
|
COMPREPLY=( $( compgen -W "$balloons" -- "$cur" ) )
|
|
|
|
|
2012-08-19 01:30:11 +00:00
|
|
|
elif [ $prev = "-W" ] || [ $prev = "--wrap" ]; then
|
2012-07-19 02:32:35 +00:00
|
|
|
cols=$(( `stty size | cut -d ' ' -f 2` - 10 ))
|
|
|
|
COMPREPLY=( $cols $(( $cols / 2 )) 100 60 )
|
2012-08-18 00:34:54 +00:00
|
|
|
|
2012-05-12 00:57:40 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
complete -o default -F _ponysay ponysay
|
|
|
|
|