ponysay/completion/bash-completion.sh

28 lines
747 B
Bash
Raw Normal View History

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-16 16:36:52 +00:00
options='-v -h -l -f -W -q'
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
2012-05-12 00:57:40 +00:00
if [ $prev = "-f" ] || [ $prev = "--pony" ]; then
2012-08-18 14:37:55 +00:00
ponies=$('/usr/bin/ponysay.py' --onelist)
COMPREPLY=( $( compgen -W "$ponies" -- "$cur" ) )
elif [ $prev = "-q" ] || [ $prev = "--quote" ]; then
2012-08-18 14:37:55 +00:00
quoters=$('/usr/bin/ponysay.py' --quoters)
COMPREPLY=( $( compgen -W "$quoters" -- "$cur" ) )
elif [ $prev = "-W" ] || [ $prev = "--wrap" ]; then
cols=$(( `stty size | cut -d ' ' -f 2` - 10 ))
COMPREPLY=( $cols $(( $cols / 2 )) 100 60 )
2012-05-12 00:57:40 +00:00
fi
}
complete -o default -F _ponysay ponysay