diff options
author | Pablo Lezaeta <prflr88@gmail.com> | 2012-07-10 21:40:23 -0400 |
---|---|---|
committer | Pablo Lezaeta <prflr88@gmail.com> | 2012-07-10 21:40:23 -0400 |
commit | 2a33305ae036767d6a04f31da49aa7be0cf1297b (patch) | |
tree | 9fdfd12face474ca3ca296e62fa7f63a5952c247 /ponysay | |
parent | 30edda8b9a5019a55b8ee894895d4d396758e2f1 (diff) | |
parent | 615f84ca5c6804a1d599433601480874c3877fd7 (diff) | |
download | ponysay-2a33305ae036767d6a04f31da49aa7be0cf1297b.tar.gz ponysay-2a33305ae036767d6a04f31da49aa7be0cf1297b.tar.bz2 ponysay-2a33305ae036767d6a04f31da49aa7be0cf1297b.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'ponysay')
-rwxr-xr-x | ponysay | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -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 |