aboutsummaryrefslogtreecommitdiff
path: root/completion
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2012-07-19 04:32:35 +0200
committerMattias Andrée <maandree@operamail.com>2012-07-19 04:32:35 +0200
commitf6c9058590d1ce018f37e5f63bcf5d66b093250f (patch)
tree3f215c924209783e12fbafb33b02b07677932427 /completion
parent9d0ec25753e74cf56fbc0a7b831fc506a2bb3147 (diff)
downloadponysay-f6c9058590d1ce018f37e5f63bcf5d66b093250f.tar.gz
ponysay-f6c9058590d1ce018f37e5f63bcf5d66b093250f.tar.bz2
ponysay-f6c9058590d1ce018f37e5f63bcf5d66b093250f.zip
bash completion dependency reduction and update
Diffstat (limited to 'completion')
-rw-r--r--completion/bash-completion.sh14
1 files changed, 11 insertions, 3 deletions
diff --git a/completion/bash-completion.sh b/completion/bash-completion.sh
index 82eb608..e119834 100644
--- a/completion/bash-completion.sh
+++ b/completion/bash-completion.sh
@@ -5,7 +5,13 @@ _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=()
@@ -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
}