Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Pablo Lezaeta 2012-07-23 16:33:06 -04:00
commit 0097a6134b
7 changed files with 108 additions and 88 deletions

3
.gitmodules vendored Normal file
View file

@ -0,0 +1,3 @@
[submodule "ponyquotes4ponysay"]
path = ponyquotes4ponysay
url = git://github.com/maandree/ponyquotes4ponysay.git

View file

@ -1,25 +1,24 @@
all: ponysaytruncater manpages infomanual ponythinkcompletion all: ponysaytruncater manpages infomanual ponythinkcompletion submodules
ponysaytruncater: ponysaytruncater:
gcc -o "ponysaytruncater" "ponysaytruncater.c" gcc -o "ponysaytruncater" "ponysaytruncater.c"
manpages: manpages:
gzip -9 < "manuals/manpage.6" > "manuals/manpage.6.gz" gzip -9 < "manuals/manpage.6" > "manuals/manpage.6.gz"
gzip -9 < "manuals/manpage.es.6" > "manuals/manpage.es.6.gz" gzip -9 < "manuals/manpage.es.6" > "manuals/manpage.es.6.gz"
infomanual: infomanual:
makeinfo "manuals/ponysay.texinfo" makeinfo "manuals/ponysay.texinfo"
gzip -9 "ponysay.info" gzip -9 "ponysay.info"
ponythinkcompletion: 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/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/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" 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: ttyponies:
mkdir -p ttyponies mkdir -p ttyponies
@ -32,7 +31,6 @@ ttyponies:
fi \ fi \
done done
pdfmanual: pdfmanual:
texi2pdf "manuals/ponysay.texinfo" texi2pdf "manuals/ponysay.texinfo"
if [[ -f "ponysay.aux" ]]; then unlink "ponysay.aux"; fi 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.tp" ]]; then unlink "ponysay.tp" ; fi
if [[ -f "ponysay.vr" ]]; then unlink "ponysay.vr" ; fi if [[ -f "ponysay.vr" ]]; then unlink "ponysay.vr" ; fi
install: all
install:
mkdir -p "$(DESTDIR)/usr/share/ponysay/" mkdir -p "$(DESTDIR)/usr/share/ponysay/"
mkdir -p "$(DESTDIR)/usr/share/ponysay/ponies" mkdir -p "$(DESTDIR)/usr/share/ponysay/ponies"
mkdir -p "$(DESTDIR)/usr/share/ponysay/ttyponies" mkdir -p "$(DESTDIR)/usr/share/ponysay/ttyponies"
@ -61,6 +58,7 @@ install:
mkdir -p "$(DESTDIR)/usr/lib/ponysay/" mkdir -p "$(DESTDIR)/usr/lib/ponysay/"
install -s "ponysaytruncater" "$(DESTDIR)/usr/lib/ponysay/truncater" install -s "ponysaytruncater" "$(DESTDIR)/usr/lib/ponysay/truncater"
install "ponysaylist.pl" "$(DESTDIR)/usr/lib/ponysay/list.pl" 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/" mkdir -p "$(DESTDIR)/usr/share/bash-completion/completions/"
install "completion/bash-completion.sh" "$(DESTDIR)/usr/share/bash-completion/completions/ponysay" 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/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" 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'\ @echo -e '\n\n'\
'/--------------------------------------------------\\\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' @echo '' | ./ponysay -f ./`if [[ "$$TERM" = "linux" ]]; then echo ttyponies; else echo ponies; fi`/pinkiecannon.pony | tail --lines=30 ; echo -e '\n'
uninstall: uninstall:
rm -fr "$(DESTDIR)/usr/share/ponysay/ponies" rm -fr "$(DESTDIR)/usr/share/ponysay/ponies"
rm -fr "$(DESTDIR)/usr/share/ponysay/ttyponies" rm -fr "$(DESTDIR)/usr/share/ponysay/ttyponies"
unlink "$(DESTDIR)/usr/bin/ponysay" unlink "$(DESTDIR)/usr/bin/ponysay"
unlink "$(DESTDIR)/usr/bin/ponythink" unlink "$(DESTDIR)/usr/bin/ponythink"
unlink "$(DESTDIR)/usr/lib/ponysay/list.pl" unlink "$(DESTDIR)/usr/lib/ponysay/list.pl"
unlink "$(DESTDIR)/usr/lib/ponysay/linklist.pl"
unlink "$(DESTDIR)/usr/lib/ponysay/truncater" unlink "$(DESTDIR)/usr/lib/ponysay/truncater"
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"
@ -130,7 +130,7 @@ uninstall:
unlink "$(DESTDIR)/usr/share/man/es/man6/ponythink.6.gz" unlink "$(DESTDIR)/usr/share/man/es/man6/ponythink.6.gz"
unlink "$(DESTDIR)/usr/share/info/ponysay.info.gz" unlink "$(DESTDIR)/usr/share/info/ponysay.info.gz"
unlink "$(DESTDIR)/usr/share/info/ponythink.info.gz" unlink "$(DESTDIR)/usr/share/info/ponythink.info.gz"
(cd "ponyquotes4ponysay/"; make DESTDIR="$(DESTDIR)" uninstall)
clean: clean:
rm -f "ponysaytruncater" rm -f "ponysaytruncater"
@ -140,3 +140,4 @@ clean:
rm -f "manuals/manpage.6.gz" rm -f "manuals/manpage.6.gz"
rm -f "manuals/manpage.es.6.gz" rm -f "manuals/manpage.es.6.gz"
rm -f "ponysay.info.gz" rm -f "ponysay.info.gz"
(cd "ponyquotes4ponysay/"; make clean)

