mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-22 12:27:59 +01:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
0097a6134b
7 changed files with 108 additions and 88 deletions
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[submodule "ponyquotes4ponysay"]
|
||||
path = ponyquotes4ponysay
|
||||
url = git://github.com/maandree/ponyquotes4ponysay.git
|
21
Makefile
21
Makefile
|
@ -1,25 +1,24 @@
|
|||
all: ponysaytruncater manpages infomanual ponythinkcompletion
|
||||
|
||||
all: ponysaytruncater manpages infomanual ponythinkcompletion submodules
|
||||
|
||||
ponysaytruncater:
|
||||
gcc -o "ponysaytruncater" "ponysaytruncater.c"
|
||||
|
||||
|
||||
manpages:
|
||||
gzip -9 < "manuals/manpage.6" > "manuals/manpage.6.gz"
|
||||
gzip -9 < "manuals/manpage.es.6" > "manuals/manpage.es.6.gz"
|
||||
|
||||
|
||||
infomanual:
|
||||
makeinfo "manuals/ponysay.texinfo"
|
||||
gzip -9 "ponysay.info"
|
||||
|
||||
|
||||
ponythinkcompletion:
|
||||
sed -e 's/ponysay/ponythink/g' <"completion/bash-completion.sh" | sed -e 's/\/ponythink\//\/ponysay\//g' -e 's/\\\/ponythink\\\//\\\/ponysay\\\//g' >"completion/bash-completion-think.sh"
|
||||
sed -e 's/ponysay/ponythink/g' <"completion/fish-completion.fish" | sed -e 's/\/ponythink\//\/ponysay\//g' -e 's/\\\/ponythink\\\//\\\/ponysay\\\//g' >"completion/fish-completion-think.fish"
|
||||
sed -e 's/ponysay/ponythink/g' <"completion/zsh-completion.zsh" | sed -e 's/\/ponythink\//\/ponysay\//g' -e 's/\\\/ponythink\\\//\\\/ponysay\\\//g' >"completion/zsh-completion-think.zsh"
|
||||
|
||||
submodules:
|
||||
git submodule update
|
||||
(cd "ponyquotes4ponysay/"; make -B)
|
||||
|
||||
ttyponies:
|
||||
mkdir -p ttyponies
|
||||
|
@ -32,7 +31,6 @@ ttyponies:
|
|||
fi \
|
||||
done
|
||||
|
||||
|
||||
pdfmanual:
|
||||
texi2pdf "manuals/ponysay.texinfo"
|
||||
if [[ -f "ponysay.aux" ]]; then unlink "ponysay.aux"; fi
|
||||
|
@ -46,8 +44,7 @@ pdfmanual:
|
|||
if [[ -f "ponysay.tp" ]]; then unlink "ponysay.tp" ; fi
|
||||
if [[ -f "ponysay.vr" ]]; then unlink "ponysay.vr" ; fi
|
||||
|
||||
|
||||
install:
|
||||
install: all
|
||||
mkdir -p "$(DESTDIR)/usr/share/ponysay/"
|
||||
mkdir -p "$(DESTDIR)/usr/share/ponysay/ponies"
|
||||
mkdir -p "$(DESTDIR)/usr/share/ponysay/ttyponies"
|
||||
|
@ -61,6 +58,7 @@ install:
|
|||
mkdir -p "$(DESTDIR)/usr/lib/ponysay/"
|
||||
install -s "ponysaytruncater" "$(DESTDIR)/usr/lib/ponysay/truncater"
|
||||
install "ponysaylist.pl" "$(DESTDIR)/usr/lib/ponysay/list.pl"
|
||||
install "ponysaylinklist.pl" "$(DESTDIR)/usr/lib/ponysay/linklist.pl"
|
||||
|
||||
mkdir -p "$(DESTDIR)/usr/share/bash-completion/completions/"
|
||||
install "completion/bash-completion.sh" "$(DESTDIR)/usr/share/bash-completion/completions/ponysay"
|
||||
|
@ -91,6 +89,8 @@ install:
|
|||
install-info --dir-file="$(DESTDIR)/usr/share/info/dir" --entry="Miscellaneous" --description="My Little Ponies for your terminal" "$(DESTDIR)/usr/share/info/ponysay.info.gz"
|
||||
install-info --dir-file="$(DESTDIR)/usr/share/info/dir" --entry="Miscellaneous" --description="My Little Ponies for your terminal" "$(DESTDIR)/usr/share/info/ponythink.info.gz"
|
||||
|
||||
(cd "ponyquotes4ponysay/"; make DESTDIR="$(DESTDIR)" install)
|
||||
|
||||
@echo -e '\n\n'\
|
||||
'/--------------------------------------------------\\\n'\
|
||||
'| ___ |\n'\
|
||||
|
@ -109,13 +109,13 @@ install:
|
|||
'\\--------------------------------------------------/'
|
||||
@echo '' | ./ponysay -f ./`if [[ "$$TERM" = "linux" ]]; then echo ttyponies; else echo ponies; fi`/pinkiecannon.pony | tail --lines=30 ; echo -e '\n'
|
||||
|
||||
|
||||
uninstall:
|
||||
rm -fr "$(DESTDIR)/usr/share/ponysay/ponies"
|
||||
rm -fr "$(DESTDIR)/usr/share/ponysay/ttyponies"
|
||||
unlink "$(DESTDIR)/usr/bin/ponysay"
|
||||
unlink "$(DESTDIR)/usr/bin/ponythink"
|
||||
unlink "$(DESTDIR)/usr/lib/ponysay/list.pl"
|
||||
unlink "$(DESTDIR)/usr/lib/ponysay/linklist.pl"
|
||||
unlink "$(DESTDIR)/usr/lib/ponysay/truncater"
|
||||
unlink "$(DESTDIR)/usr/share/licenses/ponysay/COPYING"
|
||||
unlink "$(DESTDIR)/usr/share/bash-completion/completions/ponysay"
|
||||
|
@ -130,7 +130,7 @@ uninstall:
|
|||
unlink "$(DESTDIR)/usr/share/man/es/man6/ponythink.6.gz"
|
||||
unlink "$(DESTDIR)/usr/share/info/ponysay.info.gz"
|
||||
unlink "$(DESTDIR)/usr/share/info/ponythink.info.gz"
|
||||
|
||||
(cd "ponyquotes4ponysay/"; make DESTDIR="$(DESTDIR)" uninstall)
|
||||
|
||||
clean:
|
||||
rm -f "ponysaytruncater"
|
||||
|
@ -140,3 +140,4 @@ clean:
|
|||
rm -f "manuals/manpage.6.gz"
|
||||
rm -f "manuals/manpage.es.6.gz"
|
||||
rm -f "ponysay.info.gz"
|
||||
(cd "ponyquotes4ponysay/"; make clean)
|
||||
|
|
|
@ -36,6 +36,8 @@ The package is in the official repositories as `community/ponysay`.
|
|||
#### Gentoo Linux
|
||||
There is a package for Gentoo, to make installation and keeping it up to date easy. You can find it in [this overlay](/etu/aidstu-overlay). The package is named `games-misc/ponysay`.
|
||||
|
||||
#### Debian GNU/Linux and Ubuntu
|
||||
The DEB file can be found [here](http://roryholland.co.uk/misc.html#ponysay) and the PPA can be found [here](https://launchpad.net/~blazemore/+archive/ponysay).
|
||||
|
||||
### Pony fortune on terminal startup
|
||||
|
||||
|
|
1
ponyquotes4ponysay
Submodule
1
ponyquotes4ponysay
Submodule
|
@ -0,0 +1 @@
|
|||
Subproject commit 8147d45117b25ae584a789af5630bdf1ff62ef7a
|
95
ponysay
95
ponysay
|
@ -1,19 +1,23 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
version=1.1
|
||||
SYSTEMPONIES="/usr/share/ponysay/ponies"
|
||||
HOMEPONIES="${HOME}/.local/share/ponysay/ponies"
|
||||
SCRIPTDIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Get bash script directory
|
||||
pony="*"
|
||||
wrap=""
|
||||
|
||||
SYSTEMPONIES="$(dirname $SCRIPTDIR)/share/ponysay"
|
||||
HOMEPONIES="${HOME}/.local/share/ponysay"
|
||||
|
||||
kmscmd=""
|
||||
[[ "$TERM" = "linux" ]] && kmscmd=$(for c in $(echo $PATH":" | sed -e 's/:/\/ponysay2kmsponysay /g'); do if [[ -f $c ]]; then echo $c; break; fi done)
|
||||
[[ ! "$kmscmd" = "" ]] && TERM="-linux-"
|
||||
|
||||
if [ "$TERM" = "linux" ]; then
|
||||
SYSTEMPONIES="/usr/share/ponysay/ttyponies"
|
||||
HOMEPONIES="${HOME}/.local/share/ponysay/ttyponies"
|
||||
SYSTEMPONIES="$SYSTEMPONIES/ttyponies"
|
||||
HOMEPONIES="$HOMEPONIES/ttyponies"
|
||||
else
|
||||
SYSTEMPONIES="$SYSTEMPONIES/ponies"
|
||||
HOMEPONIES="$HOMEPONIES/ponies"
|
||||
fi
|
||||
|
||||
if [[ "$PONYSAY_COWSAY" = "" ]]; then
|
||||
|
@ -39,7 +43,11 @@ version() {
|
|||
|
||||
scrw=`(stty size <&2 || echo 0 0) | cut -d ' ' -f 2`
|
||||
listcmd="${SCRIPTDIR}/../lib/ponysay/list.pl"
|
||||
linklistcmd="${SCRIPTDIR}/../lib/ponysay/linklist.pl"
|
||||
truncatercmd="${SCRIPTDIR}/../lib/ponysay/truncater"
|
||||
[[ -f "./ponysaylist.pl" ]] && listcmd="./ponysaylist.pl"
|
||||
[[ -f "./ponysaylinklist.pl" ]] && linklistcmd="./ponysaylinklist.pl"
|
||||
[[ -f "./ponysaytruncater" ]] && truncatercmd="./ponysaytruncater"
|
||||
|
||||
haspq=1
|
||||
if [[ -f './pq4ps-list' ]]; then
|
||||
|
@ -87,75 +95,7 @@ _linklist() {
|
|||
|
||||
scrw=`(stty size <&2 || echo 0 0) | cut -d ' ' -f 2`
|
||||
|
||||
perl '/dev/stdin' $(echo $args) <<EOF | sed -e 's/ /_/g' > '/dev/shm/.ponysay~'
|
||||
#!/usr/bin/perl
|
||||
|
||||
#Author: Mattias Andrée (maandree@kth.se)
|
||||
|
||||
%hash = ();
|
||||
\$argc = @ARGV;
|
||||
|
||||
\$i = 0;
|
||||
while (\$i < \$argc)
|
||||
{
|
||||
\$source = \$ARGV[\$i];
|
||||
\$i += 1;
|
||||
\$target = \$ARGV[\$i];
|
||||
\$i += 1;
|
||||
if (\$source eq \$target)
|
||||
{
|
||||
\$hash{\$source} = [ () ];
|
||||
}
|
||||
}
|
||||
|
||||
\$i = 0;
|
||||
while (\$i < \$argc)
|
||||
{
|
||||
\$source = \$ARGV[\$i];
|
||||
\$i += 1;
|
||||
\$target = \$ARGV[\$i];
|
||||
\$i += 1;
|
||||
unless (\$source eq \$target)
|
||||
{
|
||||
push @{ \$hash{\$target} }, \$source;
|
||||
}
|
||||
}
|
||||
|
||||
\$i = 0;
|
||||
while (\$i < \$argc)
|
||||
{
|
||||
\$source = \$ARGV[\$i];
|
||||
\$i += 1;
|
||||
\$target = \$ARGV[\$i];
|
||||
\$i += 1;
|
||||
if (\$source eq \$target)
|
||||
{
|
||||
@list = @{ \$hash{\$source} };
|
||||
\$first = 1;
|
||||
print \$source;
|
||||
foreach \$link (@list)
|
||||
{
|
||||
if (\$first eq 1)
|
||||
{
|
||||
print " (".\$link;
|
||||
\$first = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
print " ".\$link;
|
||||
}
|
||||
}
|
||||
if (\$first eq 0)
|
||||
{
|
||||
print ")";
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
perl $listcmd $scrw $(cat "/dev/shm/.ponysay~") | sed -e 's/_/ /g' | qlist
|
||||
rm '/dev/shm/.ponysay~'
|
||||
perl $listcmd $scrw $(perl $linklistcmd $(echo $args) | sed -e 's/ /_/g') | sed -e 's/_/ /g' | qlist
|
||||
}
|
||||
|
||||
linklist() {
|
||||
|
@ -206,7 +146,7 @@ say() {
|
|||
# Ponies use UTF-8 drawing characters. Prevent a Perl warning.
|
||||
export PERL_UNICODE=S
|
||||
|
||||
if [ "$TERM" = "linux" ]; then
|
||||
if [ "$TERM" = "linux" ] || [ "$TERM" = "-linux-" ]; then
|
||||
echo -ne '\e[H\e[2J'
|
||||
fi
|
||||
|
||||
|
@ -237,9 +177,9 @@ say() {
|
|||
ccmd=$(for c in $(echo $PATH":" | sed -e 's/:/\/'"$cmd"' /g'); do if [[ -f $c ]]; then echo $c; break; fi done)
|
||||
|
||||
if [[ ${0} == *ponythink ]]; then
|
||||
cat <(echo -e $pcmd) $ccmd > "/dev/shm/.ponythink"
|
||||
perl '/dev/shm/.ponythink' "$@"
|
||||
rm '/dev/shm/.ponythink'
|
||||
cat <(echo -e $pcmd) $ccmd > "/tmp/ponythink"
|
||||
perl '/tmp/ponythink' "$@"
|
||||
rm '/tmp/ponythink'
|
||||
else
|
||||
perl <(cat <(echo -e $pcmd) $ccmd) "$@"
|
||||
fi
|
||||
|
@ -304,6 +244,7 @@ if [[ $usepq = 1 ]]; then
|
|||
/usr/bin/pq4ps $@
|
||||
}
|
||||
fi
|
||||
[[ "$TERM" = "-linux-" ]] && TERM="linux"
|
||||
$0 ${wrap:+-W$wrap} $(q "$*")
|
||||
exit
|
||||
fi
|
||||
|
|
72
ponysaylinklist.pl
Executable file
72
ponysaylinklist.pl
Executable file
|
@ -0,0 +1,72 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
# ponysaylist
|
||||
# Prints a list of ponies in columns
|
||||
#
|
||||
# Licensed under WTFPL
|
||||
# See COPYING for details
|
||||
|
||||
# Author: Mattias Andrée, maandree@kth.se
|
||||
|
||||
|
||||
%hash = ();
|
||||
$argc = @ARGV;
|
||||
|
||||
$i = 0;
|
||||
while ($i < $argc)
|
||||
{
|
||||
$source = $ARGV[$i];
|
||||
$i += 1;
|
||||
$target = $ARGV[$i];
|
||||
$i += 1;
|
||||
if ($source eq $target)
|
||||
{
|
||||
$hash{$source} = [ () ];
|
||||
}
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
while ($i < $argc)
|
||||
{
|
||||
$source = $ARGV[$i];
|
||||
$i += 1;
|
||||
$target = $ARGV[$i];
|
||||
$i += 1;
|
||||
unless ($source eq $target)
|
||||
{
|
||||
push @{ $hash{$target} }, $source;
|
||||
}
|
||||
}
|
||||
|
||||
$i = 0;
|
||||
while ($i < $argc)
|
||||
{
|
||||
$source = $ARGV[$i];
|
||||
$i += 1;
|
||||
$target = $ARGV[$i];
|
||||
$i += 1;
|
||||
if ($source eq $target)
|
||||
{
|
||||
@list = @{ $hash{$source} };
|
||||
$first = 1;
|
||||
print $source;
|
||||
foreach $link (@list)
|
||||
{
|
||||
if ($first eq 1)
|
||||
{
|
||||
print " (".$link;
|
||||
$first = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
print " ".$link;
|
||||
}
|
||||
}
|
||||
if ($first eq 0)
|
||||
{
|
||||
print ")";
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@ foreach $arg (@ARGV)
|
|||
{
|
||||
# Format names from ponyies names
|
||||
$arg =~ s/([a-z])([A-Z])/\1 \2/;
|
||||
$arg =~ s/_(.*)/\t(\1)/;
|
||||
#$arg =~ s/_(.*)/\t(\1)/; ## Incompatible with `ponysay -L`
|
||||
|
||||
if ($first == 1)
|
||||
{ $first = 0;
|
||||
|
|
Loading…
Reference in a new issue