blob: 891ec7f15ea61be4e62ffd9d06ecc8c869e91c60 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#!/usr/bin/env bash
INSTALLDIR="$(dirname $( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))"
LIBDIR="$INSTALLDIR/lib/ponysay"
truncatercmd="$LIBDIR/truncater"
scrw=`(stty size <&2 || echo 0 0) | cut -d ' ' -f 2` # Screen width
function wtrunc {
if [ "$PONYSAY_FULL_WIDTH" = 'yes' ] || [ "$PONYSAY_FULL_WIDTH" = 'y' ] || [ "$PONYSAY_FULL_WIDTH" = '1' ]; then
cat
else
if [[ -f $truncatercmd ]]; then
$truncatercmd $scrw
else
cat
fi
fi
}
# Ponies use UTF-8 drawing characters. Prevent a Perl warning.
export PERL_UNICODE=S
"$0.py" "$@" | wtrunc
|