ponysay/completion/bash-completion.sh

37 lines
1.3 KiB
Bash
Raw Permalink Normal View History

2012-05-12 02:57:40 +02:00
# bash completion for ponysay -*- shell-script -*-
_ponysay()
{
local cur prev words cword
_init_completion -n = || return
2012-10-11 22:47:39 +02:00
options="--version --help --list --altlist --pony --wrap --quote --balloonlist --balloon --file ++file ++pony ++list ++altlist --all ++all"
options="$options --256-colours --tty-colours --kms-colours"
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
2012-05-12 02:57:40 +02:00
2012-08-22 16:25:35 +02:00
if [ $prev = "-f" ] || [ $prev = "--pony" ] || [ $prev = "--file" ]; then
2012-08-20 10:11:25 +02:00
ponies=$('/usr/bin/ponysay' --onelist)
2012-08-18 16:37:55 +02:00
COMPREPLY=( $( compgen -W "$ponies" -- "$cur" ) )
2012-08-22 16:25:35 +02:00
elif [ $prev = "-F" ] || [ $prev = "++pony" ] || [ $prev = "++file" ]; then
extraponies=$('/usr/bin/ponysay' ++onelist)
COMPREPLY=( $( compgen -W "$extraponies" -- "$cur" ) )
elif [ $prev = "-q" ] || [ $prev = "--quote" ]; then
2012-08-20 10:11:25 +02:00
quoters=$('/usr/bin/ponysay' --quoters)
2012-08-18 16:37:55 +02:00
COMPREPLY=( $( compgen -W "$quoters" -- "$cur" ) )
elif [ $prev = "-b" ] || [ $prev = "--balloon" ] || [ $prev = "--bubble" ]; 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 ))
2012-10-27 22:50:17 +02:00
COMPREPLY=( $cols $(( $cols / 2 )) 100 60 none inherit )
2012-05-12 02:57:40 +02:00
fi
}
complete -o default -F _ponysay ponysay