mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-23 12:58:00 +01:00
36 lines
1.3 KiB
Bash
36 lines
1.3 KiB
Bash
# 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 --all ++all"
|
|
options="$options --256-colours --tty-colours --kms-colours"
|
|
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" ] || [ $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 ))
|
|
COMPREPLY=( $cols $(( $cols / 2 )) 100 60 none inherit )
|
|
|
|
fi
|
|
}
|
|
|
|
complete -o default -F _ponysay ponysay
|
|
|