From e20ae102e582c8e8b7f2f73d44c2fbc42072faee Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 19 Jul 2012 03:02:42 +0200 Subject: support for github.com/maandree/ponyquotes4ponysay --- ponysay | 51 +++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 4 deletions(-) (limited to 'ponysay') diff --git a/ponysay b/ponysay index 23c1313..8c85356 100755 --- a/ponysay +++ b/ponysay @@ -21,13 +21,29 @@ version() { scrw=`(stty size <&2 || echo 0 0) | cut -d ' ' -f 2` listcmd="$0list.pl" +haspq=1 +if [[ -f './pq4ps-list' ]]; then + function qlist + { ./pq4ps-list + } +elif [[ -f '/usr/bin/pq4ps-list' ]]; then + function qlist + { /usr/bin/pq4ps-list + } +else + haspq=0 + function qlist + { cat + } +fi + list() { echo -e "\\e[01mponyfiles located in $SYSTEMPONIES:\\e[21m" - perl $listcmd $scrw $(ls --color=no $SYSTEMPONIES | sed -e 's/\.pony$//' | sort) + perl $listcmd $scrw $(ls --color=no $SYSTEMPONIES | sed -e 's/\.pony$//' | sort) | qlist if [[ -d $HOMEPONIES ]]; then echo -e "\\e[01mponyfiles located in $HOMEPONIES:\\e[21m" - perl $listcmd $scrw $(ls --color=no $HOMEPONIES | sed -e 's/\.pony$//' | sort) + perl $listcmd $scrw $(ls --color=no $HOMEPONIES | sed -e 's/\.pony$//' | sort) | qlist fi } @@ -116,7 +132,7 @@ while (\$i < \$argc) } EOF - perl $listcmd $scrw $(cat /dev/shm/ponysay~) | sed -e 's/_/ /g' + perl $listcmd $scrw $(cat /dev/shm/ponysay~) | sed -e 's/_/ /g' | qlist } linklist() { @@ -140,6 +156,13 @@ Options: -h Show this help and exit. -l List pony files. -L List pony files with synonyms inside brackets. +EOF +if [[ $haspq = 1 ]]; then + cat <&2; exit 1 ;; esac done shift $((OPTIND - 1)) +if [[ $usepq = 1 ]]; then + if [[ -f './pq4ps' ]]; then + function q + { ./pq4ps $@ + } + elif [[ -f '/usr/bin/pq4ps' ]]; then + function q + { /usr/bin/pq4ps $@ + } + fi + $0 ${wrap:+-W$wrap} $(q "$*") + exit +fi + hash $cmd &>/dev/null; if [ $? -ne 0 ]; then cat >&2 <