mirror of
https://github.com/erkin/ponysay.git
synced 2025-02-19 19:04:23 +01:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
2a33305ae0
3 changed files with 39 additions and 9 deletions
2
Makefile
2
Makefile
|
@ -26,6 +26,7 @@ install: all
|
||||||
|
|
||||||
mkdir -p "$(DESTDIR)/usr/share/man/man1"
|
mkdir -p "$(DESTDIR)/usr/share/man/man1"
|
||||||
install "manpage.1" "$(DESTDIR)/usr/share/man/man1/ponysay.1"
|
install "manpage.1" "$(DESTDIR)/usr/share/man/man1/ponysay.1"
|
||||||
|
ln -sf "ponysay.1" "$(DESTDIR)/usr/share/man/man1/ponythink.1"
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -fr "$(DESTDIR)/usr/share/ponysay/ponies"
|
rm -fr "$(DESTDIR)/usr/share/ponysay/ponies"
|
||||||
|
@ -37,6 +38,7 @@ uninstall:
|
||||||
unlink "$(DESTDIR)/usr/share/licenses/ponysay/COPYING"
|
unlink "$(DESTDIR)/usr/share/licenses/ponysay/COPYING"
|
||||||
unlink "$(DESTDIR)/usr/share/bash-completion/completions/ponysay"
|
unlink "$(DESTDIR)/usr/share/bash-completion/completions/ponysay"
|
||||||
unlink "$(DESTDIR)/usr/share/man/man1/ponysay.1"
|
unlink "$(DESTDIR)/usr/share/man/man1/ponysay.1"
|
||||||
|
unlink "$(DESTDIR)/usr/share/man/man1/ponythink.1"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -r "ponysaytruncater"
|
rm -r "ponysaytruncater"
|
||||||
|
|
26
manpage.1
26
manpage.1
|
@ -22,6 +22,10 @@ ponysay \- A cowsay wrapper with ponies
|
||||||
.RI [ options ]
|
.RI [ options ]
|
||||||
.RI [ message ]
|
.RI [ message ]
|
||||||
.br
|
.br
|
||||||
|
.B ponythink
|
||||||
|
.RI [ options ]
|
||||||
|
.RI [ message ]
|
||||||
|
.br
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
|
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
|
||||||
|
@ -33,6 +37,8 @@ word-wraps the message given at about 40 columns, and prints the pony saying the
|
||||||
.PP
|
.PP
|
||||||
If no arguments are provided, the program only accepts standard input piped from another program, a file or
|
If no arguments are provided, the program only accepts standard input piped from another program, a file or
|
||||||
either here documents or here strings (see man bash(1) for details on here document/string.)
|
either here documents or here strings (see man bash(1) for details on here document/string.)
|
||||||
|
.PP
|
||||||
|
\fBponythink\fP is to \fIponysay\fP as \fIcowthink\fP is to \fIcowsay\fP.
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
A summary of options is included below.
|
A summary of options is included below.
|
||||||
.TP
|
.TP
|
||||||
|
@ -54,8 +60,22 @@ The screen column where the message should be wrapped
|
||||||
.TP
|
.TP
|
||||||
.B PONYSAY_BOTTOM
|
.B PONYSAY_BOTTOM
|
||||||
Under TTY (Linux VT), if the output is larger the the screen's height, only the beginning is
|
Under TTY (Linux VT), if the output is larger the the screen's height, only the beginning is
|
||||||
printed, leaving 2 blank lines. If you want the buttom to be printed rather the the beginning
|
printed, leaving two blank lines. If you want the buttom to be printed rather the the beginning
|
||||||
you can export \fBPONYSAY_BOTTOM\fP with the value \fIyes\fP, \fIy\fP or \fI1\fP.
|
you can export \fIPONYSAY_BOTTOM\fP with the value \fIyes\fP, \fIy\fP or \fI1\fP.
|
||||||
|
.TP
|
||||||
|
.B PONYSAY_SHELL_LINES
|
||||||
|
Under TTY (Linux VT), if the output is larger the the screen's height, two lines are left blank.
|
||||||
|
If you want more, or less, blank lines you can export \fIPONYSAY_SHELL_LINES\fP with the value
|
||||||
|
of how many blank lines you want. Naturally this takes effect if the output is not actually larger
|
||||||
|
than the screen.
|
||||||
|
.TP
|
||||||
|
.B PONYSAY_FULL_WIDTH
|
||||||
|
You can export \fIPONYSAY_FULL_WIDTH\fP with the value \fIno\fP, \fIn\fP or \fI0\fP, if you
|
||||||
|
do not want the output to be truncated on the width to fit the terminal.
|
||||||
|
.TP
|
||||||
|
.B PONYSAY_TRUNCATE_HEIGHT
|
||||||
|
Export \fIPONYSAY_TRUNCATE_HEIGHT\fP with the value \fIyes\fP, \fIy\fP or \fI1\fP, if you
|
||||||
|
want to truncate the output on the height even if you are not running \fIponysay\fP under TTY.
|
||||||
.SH BUG
|
.SH BUG
|
||||||
Bugs can be reported in <\fBhttps://github.com/erkin/ponysay/issues\fP>.
|
Bugs can be reported in <\fBhttps://github.com/erkin/ponysay/issues\fP>.
|
||||||
.SH SEE ALSO
|
.SH SEE ALSO
|
||||||
|
@ -86,4 +106,4 @@ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||||
.br
|
.br
|
||||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
.PP
|
.PP
|
||||||
0. You just DO WHAT THE FUCK YOU WANT TO.
|
0. You just DO WHAT THE FUCK YOU WANT TO.
|
||||||
|
|
20
ponysay
20
ponysay
|
@ -63,18 +63,26 @@ say() {
|
||||||
|
|
||||||
function wtrunc
|
function wtrunc
|
||||||
{
|
{
|
||||||
ponysaytruncater `tput cols || echo 0` 2>/dev/null ||
|
if [ "$PONYSAY_FULL_WIDTH" = 'no' ] || [ "$PONYSAY_FULL_WIDTH" = 'n' ] || [ "$PONYSAY_FULL_WIDTH" = '0' ]; then
|
||||||
${HOME}/.local/bin/ponysaytruncater `tput cols || echo 0` 2>/dev/null ||
|
cat
|
||||||
./ponysaytruncater `tput cols || echo 0` 2>/dev/null ||
|
else
|
||||||
cat
|
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
|
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
|
if [ "$PONYSAY_BOTTOM" = 'yes' ] || [ "$PONYSAY_BOTTOM" = 'y' ] || [ "$PONYSAY_BOTTOM" = '1' ]; then
|
||||||
exec "$cmd" -f "$pony" "${wrap:+-W$wrap}" | wtrunc | tac | htrunc | tac
|
exec "$cmd" -f "$pony" "${wrap:+-W$wrap}" | wtrunc | tac | htrunc | tac
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue