aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2012-07-21 18:16:18 +0200
committerMattias Andrée <maandree@operamail.com>2012-07-21 18:16:18 +0200
commit61eb843ded3184b2a09a1f68b9643da6e660b6b0 (patch)
tree0846c114caed9f52779aea1cb3bf956848af0e2f
parentc0a9749730da46165aec40eb7217158c4cb89a74 (diff)
downloadponysay-61eb843ded3184b2a09a1f68b9643da6e660b6b0.tar.gz
ponysay-61eb843ded3184b2a09a1f68b9643da6e660b6b0.tar.bz2
ponysay-61eb843ded3184b2a09a1f68b9643da6e660b6b0.zip
support for kmsponies4ponysay
-rwxr-xr-xponysay20
1 files changed, 17 insertions, 3 deletions
diff --git a/ponysay b/ponysay
index ae71fc5..1c7ff4e 100755
--- a/ponysay
+++ b/ponysay
@@ -7,6 +7,10 @@ SCRIPTDIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Get bash scri
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
}