# bash completion for ponysay         -*- shell-script -*-

_ponysay()
{
    local cur prev words cword
    _init_completion -n = || return

    options="--help --help-colour --version --compact --list --symlist ++list ++symlist --all --symall --balloonlist --pony-only --info ++info --file --pony ++file ++pony --any-pony --quote --balloon --wrap --colour --restrict "" MESSAGE"
    COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )

    if [ $prev = "--balloon" ] || [ $prev = "-b" ] || [ $prev = "--bubble" ]; then
        suggestions="  $( '/usr/bin/ponysay' --balloonlist ) "
        COMPREPLY=( $( compgen -W "$suggestions" -- "$cur" ) )
    elif [ $prev = "--anyponies" ] || [ $prev = "--anypony" ] || [ $prev = "--anyfiles" ] || [ $prev = "--any-ponies" ] || [ $prev = "-F" ] || [ $prev = "--anyfile" ] || [ $prev = "--any-file" ] || [ $prev = "--any-files" ] || [ $prev = "--any-pony" ] || [ $prev = "--F" ]; then
        suggestions="  $( '/usr/bin/ponysay' --Onelist ) "
        COMPREPLY=( $( compgen -W "$suggestions" -- "$cur" ) )
    elif [ $prev = "++ponies" ] || [ $prev = "++f" ] || [ $prev = "++file" ] || [ $prev = "+f" ] || [ $prev = "++pony" ] || [ $prev = "++files" ]; then
        suggestions="  $( '/usr/bin/ponysay' ++onelist ) "
        COMPREPLY=( $( compgen -W "$suggestions" -- "$cur" ) )
    elif [ $prev = "-W" ] || [ $prev = "--wrap" ]; then
        suggestions=" none inherit 100 60 $(( $( (  stty size  |  cut -d ' ' -f 2  ) ) - 10 ))"
        COMPREPLY=( $( compgen -W "$suggestions" -- "$cur" ) )
    elif [ $prev = "--pony" ] || [ $prev = "--f" ] || [ $prev = "--ponies" ] || [ $prev = "--files" ] || [ $prev = "-f" ] || [ $prev = "--file" ]; then
        suggestions="  $( '/usr/bin/ponysay' --onelist ) "
        COMPREPLY=( $( compgen -W "$suggestions" -- "$cur" ) )
    elif [ $prev = "--quote" ] || [ $prev = "--quotes" ] || [ $prev = "-q" ] || [ $prev = "--q" ]; then
        suggestions="  $( '/usr/bin/ponysay' --quoters ) "
        COMPREPLY=( $( compgen -W "$suggestions" -- "$cur" ) )
    elif [ $prev = "-r" ] || [ $prev = "--restrict" ]; then
        suggestions=" kind=KIND group=GROUP coat=COAT eye=EYE mane=MANE aura=AURA"
        COMPREPLY=( $( compgen -W "$suggestions" -- "$cur" ) )
    fi
}

complete -o default -F _ponysay ponysay

