aboutsummaryrefslogtreecommitdiff
path: root/ponysay
diff options
context:
space:
mode:
authorPablo Lezaeta <prflr88@gmail.com>2012-07-10 21:40:23 -0400
committerPablo Lezaeta <prflr88@gmail.com>2012-07-10 21:40:23 -0400
commit2a33305ae036767d6a04f31da49aa7be0cf1297b (patch)
tree9fdfd12face474ca3ca296e62fa7f63a5952c247 /ponysay
parent30edda8b9a5019a55b8ee894895d4d396758e2f1 (diff)
parent615f84ca5c6804a1d599433601480874c3877fd7 (diff)
downloadponysay-2a33305ae036767d6a04f31da49aa7be0cf1297b.tar.gz
ponysay-2a33305ae036767d6a04f31da49aa7be0cf1297b.tar.bz2
ponysay-2a33305ae036767d6a04f31da49aa7be0cf1297b.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'ponysay')
-rwxr-xr-xponysay20
1 files changed, 14 insertions, 6 deletions
diff --git a/ponysay b/ponysay
index 2f60ab3..e50b0b1 100755
--- a/ponysay
+++ b/ponysay
@@ -63,18 +63,26 @@ say() {
function wtrunc
{
- ponysaytruncater `tput cols || echo 0` 2>/dev/null ||
- ${HOME}/.local/bin/ponysaytruncater `tput cols || echo 0` 2>/dev/null ||
- ./ponysaytruncater `tput cols || echo 0` 2>/dev/null ||
- cat
+ if [ "$PONYSAY_FULL_WIDTH" = 'no' ] || [ "$PONYSAY_FULL_WIDTH" = 'n' ] || [ "$PONYSAY_FULL_WIDTH" = '0' ]; then
+ cat
+ else
+ WIDTH=$((stty size <&2 || echo 0 0) | cut -d ' ' -f 2)
+ ponysaytruncater $WIDTH 2>/dev/null ||
+ ${HOME}/.local/bin/ponysaytruncater $WIDTH 2>/dev/null ||
+ ./ponysaytruncater $WIDTH 2>/dev/null ||
+ cat
+ fi
}
function htrunc
{
- head --lines=$(( $(stty size <&2 | cut -d ' ' -f 1) - 2 ))
+ if [ "$PONYSAY_SHELL_LINES" = "" ]; then
+ PONYSAY_SHELL_LINES=2
+ fi
+ head --lines=$(( $(stty size <&2 | cut -d ' ' -f 1) - $PONYSAY_SHELL_LINES ))
}
- if [ "$TERM" = "linux" ]; then
+ 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
exec "$cmd" -f "$pony" "${wrap:+-W$wrap}" | wtrunc | tac | htrunc | tac
else