aboutsummaryrefslogtreecommitdiff
path: root/completion
diff options
context:
space:
mode:
authorElis Axelsson <elis.axelsson@gmail.com>2012-08-18 16:51:43 +0200
committerElis Axelsson <elis.axelsson@gmail.com>2012-08-18 16:51:43 +0200
commitb46c13a16e175fb63bc253e914fd8b3717e3087a (patch)
tree6b3774ab5933fd2c3c74f62e093926e2ee7dbfe8 /completion
parent3a65390937e4bfd7cdd859dea24c728ab3b66063 (diff)
parentf9663c7b1bb21922efb775136e6c75dda9ba83ce (diff)
downloadponysay-b46c13a16e175fb63bc253e914fd8b3717e3087a.tar.gz
ponysay-b46c13a16e175fb63bc253e914fd8b3717e3087a.tar.bz2
ponysay-b46c13a16e175fb63bc253e914fd8b3717e3087a.zip
Merge
Diffstat (limited to 'completion')
-rw-r--r--completion/bash-completion.sh24
-rw-r--r--completion/fish-completion.fish31
2 files changed, 11 insertions, 44 deletions
diff --git a/completion/bash-completion.sh b/completion/bash-completion.sh
index 26e1134..11b99ea 100644
--- a/completion/bash-completion.sh
+++ b/completion/bash-completion.sh
@@ -8,28 +8,18 @@ _ponysay()
options='-v -h -l -f -W -q'
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
- if [ $prev = "-f" ]; then
- COMPREPLY=()
-
- sysponies=/usr/share/ponysay/ponies/
- usrponies=~/.local/share/ponysay/ponies/
- if [[ $TERM = "linux" ]]; then
- sysponies=/usr/share/ponysay/ttyponies/
- usrponies=~/.local/share/ponysay/ttyponies/
- fi
-
- [ -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" ) )
+ if [ $prev = "-f" ]; then
+ ponies=$('/usr/bin/ponysay.py' --onelist)
+ COMPREPLY=( $( compgen -W "$ponies" -- "$cur" ) )
+
+ elif [ $prev = "-q" ]; then
+ quoters=$('/usr/bin/ponysay.py' --quoters)
+ COMPREPLY=( $( compgen -W "$quoters" -- "$cur" ) )
elif [ $prev = "-W" ]; then
cols=$(( `stty size | cut -d ' ' -f 2` - 10 ))
COMPREPLY=( $cols $(( $cols / 2 )) 100 60 )
- elif [ $prev = "-q" ]; then
- qcmd=/usr/lib/ponysay/pq4ps
- quoters=$($qcmd -l)
- COMPREPLY=( $( compgen -W "$quoters" -- "$cur" ) )
-
fi
}
diff --git a/completion/fish-completion.fish b/completion/fish-completion.fish
index 89f7a19..727460b 100644
--- a/completion/fish-completion.fish
+++ b/completion/fish-completion.fish
@@ -3,43 +3,20 @@
#
# Author: Elis Axelsson <etu AT elis DOT nu>
-if test $TERM = "linux"
- set -g systempath /usr/share/ponysay/ttyponies/
- set -g homepath ~/.local/share/ponysay/ttyponies/
-else
- set -g systempath /usr/share/ponysay/ponies/
- set -g homepath ~/.local/share/ponysay/ponies/
-end
-
-if test -d $systempath
- set -g systemponies (ls --color=no $systempath | sed -e 's/\.pony//' -e 's/_.*//' | perl -pe 's/([a-z])([A-Z])/\1\\\ \2/' )
-end
-
-if test -d $homepath
- set -g homeponies (ls --color=no $homepath | sed -e 's/\.pony//' -e 's/_.*//' | perl -pe 's/([a-z])([A-Z])/\1\\\ \2/' )
-end
-
-
-set -g qcmd /usr/lib/ponysay/pq4ps
-set -g quoters ($qcmd -l)
+set -g ponies ('/usr/bin/ponysay.pl' --onelist)
+set -g quoters ('/usr/bin/ponysay.pl' --quoters)
complete -c ponysay -s h --description "Help of ponysay"
complete -c ponysay -s v --description "Version of ponysay"
complete -c ponysay -s l --description "List pony files"
complete -c ponysay -s L --description "List pony files with alternatives"
-complete -c ponysay -s f -a "$homeponies $systemponies" --description "Select a pony"
+complete -c ponysay -s f -a "$ponies" --description "Select a pony"
complete -c ponysay -s q -a "$quoters" --description "Select ponies for MLP:FiM quotes"
complete -c ponysay -s W -a "Integer" --description "The screen column where the message should be wrapped"
-set -e systempath
-set -e homepath
-
-set -e systemponies
-set -e homeponies
-
-set -e qcmd
+set -e ponies
set -e quoters