info update + bash completion improvement (long options are suggested)

This commit is contained in:
Mattias Andrée 2012-08-19 03:30:11 +02:00
parent 50a53b99aa
commit afcc9dc829
2 changed files with 27 additions and 3 deletions

View file

@ -8,15 +8,15 @@ _ponysay()
options='-v -h -l -f -W -q'
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
if [ $prev = "-f" ]; then
if [ $prev = "-f" ] || [ $prev = "--pony" ]; then
ponies=$('/usr/bin/ponysay.py' --onelist)
COMPREPLY=( $( compgen -W "$ponies" -- "$cur" ) )
elif [ $prev = "-q" ]; then
elif [ $prev = "-q" ] || [ $prev = "--quote" ]; then
quoters=$('/usr/bin/ponysay.py' --quoters)
COMPREPLY=( $( compgen -W "$quoters" -- "$cur" ) )
elif [ $prev = "-W" ]; then
elif [ $prev = "-W" ] || [ $prev = "--wrap" ]; then
cols=$(( `stty size | cut -d ' ' -f 2` - 10 ))
COMPREPLY=( $cols $(( $cols / 2 )) 100 60 )