aboutsummaryrefslogtreecommitdiff
path: root/ponysay
diff options
context:
space:
mode:
authorPablo Lezaeta <prflr88@gmail.com>2012-07-20 19:22:39 -0400
committerPablo Lezaeta <prflr88@gmail.com>2012-07-20 19:22:39 -0400
commit39f97217784e6b2c1f2990e54404268c1216df0d (patch)
treeb6a65e51302731ef5dcaa5f3deb3611150bb2600 /ponysay
parent8d5e90406f0631cf32ad2184918b1a9eeb409e76 (diff)
parent80739e89dfd526f0220d33831a02c0462b3a375f (diff)
downloadponysay-39f97217784e6b2c1f2990e54404268c1216df0d.tar.gz
ponysay-39f97217784e6b2c1f2990e54404268c1216df0d.tar.bz2
ponysay-39f97217784e6b2c1f2990e54404268c1216df0d.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'ponysay')
-rwxr-xr-xponysay24
1 files changed, 19 insertions, 5 deletions
diff --git a/ponysay b/ponysay
index c856fd2..1c7ff4e 100755
--- a/ponysay
+++ b/ponysay
@@ -1,12 +1,16 @@
#!/usr/bin/env bash
-version=1.0
+version=1.1
SYSTEMPONIES="/usr/share/ponysay/ponies"
HOMEPONIES="${HOME}/.local/share/ponysay/ponies"
SCRIPTDIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Get bash script directory
pony="*"
wrap=""
+kmscmd=""
+[[ "$TERM" = "linux" ]] && kmscmd=$(for c in $(echo $PATH":" | sed -e 's/:/\/ponysay2kmsponysay /g'); do if [[ -f $c ]]; then echo $c; break; fi done)
+[[ ! "$kmscmd" = "" ]] && TERM="-linux-"
+
if [ "$TERM" = "linux" ]; then
SYSTEMPONIES="/usr/share/ponysay/ttyponies"
HOMEPONIES="${HOME}/.local/share/ponysay/ttyponies"
@@ -247,14 +251,24 @@ say() {
}
fi
+ if [[ "$kmscmd" = "" ]]; then
+ function runcmd {
+ cowcmd -f "$pony" "$@"
+ }
+ else
+ function runcmd {
+ cowcmd -f <($kmscmd "$pony") "$@"
+ }
+ fi
+
if [ "$TERM" = "linux" ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = 'yes' ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = 'y' ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = '1' ]; then
if [ "$PONYSAY_BOTTOM" = 'yes' ] || [ "$PONYSAY_BOTTOM" = 'y' ] || [ "$PONYSAY_BOTTOM" = '1' ]; then
- cowcmd -f "$pony" "${wrap:+-W$wrap}" | wtrunc | htrunctail
+ runcmd "${wrap:+-W$wrap}" | wtrunc | htrunctail
else
- cowcmd -f "$pony" "${wrap:+-W$wrap}" | wtrunc | htrunchead
+ runcmd "${wrap:+-W$wrap}" | wtrunc | htrunchead
fi
else
- cowcmd -f "$pony" "${wrap:+-W$wrap}" | wtrunc
+ runcmd "${wrap:+-W$wrap}" | wtrunc
fi
}
@@ -270,7 +284,7 @@ while getopts $opts OPT; do
case ${OPT} in
v) version; exit ;;
h) usage; exit ;;
- f) ponies+=( "$OPTARG" ) ;;
+ f) ponies+=($(echo $OPTARG | sed -e 's/ //g')) ;;
l) list; exit ;;
L) linklist; exit ;;
W) wrap="$OPTARG" ;;