2012-05-12 02:57:40 +02:00
|
|
|
# bash completion for ponysay -*- shell-script -*-
|
|
|
|
|
|
|
|
_ponysay()
|
|
|
|
{
|
|
|
|
local cur prev words cword
|
|
|
|
_init_completion -n = || return
|
|
|
|
|
|
|
|
COMPREPLY=( $( compgen -W '-v -h -l -f -W' -- "$cur" ) )
|
|
|
|
|
|
|
|
if [[ $prev = "-f" ]]; then
|
|
|
|
COMPREPLY=()
|
|
|
|
|
2012-07-05 05:30:29 +02:00
|
|
|
sysponies=/usr/share/ponysay/ponies/
|
2012-05-12 02:57:40 +02:00
|
|
|
usrponies=~/.ponies/
|
|
|
|
if [[ $TERM = "linux" ]]; then
|
2012-07-05 05:30:29 +02:00
|
|
|
sysponies=/usr/share/ponysay/ttyponies/
|
2012-05-12 02:57:40 +02:00
|
|
|
usrponies=~/.ttyponies/
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ -d $sysponies ]]; then
|
2012-07-15 01:15:58 +02:00
|
|
|
COMPREPLY+=( $( compgen -W "$(ls --color=no $sysponies | sed -e 's/.pony//g')" -- "$cur" ) )
|
2012-05-12 02:57:40 +02:00
|
|
|
fi
|
|
|
|
if [[ -d $usrponies ]]; then
|
2012-07-15 01:15:58 +02:00
|
|
|
COMPREPLY+=( $( compgen -W "$(ls --color=no $usrponies | sed -e 's/.pony//g')" -- "$cur" ) )
|
2012-05-12 02:57:40 +02:00
|
|
|
fi
|
|
|
|
elif [[ $prev = "-W" ]]; then
|
|
|
|
cols=$( echo `tput cols` - 10 | bc )
|
|
|
|
COMPREPLY=( $cols $( echo $cols / 2 | bc ) 100 60 )
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
complete -o default -F _ponysay ponysay
|
|
|
|
|