diff options
author | Pablo Lezaeta <prflr88@gmail.com> | 2012-07-18 14:50:47 -0400 |
---|---|---|
committer | Pablo Lezaeta <prflr88@gmail.com> | 2012-07-18 14:50:47 -0400 |
commit | a05a292af72f2a4269ff02850cac31599878a3a8 (patch) | |
tree | 181aa59662ba13f391bf7be9c1a2f0d7ce838e0a /completion/bash-completion.sh | |
parent | 10cc33f87aac4a8fb7d553a974cccaedf8852c8d (diff) | |
parent | 839f0b20e8e4982da6a152bd6d702b699d352324 (diff) | |
download | ponysay-a05a292af72f2a4269ff02850cac31599878a3a8.tar.gz ponysay-a05a292af72f2a4269ff02850cac31599878a3a8.tar.bz2 ponysay-a05a292af72f2a4269ff02850cac31599878a3a8.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'completion/bash-completion.sh')
-rw-r--r-- | completion/bash-completion.sh | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/completion/bash-completion.sh b/completion/bash-completion.sh index 82eb608..53c53ef 100644 --- a/completion/bash-completion.sh +++ b/completion/bash-completion.sh @@ -5,16 +5,22 @@ _ponysay() local cur prev words cword _init_completion -n = || return - COMPREPLY=( $( compgen -W '-v -h -l -f -W' -- "$cur" ) ) + quotes=$(pq4ps --list 2>/dev/null) + quotesexit=$? + options='-v -h -l -f -W' + if [[ $quotesexit = 0 ]]; then + options="$options -q" + fi + COMPREPLY=( $( compgen -W "$options" -- "$cur" ) ) if [[ $prev = "-f" ]]; then COMPREPLY=() sysponies=/usr/share/ponysay/ponies/ - usrponies=~/.ponies/ + usrponies=~/.local/share/ponysay/ponies/ if [[ $TERM = "linux" ]]; then sysponies=/usr/share/ponysay/ttyponies/ - usrponies=~/.ttyponies/ + usrponies=~/.local/share/ponysay/ttyponies/ fi if [[ -d $sysponies ]]; then @@ -24,8 +30,10 @@ _ponysay() COMPREPLY+=( $( compgen -W "$(ls --color=no $usrponies | sed -e 's/.pony//g')" -- "$cur" ) ) fi elif [[ $prev = "-W" ]]; then - cols=$( echo `tput cols` - 10 | bc ) - COMPREPLY=( $cols $( echo $cols / 2 | bc ) 100 60 ) + cols=$(( `stty size | cut -d ' ' -f 2` - 10 )) + COMPREPLY=( $cols $(( $cols / 2 )) 100 60 ) + elif [[ $quotesexit = 0 ]] && [[ $prev = "-q" ]]; then + COMPREPLY=( $( compgen -W "$quotes" -- "$cur" ) ) fi } |