mirror of
https://github.com/erkin/ponysay
synced 2024-11-16 00:17:59 +00:00
25 lines
621 B
Bash
Executable file
25 lines
621 B
Bash
Executable file
#!/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
|