mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-25 13:57:59 +01:00
Ponies are truncated on height under TTY, leaving 2 lines for shell interaction. export PONYSAY_BOTTOM=1 to show bottom instread of top.
This commit is contained in:
parent
293f4d7403
commit
63e848a93f
1 changed files with 22 additions and 4 deletions
22
ponysay
22
ponysay
|
@ -59,10 +59,28 @@ say() {
|
||||||
echo -ne '\ec'
|
echo -ne '\ec'
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec "$cmd" -f "$pony" "${wrap:+-W$wrap}" | (ponysaytruncater `tput cols || echo 0` 2>/dev/null ||
|
function wtrunc
|
||||||
|
{
|
||||||
|
ponysaytruncater `tput cols || echo 0` 2>/dev/null ||
|
||||||
${HOME}/.local/bin/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 ||
|
./ponysaytruncater `tput cols || echo 0` 2>/dev/null ||
|
||||||
cat)
|
cat
|
||||||
|
}
|
||||||
|
|
||||||
|
function htrunc
|
||||||
|
{
|
||||||
|
head --lines=$(( $(stty size <&2 | cut -d ' ' -f 1) - 2 ))
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$TERM" = "linux" ]; then
|
||||||
|
if [ "$PONYSAY_BOTTOM" = 'yes' ] || [ "$PONYSAY_BOTTOM" = 'y' ] || [ "$PONYSAY_BOTTOM" = '1' ]; then
|
||||||
|
exec "$cmd" -f "$pony" "${wrap:+-W$wrap}" | wtrunc | tac | htrunc | tac
|
||||||
|
else
|
||||||
|
exec "$cmd" -f "$pony" "${wrap:+-W$wrap}" | wtrunc | htrunc
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
exec "$cmd" -f "$pony" "${wrap:+-W$wrap}" | wtrunc
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
while getopts f:W:lhv OPT
|
while getopts f:W:lhv OPT
|
||||||
|
|
Loading…
Reference in a new issue