diff options
author | Mattias Andrée <maandree@operamail.com> | 2012-08-18 02:34:54 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2012-08-18 02:34:54 +0200 |
commit | e868a2340093ec8fd3c77466b097ddbaf040875a (patch) | |
tree | 2b0733d3044831d81e95ef4bbfb3391ef86d448d /completion/bash-completion.sh | |
parent | 532ab6c6ee1e529cc98e4d85cd27d5664d2752ac (diff) | |
download | ponysay-e868a2340093ec8fd3c77466b097ddbaf040875a.tar.gz ponysay-e868a2340093ec8fd3c77466b097ddbaf040875a.tar.bz2 ponysay-e868a2340093ec8fd3c77466b097ddbaf040875a.zip |
bash and fish completion knowns which ponies have quotes
Diffstat (limited to 'completion/bash-completion.sh')
-rw-r--r-- | completion/bash-completion.sh | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/completion/bash-completion.sh b/completion/bash-completion.sh index 472bcb0..26e1134 100644 --- a/completion/bash-completion.sh +++ b/completion/bash-completion.sh @@ -8,7 +8,7 @@ _ponysay() options='-v -h -l -f -W -q' COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) - if [[ $prev = "-f" ]]; then + if [ $prev = "-f" ]; then COMPREPLY=() sysponies=/usr/share/ponysay/ponies/ @@ -18,17 +18,18 @@ _ponysay() usrponies=~/.local/share/ponysay/ttyponies/ fi - if [[ -d $sysponies ]]; then - COMPREPLY+=( $( compgen -W "$(ls --color=no $sysponies | sed -e 's/.pony//g')" -- "$cur" ) ) - fi - if [[ -d $usrponies ]]; then - COMPREPLY+=( $( compgen -W "$(ls --color=no $usrponies | sed -e 's/.pony//g')" -- "$cur" ) ) - fi - elif [[ $prev = "-W" ]]; then + [ -d $sysponies ] && COMPREPLY+=( $( compgen -W "$(ls --color=no $sysponies | sed -e 's/.pony//g')" -- "$cur" ) ) + [ -d $usrponies ] && COMPREPLY+=( $( compgen -W "$(ls --color=no $usrponies | sed -e 's/.pony//g')" -- "$cur" ) ) + + elif [ $prev = "-W" ]; then cols=$(( `stty size | cut -d ' ' -f 2` - 10 )) COMPREPLY=( $cols $(( $cols / 2 )) 100 60 ) - elif [[ $prev = "-q" ]]; then - COMPREPLY=( $( compgen -W "$quotes" -- "$cur" ) ) + + elif [ $prev = "-q" ]; then + qcmd=/usr/lib/ponysay/pq4ps + quoters=$($qcmd -l) + COMPREPLY=( $( compgen -W "$quoters" -- "$cur" ) ) + fi } |