View file

@ -36,6 +36,8 @@ The package is in the official repositories as `community/ponysay`.
#### Gentoo Linux #### 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`. 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 ### Pony fortune on terminal startup

1
ponyquotes4ponysay Submodule

@ -0,0 +1 @@
Subproject commit 8147d45117b25ae584a789af5630bdf1ff62ef7a

95
ponysay
View file

@ -1,19 +1,23 @@
#!/usr/bin/env bash #!/usr/bin/env bash
version=1.1 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 SCRIPTDIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Get bash script directory
pony="*" pony="*"
wrap="" wrap=""
SYSTEMPONIES="$(dirname $SCRIPTDIR)/share/ponysay"
HOMEPONIES="${HOME}/.local/share/ponysay"
kmscmd="" kmscmd=""
[[ "$TERM" = "linux" ]] && kmscmd=$(for c in $(echo $PATH":" | sed -e 's/:/\/ponysay2kmsponysay /g'); do if [[ -f $c ]]; then echo $c; break; fi done) [[ "$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-" [[ ! "$kmscmd" = "" ]] && TERM="-linux-"
if [ "$TERM" = "linux" ]; then if [ "$TERM" = "linux" ]; then
SYSTEMPONIES="/usr/share/ponysay/ttyponies" SYSTEMPONIES="$SYSTEMPONIES/ttyponies"
HOMEPONIES="${HOME}/.local/share/ponysay/ttyponies" HOMEPONIES="$HOMEPONIES/ttyponies"
else
SYSTEMPONIES="$SYSTEMPONIES/ponies"
HOMEPONIES="$HOMEPONIES/ponies"
fi fi
if [[ "$PONYSAY_COWSAY" = "" ]]; then if [[ "$PONYSAY_COWSAY" = "" ]]; then
@ -39,7 +43,11 @@ version() {
scrw=`(stty size <&2 || echo 0 0) | cut -d ' ' -f 2` scrw=`(stty size <&2 || echo 0 0) | cut -d ' ' -f 2`
listcmd="${SCRIPTDIR}/../lib/ponysay/list.pl" listcmd="${SCRIPTDIR}/../lib/ponysay/list.pl"
linklistcmd="${SCRIPTDIR}/../lib/ponysay/linklist.pl"
truncatercmd="${SCRIPTDIR}/../lib/ponysay/truncater" truncatercmd="${SCRIPTDIR}/../lib/ponysay/truncater"
[[ -f "./ponysaylist.pl" ]] && listcmd="./ponysaylist.pl"
[[ -f "./ponysaylinklist.pl" ]] && linklistcmd="./ponysaylinklist.pl"
[[ -f "./ponysaytruncater" ]] && truncatercmd="./ponysaytruncater"
haspq=1 haspq=1
if [[ -f './pq4ps-list' ]]; then if [[ -f './pq4ps-list' ]]; then
@ -87,75 +95,7 @@ _linklist() {
scrw=`(stty size <&2 || echo 0 0) | cut -d ' ' -f 2` scrw=`(stty size <&2 || echo 0 0) | cut -d ' ' -f 2`
perl '/dev/stdin' $(echo $args) <<EOF | sed -e 's/ /_/g' > '/dev/shm/.ponysay~' perl $listcmd $scrw $(perl $linklistcmd $(echo $args) | sed -e 's/ /_/g') | sed -e 's/_/ /g' | qlist
#!/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~'
} }
linklist() { linklist() {
@ -206,7 +146,7 @@ say() {
# Ponies use UTF-8 drawing characters. Prevent a Perl warning. # Ponies use UTF-8 drawing characters. Prevent a Perl warning.
export PERL_UNICODE=S export PERL_UNICODE=S
if [ "$TERM" = "linux" ]; then if [ "$TERM" = "linux" ] || [ "$TERM" = "-linux-" ]; then
echo -ne '\e[H\e[2J' echo -ne '\e[H\e[2J'
fi 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) 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 if [[ ${0} == *ponythink ]]; then
cat <(echo -e $pcmd) $ccmd > "/dev/shm/.ponythink" cat <(echo -e $pcmd) $ccmd > "/tmp/ponythink"
perl '/dev/shm/.ponythink' "$@" perl '/tmp/ponythink' "$@"
rm '/dev/shm/.ponythink' rm '/tmp/ponythink'
else else
perl <(cat <(echo -e $pcmd) $ccmd) "$@" perl <(cat <(echo -e $pcmd) $ccmd) "$@"
fi fi
@ -304,6 +244,7 @@ if [[ $usepq = 1 ]]; then
/usr/bin/pq4ps $@ /usr/bin/pq4ps $@
} }
fi fi
[[ "$TERM" = "-linux-" ]] && TERM="linux"
$0 ${wrap:+-W$wrap} $(q "$*") $0 ${wrap:+-W$wrap} $(q "$*")
exit exit
fi fi

72
ponysaylinklist.pl Executable file
View 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";
}
}

View file

@ -17,7 +17,7 @@ foreach $arg (@ARGV)
{ {
# Format names from ponyies names # Format names from ponyies names
$arg =~ s/([a-z])([A-Z])/\1 \2/; $arg =~ s/([a-z])([A-Z])/\1 \2/;
$arg =~ s/_(.*)/\t(\1)/; #$arg =~ s/_(.*)/\t(\1)/; ## Incompatible with `ponysay -L`
if ($first == 1) if ($first == 1)
{ $first = 0; { $first = 0;