aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG7
-rw-r--r--COPYING12
-rw-r--r--CREDITS1
-rw-r--r--completion/bash-completion.sh2
-rwxr-xr-xconfigure361
-rw-r--r--manuals/manpage.0 (renamed from manuals/manpage.6)6
-rw-r--r--manuals/manpage.es.0 (renamed from manuals/manpage.es.6)6
-rw-r--r--manuals/ponysay.texinfo647
-rw-r--r--manuals/ponysay_front.xcfbin998210 -> 998576 bytes
-rw-r--r--ponyquotes/ponies1
-rwxr-xr-xponysay98
-rw-r--r--ponysay.pdfbin361698 -> 389453 bytes
-rwxr-xr-xsetup.py875
13 files changed, 1381 insertions, 635 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 097d60f..f7026cd 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,10 @@
+Version 2.4
+
+ Nothing worth mentioning.
+
+ Note: Identifies itself as version 2.3
+
+
Version 2.3
Support for 'best.pony' file.
diff --git a/COPYING b/COPYING
index c749fa1..474f9ef 100644
--- a/COPYING
+++ b/COPYING
@@ -1,7 +1,14 @@
+Ponysay — Cowsay reimplemention for ponies
+
+Copyright (C) 2012 Erkin Batu Altunbaş et al.
+
+
+
+
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
- Copyright (C) 2012 Erkin Batu Altunbaş
+ Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
@@ -10,4 +17,5 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
- 0. You just DO WHAT THE FUCK YOU WANT TO. \ No newline at end of file
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
+
diff --git a/CREDITS b/CREDITS
index da054eb..a76e27d 100644
--- a/CREDITS
+++ b/CREDITS
@@ -13,4 +13,5 @@ Duane Bekaert
Kyah Rindlisbacher
James Ross-Gowan
Louis Taylor
+Daniel Wallace
Jannis
diff --git a/completion/bash-completion.sh b/completion/bash-completion.sh
index 62e1d40..4f59a4a 100644
--- a/completion/bash-completion.sh
+++ b/completion/bash-completion.sh
@@ -20,7 +20,7 @@ _ponysay()
quoters=$('/usr/bin/ponysay' --quoters)
COMPREPLY=( $( compgen -W "$quoters" -- "$cur" ) )
- elif [ $prev = "-b" ] || [ $prev = "--balloon" ]; then
+ elif [ $prev = "-b" ] || [ $prev = "--balloon" ] || [ $prev = "--bubble" ]; then
balloons=$('/usr/bin/ponysay' --balloonlist)
COMPREPLY=( $( compgen -W "$balloons" -- "$cur" ) )
diff --git a/configure b/configure
index d06e6ce..248f95f 100755
--- a/configure
+++ b/configure
@@ -1,364 +1,28 @@
-#!/usr/bin/env bash
-
-
-PREFIX='/usr'
-INFODESC=\''My Little Ponies for your terminal'\'
-SHELL='bash'
-
-completions='completion/bash-completion.sh completion/fish-completion.fish completion/zsh-completion.zsh'
-shareDirs='ponies ttyponies quotes balloons extraponies extrattyponies'
-manFiles='manuals/manpage.6 manuals/manpage.es.6'
-licenseFiles='COPYING'
-
-
-
-oldInstalledFiles='bin/ponysaytruncater lib/ponysay/truncater lib/ponysay/list.pl lib/ponysay/linklist.pl lib/ponysay/pq4ps lib/ponysay/pq4ps.pl lib/ponysay/pq4ps-list lib/ponysay/pq4ps-list.pl bin/ponysay.py bin/ponythink.py'
-oldInstalledDirs='lib/ponysay share/ponies share/ttyponies bin/ponysaylist.pl'
-oldCompiledFiles='truncater ponysaytruncater ponysay.py.install'
-oldCompiledDirs=''
-
-installedFiles='bin/ponysay bin/ponythink doc/ponysay.pdf share/info/ponysay.info.gz share/info/ponythink.info.gz share/ponysay/ucsmap'
-installedDirs='share/ponysay lib/ponysay'
-compiledFiles='ponysay.info ponysay.info.gz ponysay.install ponysay.install~'
-compiledDirs='quotes'
-
-for man in $manFiles; do
- compiledFiles="$compiledFiles $man.gz"
-done
-for completion in $completions; do
- thinkfile="${completion%%.*}-think.${completion##*.}"
- compiledFiles="$compiledFiles $completion.install $thinkfile"
-done
-for file in $licenseFiles; do
- installedFiles="$installedFiles share/licenses/ponysay/$file"
-done
-
-
-
-function getcompdir()
-{
- if [ "$1" == 'bash' ]; then echo -n 'bash-completion/completions'
- elif [ "$1" == 'fish' ]; then echo -n 'fish/completions'
- elif [ "$1" == 'zsh' ]; then echo -n 'zsh/site-functions'
- fi
-}
-
-function getcompfile()
-{
- if [ "$1" == 'bash' ]; then echo -n "$2"
- elif [ "$1" == 'fish' ]; then echo -n "$2"'.fish'
- elif [ "$1" == 'zsh' ]; then echo -n '_'"$2"
- fi
-}
-
-
-
-installCache=' install-cache'
-installPdf=''
-installInfo=' install-info'
-installInfoInstall=' install-info-install'
-installMan=' install-man'
-installManEs=''
-installBash=' install-bash'
-installFish=' install-fish'
-installZsh=' install-zsh'
-
-for arg in "$@"; do
- opt="${arg%%=*}"
- val="${arg##*=}"
-
- if [ "$opt" = '--prefix' ]; then
- PREFIX="$val"
- elif [ "$opt" = '--info-desc' ]; then
- INFODESC=\'"$(sed -e s/\'/\''\\'\'\'/g <<<"$val")"\'
- elif [ "$opt" = '--shell' ]; then
- SHELL="$val"
-
- elif [ "$opt" = '--without-shared-cache' ]; then installCache=''
- elif [ "$opt" = '--with-pdf' ]; then installPdf=' install-pdf'
- elif [ "$opt" = '--without-info' ]; then installInfo=''
- elif [ "$opt" = '--without-info-install' ]; then installInfoInstall=''
- elif [ "$opt" = '--without-man' ]; then installMan=''
- elif [ "$opt" = '--with-man-es' ]; then installManEs=' install-man-es'
- elif [ "$opt" = '--without-bash' ]; then installBash=''
- elif [ "$opt" = '--without-fish' ]; then installFish=''
- elif [ "$opt" = '--without-zsh' ]; then installZsh=''
-
- elif [ "$opt" = "--everything" ]; then
- installCache=' install-cache'
- installPdf=' install-pdf'
- installInfo=' install-info'
- installInfoInstall=' install-info-install'
- installMan=' install-man'
- installManEs=' install-man-es'
- installBash=' install-bash'
- installFish=' install-fish'
- installZsh=' install-zsh'
-
- else
- echo "$0: error: option not recongised: $arg" >&2
- fi
-done
-
-if [ "$installInfo" = '' ]; then
- installInfoInstall=''
-fi
-
-compileMethods='core quotes manpages ponysaycompletion ponythinkcompletion'
-installMethods='install-min'"$installCache$installPdf$installInfo$installInfoInstall$installMan$installManEs$installBash$installFish$installZsh"
-if [ ! "$installInfo" = '' ]; then
- compileMethods="$compileMethods infomanual"
-fi
-
-
-
-function correctPrefix()
-{
- for file in "$@"; do
- echo -en '\t'
- echo 'sed -e '\''s/'\''\'\'''\''\/usr/'\''\'\''"$(SED_PREFIX)"'\''/g'\'' < "'"$file"'" > "'"$file"'.install"'
- done
-}
-
-function gzCompress()
-{
- for file in "$@"; do
- echo -en '\t'
- echo 'gzip -9 -f < "'"$file"'" > "'"$file"'".gz'
- done
-}
-
-function thinkCompletion()
-{
- for file in "$@"; do
- echo -en '\tsed'
- echo -n ' -e '\''s/ponysay/ponythink/g'\'
- echo -n ' < "'"$file"'.install" | sed'
- echo -n ' -e '\''s/\/ponythink\//\/ponysay\//g'\'
- echo -n ' -e '\''s/\\\/ponythink\\\//\\\/ponysay\\\//g'\'
- thinkfile="${file%%.*}-think.${file##*.}"
- echo ' > "'"$thinkfile"'"'
- done
-}
-
-
-
-echo "PREFIX = $PREFIX, edit with option --prefix=PREFIX"
-echo "INFODESC = $INFODESC, edit with option --info-desc=INFODESC"
-echo "SHELL = $SHELL, edit with option --shell=PREFIX"
-echo
-[ ! "$installCache" = '' ] && echo "Installing shared cache, add option --without-shared-cache to skip"
-[ ! "$installPdf" = '' ] && echo "Installing PDF manual"
-[ ! "$installInfo" = '' ] && echo "Installing info manual, add option --without-info to skip"
-[ ! "$installInfoInstall" = '' ] && echo "Installing info manual with info-install, add option --without-info to skip"
-[ ! "$installMan" = '' ] && echo "Installing English manpage manual, add option --without-man to skip"
-[ ! "$installManEs" = '' ] && echo "Installing Spanish manpage manual"
-[ ! "$installBash" = '' ] && echo "Installing autocompletion for GNU Bash, add option --without-bash to skip"
-[ ! "$installFish" = '' ] && echo "Installing autocompletion for fish, add option --without-fish to skip"
-[ ! "$installZsh" = '' ] && echo "Installing autocompletion for zsh, add option --without-zsh to skip"
-echo
-[ ! "$installCache" = '' ] || echo "Skipping shared cache"
-[ ! "$installPdf" = '' ] || echo "Skipping PDF manual, add option --with-pdf to install"
-[ ! "$installInfo" = '' ] || echo "Skipping info manual"
-[ ! "$installInfoInstall" = '' ] || echo "Skipping info manual installation with info-install"
-[ ! "$installMan" = '' ] || echo "Skipping English manpage manual"
-[ ! "$installManEs" = '' ] || echo "Skipping Spanish manpage manual, add option --with-man-es to install"
-[ ! "$installBash" = '' ] || echo "Skipping autocompletion for GNU Bash"
-[ ! "$installFish" = '' ] || echo "Skipping autocompletion for fish"
-[ ! "$installZsh" = '' ] || echo "Skipping autocompletion for zsh"
-echo
-
+#!/bin/sh
function makeMakefile()
{
- echo 'SHELL='\'"$SHELL"\'
- echo 'PREFIX='\'"$PREFIX"\'
- echo 'INSTALLDIR="$(DESTDIR)$(PREFIX)"'
- echo 'SED_PREFIX=$$(sed -e '\''s/\//\\\//g'\'' <<<$(PREFIX))'
- echo
- echo 'default: '"$compileMethods"
- echo
- echo 'all: core quotes manpages infomanual ponysaycompletion ponythinkcompletion'
- echo
-
- echo "core:"
- correctPrefix 'ponysay'
- echo -en '\t' ; echo 'if (( `env python --version 2>&1 | cut -d " " -f 2 | cut -d "." -f 1` < 3 )); then \'
- echo -en '\t' ; echo ' mv "ponysay.install" "ponysay.install~" ;\'
- echo -en '\t' ; echo ' sed -e '\''s/bin\/env python/bin\/env python3/'\'' < "ponysay.install~" > "ponysay.install" ;\'
- echo -en '\t' ; echo 'fi'
- echo -en '\t' ; echo 'chmod 755 "ponysay.install"'
- echo
-
- echo "quotes:"
- echo -en '\t' ; echo 'mkdir -p quotes'
- echo -en '\t' ; echo 'for ponies in $$(cat ponyquotes/ponies); do \'
- echo -en '\t' ; echo ' for pony in $$(echo $$ponies | sed -e '\''s/+/ /g'\''); do \'
- echo -en '\t' ; echo ' echo '\''Generating quote files for '\''"$$pony"; \'
- echo -en '\t' ; echo ' for file in $$(ls "ponyquotes/" | grep "$$pony\\.*"); do \'
- echo -en '\t' ; echo ' if [ -f "ponyquotes/$$file" ]; then \'
- echo -en '\t' ; echo ' cp "ponyquotes/"$$file "quotes/"$$ponies'\''.'\''$$(echo $$file | cut -d '\''.'\'' -f 2) \'
- echo -en '\t' ; echo ';fi;done;done;done'
- echo
-
- echo 'manpages:'
- gzCompress $manFiles
- echo
-
- echo 'infomanual:'
- echo -en '\t'
- echo 'makeinfo "manuals/ponysay.texinfo"'
- gzCompress 'ponysay.info'
- echo
-
- echo 'ponysaycompletion:'
- correctPrefix $completions
- echo
-
- echo 'ponythinkcompletion: ponysaycompletion'
- thinkCompletion $completions
- echo
-
- echo 'install-min: core quotes'
- echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/share/ponysay/"'
- for dir in $shareDirs; do
- echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/share/ponysay/'"$dir"'"'
- echo -en '\t' ; echo 'cp -P "'"$dir"'/"* "$(INSTALLDIR)/share/ponysay/'"$dir"'/"'
- done
- echo
- echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/bin/"'
- echo -en '\t' ; echo 'install "ponysay.install" "$(INSTALLDIR)/bin/ponysay"'
- echo -en '\t' ; echo 'ln -sf "ponysay" "$(INSTALLDIR)/bin/ponythink"'
- echo
- echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/share/ponysay/"'
- echo -en '\t' ; echo 'install "share/ucsmap" "$(INSTALLDIR)/share/ponysay/ucsmap"'
- echo
- echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/share/licenses/ponysay/"'
- for file in $licenseFiles; do
- echo -en '\t'
- echo 'install "'"$file"'" "$(INSTALLDIR)/share/licenses/ponysay/'"$file"'"'
+ params=''
+ for arg in "$@"; do
+ params="$params '$(echo $arg | sed -e "s/'/'\\''/g")'"
done
- echo
- echo 'install-cache:'
- echo -en '\t' ; echo 'mkdir -p "$(DESTDIR)/var/cache/ponysay/"'
- echo -en '\t' ; echo 'chmod 777 "$(DESTDIR)/var/cache/ponysay/"'
+ echo 'PARAMS ='"$params"
echo
-
- for completion in $completions; do
- shell="${completion##*/}"
- shell="${shell%%-*}"
- thinkfile="${completion%%.*}-think.${completion##*.}"
- shelldir='share/'"$(getcompdir $shell)"'/'
- echo 'install-'"$shell"': ponysaycompletion ponythinkcompletion'
- echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/'"$shelldir"'"'
- echo -en '\t' ; echo 'install "'"$completion"'" "$(INSTALLDIR)/'"$shelldir$(getcompfile $shell ponysay)"'"'
- echo -en '\t' ; echo 'install "'"$thinkfile"'" "$(INSTALLDIR)/'"$shelldir$(getcompfile $shell ponythink)"'"'
- echo
- installedFiles="$installedFiles $shelldir$(getcompfile $shell ponysay) $shelldir$(getcompfile $shell ponythink)"
+ echo -e 'default: all\n'
+ echo -e 'all: build\n'
+ for func in $(echo 'build' 'prebuilt' 'install' 'uninstall' 'uninstall-old' 'clean' 'clean-old' 'view'); do
+ echo -e "$func"':\n\t./setup.py $(PARAMS) '"$func"'\n'
done
- echo 'install-pdf:'
- echo -en '\t'
- echo 'install "ponysay.pdf" "$(INSTALLDIR)/doc/ponysay.pdf"'
- echo
-
- echo 'install-info: infomanual'
- echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/share/info"'
- echo -en '\t' ; echo 'install "ponysay.info.gz" "$(INSTALLDIR)/share/info/ponysay.info.gz"'
- echo -en '\t' ; echo 'install "ponysay.info.gz" "$(INSTALLDIR)/share/info/ponythink.info.gz"'
- echo
-
- echo 'install-info-install: install-info'
- echo -en '\t' ; echo 'install-info --dir-file="$(INSTALLDIR)/share/info/dir" --entry="Miscellaneous" --description='"$INFODESC"' "$(INSTALLDIR)/share/info/ponysay.info.gz"'
- echo -en '\t' ; echo 'install-info --dir-file="$(INSTALLDIR)/share/info/dir" --entry="Miscellaneous" --description='"$INFODESC"' "$(INSTALLDIR)/share/info/ponythink.info.gz"'
- echo
-
- for man in $manFiles; do
- lang="${man##*manpage}"
- lang="${lang%%.6}"
- mandir="${lang/\.//}"
- echo 'install-man'"${lang/\./-}"': manpages'
- echo -en '\t' ; echo 'mkdir -p "$(INSTALLDIR)/share/man'"$mandir"'/man6"'
- echo -en '\t' ; echo 'install "'"$man"'.gz" "$(INSTALLDIR)/share/man'"$mandir"'/man6/ponysay.6.gz"'
- echo -en '\t' ; echo 'ln -sf "ponysay.6.gz" "$(INSTALLDIR)/share/man'"$mandir"'/man6/ponythink.6.gz"'
- echo
- installedFiles="$installedFiles share/man$mandir/man6/ponysay.6.gz share/man$mandir/man6/ponythink.6.gz"
- done
-
- echo
- echo 'install: '"$installMethods"
- echo -en '\t' ; echo '@echo -e \\n\\n\'
- cat <<EOF
-'/--------------------------------------------------\\\\\n'\\
-'| ___ |\\n'\\
-'| / (_) o |\\n'\\
-'| \\__ _ _ __ |\\n'\\
-'| / / |/ | | / \\_| | |\\n'\\
-'| \\___/ | |_/|/\\__/ \\_/|/ |\\n'\\
-'| /| /| |\\n'\\
-'| \\| \\| |\\n'\\
-'| ____ |\\n'\\
-'| | _ \\ ___ _ __ _ _ ___ __ _ _ _ |\\n'\\
-'| | |_) |/ _ \\ | '\\''_ \\ | | | |/ __| / _\` || | | | |\n'\\
-'| | __/| (_) || | | || |_| |\\__ \\| (_| || |_| | |\\n'\\
-'| |_| \\___/ |_| |_| \\__, ||___/ \\__,_| \\__, | |\\n'\\
-'| |___/ |___/ |\\n'\\
-'\\\\--------------------------------------------------/'
-EOF
- echo 'uninstall:'
- echo -en '\t' ; echo 'if [ -d "$/var/cache/ponysay" ]; then rm -rf "$/var/cache/ponysay"; fi'
- for old in $installedDirs; do
- echo -en '\t'
- echo 'if [ -d "$(INSTALLDIR)/'"$old"'" ]; then rm -rf "$(INSTALLDIR)/'"$old"'"; fi'
- done
- for old in $installedFiles; do
- echo -en '\t'
- echo 'if [ -f "$(INSTALLDIR)/'"$old"'" ]; then unlink "$(INSTALLDIR)/'"$old"'"; fi'
- done
- echo
-
- echo 'clean:'
- for old in $compiledDirs; do
- echo -en '\t'
- echo 'if [ -d "'"$old"'" ]; then rm -rf "'"$old"'"; fi'
- done
- for old in $compiledFiles; do
- echo -en '\t'
- echo 'if [ -f "'"$old"'" ]; then rm -f "'"$old"'"; fi'
- done
- echo
-
- echo 'uninstall-old:'
- for old in $oldInstalledDirs; do
- echo -en '\t'
- echo 'if [ -d "$(INSTALLDIR)/'"$old"'" ]; then rm -rf "$(INSTALLDIR)/'"$old"'"; fi'
- done
- for old in $oldInstalledFiles; do
- echo -en '\t'
- echo 'if [ -f "$(INSTALLDIR)/'"$old"'" ]; then unlink "$(INSTALLDIR)/'"$old"'"; fi'
- done
- echo
-
- echo 'clean-old:'
- for old in $oldCompiledDirs; do
- echo -en '\t'
- echo 'if [ -d "'"$old"'" ]; then rm -rf "'"$old"'"; fi'
- done
- for old in $oldCompiledFiles; do
- echo -en '\t'
- echo 'if [ -f "'"$old"'" ]; then rm -f "'"$old"'"; fi'
- done
- echo
-
cat <<EOF
## Scripts for maintainers
ttyponies:
mkdir -p "ttyponies"
for pony in \$\$(ls --color=no "ponies/"); do \\
- if [ 1 "\$\$pony" = '.info' ]; then \\
+ if [ ! "\$\$pony" = '.info' ]; then \\
echo "building ttypony: \$\$pony" ;\\
if [ "\`readlink "ponies/\$\$pony"\`" = '' ]; then \\
ponysay2ttyponysay < "ponies/\$\$pony" | tty2colourfultty -c 1 > "ttyponies/\$\$pony" ;\\
@@ -371,7 +35,7 @@ ttyponies:
done
mkdir -p "extrattyponies"
for pony in \$\$(ls --color=no "extraponies/"); do \\
- if [ 1 "\$\$pony" = '.info' ]; then \\
+ if [ ! "\$\$pony" = '.info' ]; then \\
echo "building extrattypony: \$\$pony" ;\\
if [ "\`readlink "extraponies/\$\$pony"\`" = '' ]; then \\
ponysay2ttyponysay < "extraponies/\$\$pony" | tty2colourfultty -c 1 > "extrattyponies/\$\$pony" ;\\
@@ -394,5 +58,6 @@ pdfmanual:
EOF
}
-makeMakefile > Makefile
+
+makeMakefile "$@" > Makefile
diff --git a/manuals/manpage.6 b/manuals/manpage.0
index f623b97..362aa39 100644
--- a/manuals/manpage.6
+++ b/manuals/manpage.0
@@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
-.TH PONYSAY 6 "July 12, 2012"
+.TH PONYSAY 0 "July 12, 2012"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@@ -103,8 +103,8 @@ want to truncate the output on the height even if you are not running \fIponysay
.SH BUG
Bugs can be reported in <\fBhttps://github.com/erkin/ponysay/issues\fP>.
.SH SEE ALSO
-.BR cowsay (1),
-.BR fortune (6).
+.BR cowsay (0),
+.BR fortune (0).
.br
.SH AUTHOR
ponysay was written by Erkin Batu Altunbaş <erkinbatu@gmail.com>
diff --git a/manuals/manpage.es.6 b/manuals/manpage.es.0
index d6dadd3..8a4959f 100644
--- a/manuals/manpage.es.6
+++ b/manuals/manpage.es.0
@@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
-.TH PONYSAY 6 "Julio 13, 2012"
+.TH PONYSAY 0 "Julio 13, 2012"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@@ -104,8 +104,8 @@ Los bugs pueden ser reportados en
.br
<\fBhttps://github.com/erkin/ponysay/issues\fP>.
.SH VEA TAMBIÉN
-.BR cowsay (1),
-.BR fortune (6).
+.BR cowsay (0),
+.BR fortune (0).
.br
.SH AUTOR
ponysay fue escrito por Erkin Batu Altunbaş <erkinbatu@gmail.com>
diff --git a/manuals/ponysay.texinfo b/manuals/ponysay.texinfo
index 5732fb0..d7b7ef2 100644
--- a/manuals/ponysay.texinfo
+++ b/manuals/ponysay.texinfo
@@ -8,7 +8,7 @@
@documentlanguage en
@finalout
@c %**end of header
-@set VERSION 2.3
+@set VERSION 2.5
@copying
This manual is for ponysay
@@ -34,7 +34,11 @@ Texts. A copy of the license is included in the section entitled
@titlepage
@title Ponysay
+@c@subtitle Cowsay reimplementation for ponies.
+@c@subtitle Ponies for your terminal.
@subtitle Infesting your terminal with ponies.
+@c@subtitle Surviving the zombiepony takeover.
+@c@subtitle Making your terminal about 20 % cooler.
@subtitle Covers ponysay version @value{VERSION}.
@c ** start of front page image **
@c If print make a pdf or hard copy with the front cover
@@ -59,14 +63,15 @@ Texts. A copy of the license is included in the section entitled
* Invoking ponysay:: How to run @command{ponysay}.
* Advanced usage:: Advanced usage of @command{ponysay}.
* Environment variables:: Getting more from @command{ponysay} with environment variables.
+* Optional features:: Get the most out of @command{ponysay} with optional features.
* Limitations:: Known limitations that may not be that easy to overcome.
* Problems and requests:: Report issues and making requests.
-* Dependencies:: Ponysay's Dependencies.
+* Dependencies:: Ponysay's dependencies.
* Installing:: How to install @command{ponysay}.
-* Extensions:: Extensions.
* Inner workings:: Useful information for those whom want to help hack @command{ponysay}.
* Contributing:: Useful information for those whom want to help improve the world.
* Distributing:: Useful information for OS package repository package maintainers.
+* Terminology:: Terminology.
* Change log:: Differences between the version of @command{ponysay}.
* Ponysay contributors:: Ponysay contributors.
* Ponysay license:: Ponysay license.
@@ -81,19 +86,21 @@ Texts. A copy of the license is included in the section entitled
@chapter Overview
@cindex overview
-@command{ponysay} displays an image of a My Little Pony pony saying some text
-provided by the user in a terminal, or a quote from the series. It is was wrapper for
-@command{cowsay}, but since version 2.1 it reimplementation @command{cowsay}.
-If message is not provided, e.g. by piping, it accepts standard input. The pony
-saying the given message is printed on standard output.
+@command{ponysay} displays an image of a My Little Pony pony saying a message provided
+by the user in a terminal, or a quote from the show My Little Pony: Friendship is Magic
+(MLP:FiM). Historically @command{ponysay} was a wrapper for cowsay, but has since
+version 2.1 become an independent reimplementation of @command{cowsay}.
+
+If a message is not provided, e.g. by piping, it accepts standard input. The pony
+quoting the given message is printed on standard output.
@command{ponythink} is to @command{ponysay} as @command{cowthink} is to
@command{cowsay}.
@command{ponysay} is generally used to decorate your terminal with a random pony, when
-you start the terminal. But if you known anypony how does like ponies [fat chance] you
-can always make screen-shots of @command{ponysay -q} runs and communication that way
-over e-mail.
+you start the terminal. But if you know anypony how does like ponies [fat chance] you
+can always make screen-shots of @command{ponysay -q} executions and communication that
+way over e-mail.
@@ -109,7 +116,7 @@ The format for running the @command{ponysay} program is:
@example
ponysay [@var{option}...] [--] [@var{message}]
-ponythink [@var{option}...y] [--] [@var{message}]
+ponythink [@var{option}...] [--] [@var{message}]
@end example
Running @command{ponysay} will print a speech balloon, @command{ponythink} will
@@ -190,61 +197,65 @@ is added as an argument after @option{-q}. If one or more ponies are added after
This option requires the extension @command{ponyquotes4ponysay}, which is included
by default since version 1.2.
-The argument can be a file name, but pony if it ends with @file{.pony}.
+The argument can be a file name, but only if it ends with @file{.pony}.
@item -W COLUMN
@itemx --wrap COLUMN
@cindex @option{-W}
@cindex @option{--wrap}
-Specify the screen column where the message should be wrapped,
-this is by default 40, which is inherited from @command{cowsay}.
+Specify the screen column where the message should be wrapped, this is by default 40,
+as with @command{cowsay}.
@item -c
@itemx --compress
@cindex @option{-c}
@cindex @option{--compress}
-@cindex figlet
-@cindex toilet
+@cindex @command{figlet}
+@cindex @command{TOIlet}
Compress the message in the same way @command{cowsay} does, that is basically
-without multiple spaces, one only paragraphs seperations. Using this options
-will mean that you cannot display @command{filet} and @command{TOIlet} style
+without multiple spaces, and only paragraphs separations. Using this options
+will mean that you cannot display @command{figlet} and @command{TOIlet} style
messages.
@item -l
@itemx --list
@cindex @option{-l}
@cindex @option{--list}
-Lists all installed ponies. If the extension @command{ponyquotes4ponysay} is
-installed the ponies which have quotes, i.e. can be used with the @option{-q}
-option, will be mark by being printed in bold or bright (depending on the terminal.)
+Lists all installed ponies. The ponies which have quotes, i.e. can be used with
+the @option{-q} option, will be marked by being printed in bold or bright (depending
+on the terminal.)
@item -L
@itemx --altlist
+@itemx --symlist
@cindex @option{-L}
+@cindex @option{--symlist}
@cindex @option{--altlist}
-Lists all installed ponies. If the extension @command{ponyquotes4ponysay}
-is installed the ponies which have quotes, i.e. can be used with the @option{-q}
-option, will be mark by being printed in bold or bright (depending on the terminal.)
-This options differs from @option{-l} by printing alternative names (symbolic links)
-inside brackets after their target ponies.
+Lists all installed ponies. The ponies which have quotes, i.e. can be used with
+the @option{-q} option, will be marked by being printed in bold or bright (depending
+on the terminal.) This options differs from @option{-l} by printing alternative
+names (symbolic links) inside brackets after their target ponies.
@item +l
@itemx ++list
@cindex @option{+l}
@cindex @option{++list}
-Just as @option{-l}, but it lists extra (non-MLP:FiM) ponies instead of standard
-(MLP:FiM) ponies
+Just as @option{-l}, except it lists extra (non-MLP:FiM) ponies instead of standard
+(MLP:FiM) ponies.
@item +L
+@itemx ++symlist
@itemx ++altlist
@cindex @option{+L}
+@cindex @option{++symlist}
@cindex @option{++altlist}
-Just as @option{-L}, but it lists extra (non-MLP:FiM) ponies instead of standard
-(MLP:FiM) ponies
+Just as @option{-L}, except it lists extra (non-MLP:FiM) ponies instead of standard
+(MLP:FiM) ponies.
@item -B
@itemx --balloonlist
@cindex @option{-B}
+@cindex @option{--bubblelist}
@cindex @option{--balloonlist}
Prints a list of all balloon styles.
@end table
@@ -252,14 +263,14 @@ Prints a list of all balloon styles.
@cindex @var{message}
If neither @option{-q} is used nor any @var{message} is specified, @command{ponysay}
will read the message from stdin (standard input); however, if no arguments are used
-that nothing is piped to stdin, a help message will be printed. If you want to use
+and nothing is piped to stdin, a help message will be printed. If you want to use
@command{ponysay} without arguments and enter the message by hand, you can run
@code{cat | ponysay}.
@cindex @file{best.pony}
If no pony is selected, @command{ponysay} will look for a @file{best.pony} file,
-this should be a symbolic link to the pony you want as a default. If it is not a
-symbolic link, @option{-q} cannot determine which quotes to use.
+this file should be a symbolic link to the pony you want as a default. If it is not
+a symbolic link, @option{-q} cannot determine which quotes to use.
@node Advanced usage
@@ -298,13 +309,13 @@ described in the previous paragraph every time you open a terminal.
@cindex text ponification
@cindex ponypipe
-You can ponify text (i.e. replaces words search as `everyone' with `everypony')
-by using @code{fortune | ponypipe} instead of using @command{fortune}.
-@command{ponypipe} can be downloaded from @url{https://github.com/maandree/ponypipe}.
-Alternatively you can use @command{pinkie} (or @command{pinkiepie}), which can
-be downloaded from @url{https://github.com/maandree/pinkie-pie}, which is just
-@code{fortune | ponypipe}. There is also a large @command{sed} script, similar
-to @command{ponypipe}: @url{http://www.reddit.com/r/mylittlelinux/comments/srixi/using_ponysay_with_a_ponified_fortune_warning/}
+You can ponify messages (i.e. replaces words search as `everyone' with `everypony') by
+using @code{fortune | ponypipe} instead of using @command{fortune}. @command{ponypipe}
+can be downloaded from @url{https://github.com/maandree/ponypipe}.
+Alternatively you can use @command{pinkie} (or @command{pinkiepie}), which can be
+downloaded from @url{https://github.com/maandree/pinkie-pie}, which is just
+@code{fortune | ponypipe}. There is also a large @command{sed} script, similar to
+@command{ponypipe}: @url{http://www.reddit.com/r/mylittlelinux/comments/srixi/using_ponysay_with_a_ponified_fortune_warning/}
However I think @command{ponypipe} as better at replacing words than the @command{sed}
script, but I haven't used the script so I wouldn't know for sure.
@@ -328,6 +339,8 @@ If you use TTY and have a custom colour palette, you should also add to your
@end example
@end cartouche
+You should read more about this in @ref{KMS ponies}.
+
@node Running on screen
@section Running on @command{screen}
@@ -375,11 +388,11 @@ with the value @code{yes}, @code{y} or @code{1}.
@item PONYSAY_SHELL_LINES
@cindex @env{PONYSAY_SHELL_LINES}
@cindex tty
-Under TTY (Linux VT), if the output is larger the the screen's height, two
+Under TTY (Linux VT), if the output is larger than the screen's height, two
lines are left blank. If you want more, or less, blank lines you can export
@env{PONYSAY_SHELL_LINES} with the value of how many blank lines you want.
-Naturally this takes effect if the output is not actually larger than the
-screen.
+Naturally this takes effect eve n if the output is not actually larger than
+the screen.
@item PONYSAY_FULL_WIDTH
@cindex @env{PONYSAY_FULL_WIDTH}
@@ -406,33 +419,89 @@ the ASCII:ised names export @env{PONYSAY_UCS_ME} with the value @code{harder},
@code{h} or @code{2} instead.
If you have not enabled this, UCS names are not usable, suggested or listed.
-If you use @code{yes} UCS names will be usable, suggested or listed. If you
+If you use @code{yes} UCS names will be usable, suggested and listed. If you
use @code{harder} ASCII:ised names will not be suggested or listed, but they
will still be usable.
-@item PONYSAY_COWSAY
-@itemx PONYSAY_COWTHINK
-@cindex @env{PONYSAY_COWSAY}
-@cindex @env{PONYSAY_COWTHINK}
-@cindex custom cowsay
-@cindex replace cowsay
-Since version 2.1 this is no longer used as @command{cowsay} has been
-reimplemented inside @command{ponysay}, but it is possible we will add
-a way to replace that back-end.
-
-If you want to use another program than @command{cowsay} (the first
-@command{cowsay} found in @env{$PATH}), you can export @env{PONYSAY_COWSAY}
-with the value of that program. In earlier versions than version 2.0: If, and
-only if, @env{PONYSAY_COWSAY} does not have any value, @command{cowsay} is
-patch with @code{use utf8;} to the beginning. The @code{use utf8;} patch is
-introduced to make it easier to customise cowsay.
-
-@env{PONYSAY_COWTHINK} will be used instead of @env{PONYSAY_COWSAY} if
-you run @command{ponythink}.
+@item @env{PONYSAY_KMS_PALETTE}
+@itemx @env{PONYSAY_KMS_PALETTE_CMD}
+@cindex @env{PONYSAY_KMS_PALETTE}
+@cindex @env{PONYSAY_KMS_PALETTE_CMD}
+@cindex tty
+@cindex linux vt
+@cindex kmsponies
+@cindex kms
+@cindex kernel mode setting
+
+@env{PONYSAY_KMS_PALETTE} or @env{PONYSAY_KMS_PALETTE_CMD} is used to tell
+ponysay how your TTY palette looks, this feature lets you get the best images
+in TTY if you have Kernel Mode Setting (KMS) support.
+
+See @ref{KMS ponies} for information on how to use this.
@end table
-See @ref{kmsponies4ponysay} for additional environment variables used by the
-extension @command{kmsponies4ponysay}.
+
+
+@node Optional features
+@chapter Optional features
+@cindex features, optional
+@cindex optional features
+@cindex optional dependencies
+
+@menu
+* KMS ponies:: Improved TTY support under KMS support.
+@end menu
+
+
+@node KMS ponies
+@section KMS ponies
+@cindex kmsponies
+@cindex tty
+@cindex linux vt
+@cindex kms
+@cindex kernel mode setting
+@cindex environment variables
+@cindex @env{PONYSAY_KMS_PALETTE}
+@cindex @env{PONYSAY_KMS_PALETTE_CMD}
+@cindex @file{.bashrc}
+@cindex @file{~/.bashrc}
+@cindex cache
+@cindex @file{/var/cache/ponysay}
+@cindex @file{~/.cache/ponysay}
+
+KMS ponies is an optional feature that required that you have @command{util-say>=2}
+(@command{util-say<2} for @command{ponysay<2.1}) installed. It lets TTY users that
+have a custom TTY colour palette and KMS support get best TTY images that can be
+display at the current state of the art. KMS is supported on most computers, but due
+to lack of published specifications Nvidia drivers does not support KMS.
+@command{util-say} can be downloaded at @url{https://github.com/maandree/util-say}.
+
+To use this feature your @file{~/.bashrc} (or equivalent for your shell) must keep
+track of your colour palette; it is not possible for a program to ask to terminal.
+Either the shell should export a palette string to @env{$PONYSAY_KMS_PALETTE} or you
+should export a command to can get the palette string to
+@env{$PONYSAY_KMS_PALETTE_CMD}. The palette string should be the stream which sets
+the colour palette to the terminal when @command{echo}:ed; preferably, to increase
+speed and reduce cache usage, it should be consistent every time it is exported for
+every colours palette. So you may want to keep it sorted, always be in either upper
+case or lower case, and not contain an character that is not used to set the colour
+palette.
+
+Assuming you have a function in your @file{~/.bashrc}, to reset the colour palette
+to what you set it to last time in the terminal, named @command{reset-palette},
+your @file{~/.bashrc} should, for example, contain:
+@cartouche
+@example
+[ "$TERM" = "linux" ] &&
+ function ponysay
+ @{ export PONYSAY_KMS_PALETTE="$(reset-palette)"
+ exec ponysay "$@@"
+ @}
+@end example
+@end cartouche
+
+KMS ponies uses @file{/var/cache/ponysay/} or, if missing, @file{~/.cache/ponysay/}
+for cache space.
@@ -460,11 +529,11 @@ Ponysay works perfectly on @command{xterm}, @command{xterm} like terminals inclu
@command{mate-terminal}.
@cindex kms
-@cindex kernel mode settings
+@cindex kernel mode setting
@cindex tty
@cindex linux vt
-On Linux's native terminal Linux VT (TTY) it works less well, and not good at all with
-Kernel Mode Settings (KMS) support. See @url{https://github.com/erkin/ponysay/issues/1}
+On Linux's native terminal Linux VT (TTY) it works less well, and not good at all
+without Kernel Mode Setting (KMS) support. See @url{https://github.com/erkin/ponysay/issues/1}
for more information. @command{ponysay} clears the screen before printing to TTY, this
is because if your graphics driver supports KMS, the colours will be messed by when the
ponies position moves on the screen, this is also reason why the output is truncated on
@@ -484,9 +553,9 @@ transparency.)
@cindex Eterm
@cindex aterm
@command{ponysay} works perfectly on @command{xterm}, @command{urxvt} and
-@command{putty}, but @command{rxvt}, @command{mrxvt} and @command{Eterm} do not
-have UTF-8 support and are currently not supported. Additionally @command{aterm}
-have neither UTF-8 support nor 256 colour support, and is therefore not yet support.
+@command{putty}, but @command{rxvt}, @command{mrxvt} and @command{Eterm} do not have
+UTF-8 support and are currently not supported. Additionally @command{aterm} have
+neither UTF-8 support nor 256 colour support, and is therefore not yet supported.
@cindex 9term
Due to extreme limitations in @command{9term} @command{ponysay} will never be able to
@@ -594,8 +663,8 @@ It can be downloaded at @url{https://github.com/maandree/util-say}.
@cindex images, png
@cindex portable network graphics
For the purpose of simplifying for pony contributors, @command{ponysay} supports
-using .png-images (note that the file must not miss the @file{.png} in the file)
-in addition of .pony-files or pony names.
+using .png-images (note that the file must not miss the @file{.png} at the end of
+the file name) in addition to .pony-files or pony names.
@end table
@@ -677,8 +746,8 @@ If you have @command{git} you can @command{clone} the project URL
@url{https://github.com/erkin/ponysay.git}.
In the terminal, @command{cd} into the ponysay directory and execute
-@command{./configure && make install}. This will install @command{ponysay} into the
-@file{/usr}, meaning you may need to run @command{make install} as root,
+@command{./configure && make install}. This will install @command{ponysay} into
+@file{/usr}, normally meaning you need to run @command{make install} as root,
e.g. by running @command{sudo make install}.
Now you will be to use ponysay, run: @command{ponysay "I am just the cutest pony!"},
@@ -687,7 +756,7 @@ or if have a specific pony in your mind: @command{ponysay -f pinkie "Partay!~"}.
@cindex manpage translations
@command{ponysay} comes with this @command{info} manual and a manpage in section 6,
@command{man 6 ponysay} (or just @command{man ponysay}). The manpage is also available
-in Spanish: @command{man -L es 6 ponysay}. The install the Spanish manual add the
+in Spanish: @command{man -L es 6 ponysay}. To install the Spanish manual add the
option @option{--with-man-es} when running @command{./configure}.
@@ -717,7 +786,7 @@ After @option{--everything} it is possible to remove unwanted parts, this can of
cause be done without @option{--everything}. If you want to install the PDF manual
to @file{/usr/doc/ponysay.pdf} add the option @option{--with-pdf} when running
@command{./configure}. To install a manpage translation add @option{--with-man-LANG}
-and substitute the the language code for @code{LANG}. Currently the only translation
+and substitute the language code for @code{LANG}. Currently the only translation
is Spanish with the language code @code{es}. If you do not want the English manpage
add the option @option{--without-man}. If you do not want the @command{info} manual
add the option @option{--without-info}. If you are installing the @command{info}
@@ -730,18 +799,18 @@ The following argumentless options are also recognised:
@item @option{--without-bash}
@cindex @option{--without-bash}
@cindex @command{bash}, without
-will skip installation of auto-completion for @command{ponysay} and the
-GNU Bourne-again shell, @command{bash}.
+will skip installation of auto-completion for @command{ponysay} and
+@command{ponythink} under the GNU Bourne-again shell, @command{bash}.
@item @option{--without-fish}
@cindex @option{--without-fish}
@cindex @command{fish}, without
-will skip installation of auto-completion for @command{ponysay} and the
-Friendly interactive shell, @command{fish}.
+will skip installation of auto-completion for @command{ponysay} and
+@command{ponythink} under the Friendly interactive shell, @command{fish}.
@item @option{--without-zsh}
@cindex @option{--without-zsh}
@cindex @command{zsh}, without
-will skip installation of auto-completion for @command{ponysay} and the
-shell @command{zsh}.
+will skip installation of auto-completion for @command{ponysay} and
+@command{ponythink} under the shell @command{zsh}.
@item @option{--without-shared-cache}
@cindex @option{--without-shared-cache}
@cindex cache
@@ -754,8 +823,8 @@ shared cache, private one will be used at @file{~/.cache/ponysay}.
@cindex @file{/usr/games}
The program is by default installed in @file{/usr}, if you want another target
directory, you can add @option{--prefix=TARGET} when running @command{./configure}.
-For example to install @command{ponysay} in @file{/usr/games} you build the
-program by running @command{./configure --prefix=/usr/games}, and alike for
+For example to install @command{ponysay} in @file{/usr/local} you build the
+program by running @command{./configure --prefix=/usr/local}, and alike for
installation and uninstallation. Notice the @command{=} cannot be substituted
with white space.
@@ -775,8 +844,8 @@ add the option @command{--shell=SHELL}.
@cindex arch linux
The official Arch Linux package repositories contains @command{ponysay} as
-@w{@code{community/ponysay}}. The Arch Linux User Repository (AUR) contains a bleeding
-edge git version of @command{ponysay} as @code{ponysay-git}.
+@w{@code{community/ponysay}}. The Arch Linux User Repository (AUR) contains a
+bleeding edge git version of @command{ponysay} as @code{ponysay-git}.
@node Gentoo Linux
@@ -806,82 +875,7 @@ manually from the upstream, you can uninstall it by running @command{make uninst
Well written package manages will uninstall files that the package is no longer
using, i.e. if deleted, moved or renamed. To uninstall files that are not longer
used, by the currently installed version you will need that versions @file{Makefile}.
-To perform the uninstallation of old filed run @command{make uninstall-old}.
-
-
-
-@node Extensions
-@chapter Extensions
-@cindex extensions
-@cindex optional dependencies
-
-Ponysay does not support extensions, per se, but rather have optional features that
-are enabled when other packages are installed.
-
-@menu
-* ponyquotes4ponysay:: ponyquotes4ponysay: Quotes from My Little Ponies.
-* kmsponies4ponysay:: kmsponies4ponysay: Improved TTY support under KMS support.
-@end menu
-
-
-@node ponyquotes4ponysay
-@section ponyquotes4ponysay
-@cindex ponyquotes4ponysay
-@cindex quotes
-
-@command{ponyquotes4ponysay} is a package that adds support for MLP:FiM quotes that are
-displayed with the associated ponies. See @ref{Invoking ponysay} for more information.
-
-As of version 1.2 @command{ponyquotes4ponysay} is included in @command{ponysay},
-but is still available at @url{https://github.com/maandree/ponyquotes4ponysay}.
-
-
-@node kmsponies4ponysay
-@section kmsponies4ponysay
-@cindex kmsponies4ponysay
-@cindex tty
-@cindex linux vt
-@cindex kms
-@cindex kernel mode settings
-@cindex environment variables
-@cindex @env{PONYSAY_KMS_PALETTE}
-@cindex @env{PONYSAY_KMS_PALETTE_CMD}
-@cindex @file{.bashrc}
-
-@command{kmsponies4ponysay} is an extension for TTY users that have a custom TTY
-colour palette and KMS support. KMS is supported on most computers, but due to lack
-of published specifications Nvidea drivers does not support KMS.
-@command{kmsponies4ponysay} can be downloaded at
-@url{https://github.com/maandree/kmsponies4ponysay}.
-
-To use this extension your @file{~/.bashrc} (or equivalent for your shell) must keep
-track of your colour palette, it is not possible for a program to ask to terminal.
-Either the shell should export a palette string to @env{$PONYSAY_KMS_PALETTE} or you
-should export a command to can get the palette string to
-@env{$PONYSAY_KMS_PALETTE_CMD}. The palette string should be the stream which sets
-the colour palette to the terminal when @command{echo}:ed; preferably, to increase
-speed and reduce cache usage, it should be consistent every time it is exported for
-every colours palette. So you may want to keep it sorted, always be in either upper
-case or lower case, and not contain an character that is not used to set the colour
-palette.
-
-Assuming you have a function in your @file{~/.bashrc}, to reset the colour palette
-to what you set it to last time in the terminal, named @command{reset-palette},
-your @file{~/.bashrc} should, for example, contain:
-@cartouche
-@example
-[ "$TERM" = "linux" ] &&
- function ponysay
- @{ export PONYSAY_KMS_PALETTE="$(reset-palette)"
- exec ponysay "$@@"
- @}
-@end example
-@end cartouche
-
-@command{kmsponies4ponysay} uses @file{/var/cache/kmsponies4ponysay/} for cache space.
-
-As of version 2.0 @command{kmsponies4ponysay} is included in @command{ponysay},
-but is still available at @url{https://github.com/maandree/kmsponies4ponysay}.
+To perform an uninstallation of old files run @command{make uninstall-old}.
@@ -898,7 +892,7 @@ but is still available at @url{https://github.com/maandree/kmsponies4ponysay}.
* Truncation:: Output truncation.
* Languages:: Selection of programming languages.
* Shell auto-completion:: Things that make auto-completion simpler.
-* Universal Character Set:: Something about Univeral Character Set support.
+* Universal Character Set:: Something about Universal Character Set support.
@end menu
@@ -916,14 +910,14 @@ Variables are recalled by putting the variable's name between two dollar signs
(@code{$var$}), and are stored by putting the variable's name followed by the value
between two dollar signs and with a equality sign between the name and the value
(@code{$var=value$}). Variable names cannot include equality signs, but the value
-can; dollar signs can be used by placin an ESC character before the dollar sign.
+can; dollar signs can be used by placing an ESC character before the dollar sign.
-There are three predefinied variables: @code{$$} (empty variable name), @code{$\$}
+There are three predefined variables: @code{$$} (empty variable name), @code{$\$}
and @code{$/$}. @code{$$} has a dollar sign (@code{$}) as its value, while @code{$\$}
and @code{$/$} contains the characters for the link to the balloon directed in the
same direction as the variable name's slash.
-Variables those name begin with @code{balloon} are parsed as balloon inserts, it
+Variables whose name begin with @code{balloon} are parsed as balloon inserts, it
can be either @code{balloon}, @code{balloonX}, @code{balloon,Y} or @code{balloonX,Y},
whether @code{X} is the minimum width of the balloon and @code{Y} is the minimum
height of the balloon.
@@ -941,20 +935,20 @@ files.
@cindex pony quote infrastructure
@cindex quote infrastructure
-When compiles pony quotes are built to @file{quotes/}, the file names are lists of
-ponies joined with plus signs (@code{+}) -- the pony names are the same as the pony
-files, except they do not end with @file{.pony} -- with a index at the end, and a
-full stop (@code{.}) before the index.
+When compiling, pony quotes are built to @file{quotes/}, the file names are lists
+of ponies joined with plus signs (@code{+}) -- the pony names are the same as the
+pony files, except they do not end with @file{.pony} -- with a index at the end,
+and a full stop (@code{.}) before the index.
The source files are located in @file{ponyquotes/}, where their is a file named
-@file{ponies}. This file is called the pony map, is the basis for how the compiled
-files are named. In the ponymap ponies with the same quotes are on the same line
-join togather with plus signs (@code{+}), if the lines because too long for file
-names the line is split into multiple lines with the first pony in common.
+@file{ponies}. This file is called the pony map, and is the basis for how the
+compiled files are named. In the ponymap ponies with the same quotes are on the
+same line join together with plus signs (@code{+}), if the lines because too long
+for file names the line is split into multiple lines with the first pony in common.
-In @file{ponyquotes/} there are also quote files, each contain just one quote, just as
-when compiled to @file{quotes/}. The source quote files are indentical to the compiled
-quote files, except that there name contains just the first pony.
+In @file{ponyquotes/} there are also quote files, each contain just one quote, just
+as when compiled to @file{quotes/}. The source quote files are identical to the
+compiled quote files, except that their name contains just the first pony.
@node Balloon style files
@@ -967,13 +961,13 @@ Balloon style files are located in the directory @file{balloons/}, the ones endi
with @file{.say} applies to @command{ponysay} and the ones ending with @file{.think}
applies to @command{ponythink}.
-Balloon style consists of 20 strings. Each string is definied on separate lines, by
-their name and their value seperated with a colon (@code{name:value}), if the name is
-empty it continues the last one new line in the value. Only 10 of the strings may be
-multi-lined: @var{nw}, @var{nnw}, @var{n}, @var{nne}, @var{ne}, @var{sw}, @var{ssw},
-@var{s}, @var{sse} and @var{se}.
+Balloon style consists of 20 strings. Each string is defined on separate lines, by
+their name and their value separated with a colon (@code{name:value}), if the name is
+empty it continues the last one on a new line in the value. Only 10 of the strings
+may be multi-lined: @var{nw}, @var{nnw}, @var{n}, @var{nne}, @var{ne}, @var{sw},
+@var{ssw}, @var{s}, @var{sse} and @var{se}.
-The following strings are used, and must be definied in the files:
+The following strings are used, and must be defined in the files:
@table @var
@item \
The character for the link to the balloon directed as @code{\}.
@@ -994,7 +988,7 @@ printed directly to the right of the top left corner.
The top edge of the balloon.
@item nne
If both this string and the @var{nnw} string fits between the top corners, this is
-printed directly to the right of the top top corner.
+printed directly to the right of the top left corner.
@item ne
The top right corner of the balloon.
@item nee
@@ -1034,7 +1028,7 @@ only if the message contains more than one line.
@cindex linux vt
@cindex clearing tty
@cindex kms
-@cindex kernel mode settings
+@cindex kernel mode setting
Since Linux VT (TTY) does not have capabilities for returning the position of the
cursor, the screen must always be cleared before printing the ponies to make sure
@@ -1052,15 +1046,15 @@ we would also turn off num. lock and caps. lock.
@cindex truncation
@cindex output truncation
@cindex kms
-@cindex kernel mode settings
+@cindex kernel mode setting
Ponysay supports three type of output truncations, cutting away overflow on the right
and truncation the height by either keeping the bottom or keeping the top. By default
the latest is enabled under TTY, cutting away overflow on the right is always enabled
by default.
-Truncating the height in TTY is required under Kernel Mode Settings (KMS) support to
-keep the colours from being messed up ad the ponies is moved in the screen during
+Truncating the height in TTY is required under Kernel Mode Setting (KMS) support to
+keep the colours from being messed up when the ponies is moved in the screen during
print. Prior to version 2.0 this was done either by piping to @command{head} (keeps
the top) or by piping to @command{tail} (keeps the bottom.) @command{head} and
@command{tail} takes as argument the number of lines to keep at most.
@@ -1071,18 +1065,20 @@ height or the width. This requires only GNU Coreutils; earlier @command{tput row
@command{tput cols} were used, this however required, the only de facto standard,
package @command{ncurses}, some shells have environment variables for this.
-Since version 2.1 trunction is done internally in the Python script, before that it
-was done in a custom C porgram @command{truncater}, that was installed to
+Since version 2.1 truncation is done internally in the Python script, before that it
+was done in a custom C program @command{truncater}, that was installed to
@file{/usr/lib/ponysay/truncater}. It recognised UTF-8 ANSI escape sequences,
including OSI P and CSI m, which is essential for the truncation to be correct. It
also expands tabs to every eighth column and resets the background colour when needed,
and writes ANSI escape sequences that are on the left side of the truncation. The
truncater stops CSI sequences on the first ASCII letter (@code{[a-zA-Z]}), but also
stops escape sequences after the first character after the initial escape if it is
-not either @code{[} (CSI) or @code{]} (OSI). In the previus, C, program it supported
-UTF-8 by assumming that bytes do not match @code{10xxxxxx} and only those bytes were
+not either @code{[} (CSI) or @code{]} (OSI). In the previous, C, program it supported
+UTF-8 by assuming that bytes do not match @code{10xxxxxx} and only those bytes were
visible. This now fixed internally in Python, but has also been improved to exclude
-combining characters from the set of visible characters.
+combining characters from the set of visible characters. Another difference is that
+the background colours are not reset, instead ANSI colours after the truncation point
+are still printed.
@node Languages
@@ -1091,12 +1087,12 @@ combining characters from the set of visible characters.
@cindex script languages
@cindex programming languages
-Before version 2.0 @command{ponysay} was written primarily in GNU Bash script (POSIX
-compliant); the truncater was however written in C, because it is simple, fast, does
-not pose addition dependencies, and is easy to do byte hacking in.
+Before version 2.0 @command{ponysay} was written primarily in GNU Bash script; the
+truncater was however written in C, because it is simple, fast, does not pose
+addition dependencies, and is easy to do byte hacking in.
Sometimes shell is too slow, in these cases Perl was used; Perl was already required
-by @command{cowsay}, is similar to shell, but also supports hash tables.
+by @command{cowsay}, it is also similar to shell, but also supports hash tables.
However since version 2.0 we were trying to move from all there languages and only
use Python 3, which as been accomplished in version 2.1.
@@ -1106,9 +1102,9 @@ use Python 3, which as been accomplished in version 2.1.
@section Shell auto-completion
@cindex auto-completion, inner workings
@cindex shell, auto-completion
-@cindex @command{--onelist}
-@cindex @command{++onelist}
-@cindex @command{--quoters}
+@cindex @option{--onelist}
+@cindex @option{++onelist}
+@cindex @option{--quoters}
To make it easier to write auto-completion for shells, @command{ponysay} supports
the two options @option{--onelist}, @option{++onelist} and @option{--quoters},
@@ -1136,22 +1132,22 @@ Auto-completion scripts should not suggest these options.
@cindex unicode
@cindex pony names
-In earlier versions of @command{ponysay} only the output truncationed supported
+In earlier versions of @command{ponysay} only the output truncation supported
Universal Character Set, though handcoded UTF-8 character counting. Now
@command{ponysay} lets Python decode the data, Python store all 31 bits of a
character in as one character, not in UTF-16 as some other languages does, this
-means that the code is agnostic to the chararacter encoding. However in Unicode
+means that the code is agnostic to the character encoding. However in Unicode
6.1 their are four ranges of combining characters, these do not take up any
-width in proper terminal, we their for have a class in the code named @code{UCS}
-that help us take them into consideration when determine the length of strings.
+width in proper terminal, we therefore have a class in the code named @code{UCS}
+that help us take them into consideration when determine the length of a string.
-Some ponies have names contains non-ASCII characters, read about it in
+Some ponies have names that contain non-ASCII characters, read about it in
@ref{Environment variables}. The UCS names are stored in the file @file{share/ucsmap},
in it lines that are not empty and does not start with a hash (@code{#}) are
-parse, and contains a UCS name and a ASCII:ised name. The UCS name comes first,
-followed by the ASCII:ised name that it should replace or link to. The two names
-are separated by and simple left to right arrow character [U+2192], optionally
-with surrounding white space.
+parsed, and contains a UCS name and a ASCII:ised name. The UCS name comes first,
+followed by the ASCII:ised name that the UCS name should replace or link towards.
+The two names are separated by and simple left to right arrow character [U+2192],
+optionally with surrounding white space.
@@ -1176,8 +1172,8 @@ There is also a collection of ponies that are not yet pixelated in a Java
reimplementation of the early Ponysay:
@url{https://github.com/maandree/unisay/tree/develop/dev/newponies}
-There is a checklist named @file{pony-checklist} at the @file{dev/} directory.
-You can use the check which ponies are added and which are not.
+There is a checklist named @file{pony-checklist} at the @file{dev/} directory. You
+can use the check which ponies are added and which are not. Please update it when fit.
@*
New ponies can be created from regular images by using util-say, which is available
@@ -1213,9 +1209,9 @@ For more information see:
@cindex png images
@cindex images, png
@cindex portable network graphics
-If you have util-say installed, which is required to build ponies, you can run
-PNG files as argument for @command{ponysay -f}, this required that the file is
-named @file{.png} at the end.
+If you have util-say installed, which is required to build ponies, you can use PNG
+files as argument the for @command{ponysay -f}, this requires that the file is named
+@file{.png} at the end.
@cindex palette
@cindex xterm palette
@@ -1255,13 +1251,12 @@ To be able to run @command{make -B ttyponies} you must have the packages listed
@cindex quotes
Also when adding new ponies, please map them up in the file @file{ponyquotes/ponies}.
If the pony is a new pony without any other alternative image just add it to a new
-line, without @file{.pony}, preferably in its alphabetical position.
-If the file is a symlink add it to the same line as the target pony, and if the
-pony has and alternative image add it the the same line as that pony. Ponies on
-the same line are separated with a plus sign (@code{+}) without any white space.
-When a line is too long for a file name (this has happened to Pinkie Pie
-[@file{pinkie}],) it must be split into multiple lines, this line should have their
-first pony file in common.
+line, without @file{.pony}, preferably in its alphabetical position. If the file is
+a symlink add it to the same line as the target pony, and if the pony has and
+alternative image add it the the same line as that pony. Ponies on the same line are
+separated with a plus sign (@code{+}) without any white space. When a line is too
+long for a file name (this has happened to Pinkie Pie [@file{pinkie}],) it must be
+split into multiple lines, these lines should have their first pony file in common.
@@ -1274,10 +1269,10 @@ first pony file in common.
@cindex fhs
@cindex filesystem hierarchy standard
-If you are planning on maintaining @command{ponysay} in your favourite Operating
-System you should first read @ref{Required runtime dependencies} and
+If you are planning on maintaining @command{ponysay} in your favourite operating
+system you should first read @ref{Required runtime dependencies} and
@ref{Optional runtime dependencies}. If your OS does not follow Filesystem Hierarchy
-Standard (FHS), e.g. installing amusement binaries in @file{/usr/games} instread of
+Standard (FHS), e.g. installing amusement binaries in @file{/usr/games} instead of
@file{/usr/bin} or only supporting @file{/opt} equivalent directories you should
read about configurations in @ref{Custom installations}.
@@ -1285,7 +1280,176 @@ Apart from this, you should configure @command{ponysay} before building it with
option @option{--everything}. Otherwise only the @command{info} manual and the
English manpage will be installed for documentation.
-Please inform us about your distribution so we can list it, everypony can see it.
+Please inform us about your distribution so we can list it so everypony can see it.
+
+
+
+@node Terminology
+@chapter Terminology
+@cindex terminology
+
+@table @i
+@item MLP:FiM
+@cindex MLP:FiM
+The television show My Little Pony: Friendship is Magic.
+
+@item My Little Pony
+@cindex my little pony
+The successor to My Pretty Pony, the toy not the short story by Stephen King.
+
+@item TTY
+@itemx Linux VT
+@cindex tty
+@cindex linux vt
+Linux's native terminal emulator. The name TTY comes from the file names for the
+devices used for terminals by Linux VT, which is @file{/dev/tty*}.
+
+@item KMS
+@itemx Kernel Mode Setting
+@cindex kms
+@cindex kernel mode setting
+A feature in Linux allowing mode setting in kernel-space, this gives the TTY,
+for example better colour support. I would go to Wikipedia for more information.
+
+@item ttyponies
+@cindex ttyponies
+Pony files used in TTY.
+
+@item kmsponies
+@cindex kmsponies
+Pony files generated for use in TTY with custom TTY colour palette and KMS support.
+
+@item extraponies
+@itemx extra ponies
+@cindex extraponies
+@cindex extra ponies
+Pony files of ponies that are not a part of MLP:FiM.
+@item standard ponies
+@cindex standard ponies
+
+Pony files of ponies that are a part of MLP:FiM.
+@item systemponies
+@itemx sysponies
+@cindex systemponies
+@cindex sysponies
+Pony files located in @file{/usr/share/ponysay}.
+
+@item homeponies
+@itemx usrponies
+@cindex homeponies
+@cindex usrponies
+Pony files located in @file{~/.local/share/ponysay}.
+
+@item browser ponies
+@cindex browser ponies
+@cindex desktop ponies
+A JavaScript program which is the source for most of our ponies. It is a port of
+@i{desktop ponies}.
+
+@item ponification
+@cindex ponification
+The process of converting English text to Equestrian English.
+
+@item Equestrian English
+@cindex Equestrian English
+The English dialect spoken by the ponies in MLP:FiM, the basic role is that it
+is American English with as many words and parts of words as possible exchanged
+to words having to do with ponies, including the work `pony' itself. This is
+normally the language we, the developers, write in, except we may use another
+English, e.g. British English, as the base language.
+
+@item best.pony
+@cindex best.pony
+The pony you think is [the] best pony. It should be a symlink pony. It is a feature
+affecting the @option{-f}, @option{-F} and @option{-q} options.
+
+@item pony symlink
+@itemx symlink pony
+@cindex pony symlink
+@cindex symlink pony
+A pony file that is a symbolic link to another pony file. Symbolic links can be
+created with the command @command{ln -s TARGET SYMLINK}.
+
+@item ponyquotes
+@cindex ponyquotes
+A feature enabling ponies to quote them self from MLP:FiM.
+
+@item environment variables
+@cindex environment variables
+Variables stored to the environment with the command @command{export VARIABLE=VALUE}.
+The variable name is often written with the prefix @code{$} due to have they are read
+in shell, using the command @command{echo $VARIABLE}.
+
+@item UCS
+@itemx Universal Character Set
+@cindex ucs
+@cindex universal character set
+The set of of character, develop by the Unicode Consortium. It defined a partially filled
+space of @math{2^{31}} characters, some of which are not glyphs.
+
+@item combining characters
+@cindex combining characters
+Character that have zero width and is used to compose characters with diacritical when
+there is no precomposed character to use.
+
+@item ASCII
+@itemx ASCII character
+@cindex ascii
+@cindex character
+American Standard Code for Information Interchange (ASCII) defines 128 characters, some
+are not glyphs. It contains control characters, basic punctuation, the decimal digit,
+and lower case and upper case English alphabet characters @code{a-z}.
+
+@item short options
+@cindex short options
+Command line arguments starting with either exactly one hyphen (@code{-}) or exactly one
+plus sign (@code{+}), and have exactly one character beyond that. They may be argumentless,
+argumented, optionally argumented, or variadic (consumes are following arguments).
+
+@item long options
+@cindex long options
+Command line arguments starting with either at least two hyphens (@code{-}) or at least two
+plus signs (@code{+}), beyond that they have at least one character, but often at least one
+work. They by be argumentless, argumented, optionally argumented, or variadic (consumes are
+following arguments).
+
+@item completion
+@itemx auto-completion
+@itemx shell completion
+@itemx shell auto-completion
+@cindex completion
+@cindex auto-completion
+@cindex shell completion
+@cindex shell auto-completion
+Provided by a shell dependent script, argument suggestion is provided of then by pressing
+the tab key.
+
+@item ANSI escape sequences
+@itemx escape sequences
+@cindex ANSI escape sequences
+@cindex escape sequences
+Character sequences starting with a ESC character, with a special interpretation for terminals
+standardise by ANSI.
+
+@item ANSI colour sequences
+@itemx ANSI colours
+@itemx colour sequences
+@cindex ANSI colour sequences
+@cindex ANSI colours
+@cindex colour sequences
+ANSI escape sequences defining a colour or other formatting, known as CSI m, a sequence starting
+with CSI and ending with an @code{m}. This is extended to 256 colours, from 16 colours, by
+@command{xterm} which is de facto standardise.
+
+@item CSI
+@cindex CSI
+The character combination ESC followed by @code{[}, used in standardised ANSI escape sequences.
+
+@item OSI
+@cindex OSI
+The character combination ESC followed by @code{]}, used in non-standardised ANSI escape
+sequences.
+@end table
@@ -1296,6 +1460,13 @@ Please inform us about your distribution so we can list it, everypony can see it
@cindex previous releases
+@heading Version 2.4
+
+Nothing worth mentioning.
+
+@b{Note}: Identifies itself as version 2.3
+
+
@heading Version 2.3
@itemize @bullet
@@ -1350,7 +1521,7 @@ or @command{ponythink}
@heading Version 2.1.1
-Nothing worth mention.
+Nothing worth mentioning.
@heading Version 2.1
@@ -1722,6 +1893,7 @@ Patchers and other contributors of ponysay:
@item Kyah ``L-four'' Rindlisbacher
@item James ``rossy2401'' Ross-Gowan
@item Louis ``kragniz'' Taylor
+@item Daniel ``gtmanfred'' Wallace
@item Jannis ``sycoso''
@item ``spider-mario''
@end itemize
@@ -1731,6 +1903,11 @@ Patchers and other contributors of ponysay:
@node Ponysay license
@appendix Ponysay license
+Ponysay is release by Erkin Batu Altunbaş et al. @*
+Copyright @copyright{} 2012 Erkin Batu Altunbaş et al.
+
+@*
+
Ponysay is Free Software (yet not Open Source) and in licensed under the terms
of Do What The Fuck You Want To Public License (WTFPL) version 2.
@@ -1752,12 +1929,13 @@ changes. Access to the source code is a precondition for this.
@*
-@center DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
-@center Version 2, December 2004
+@cartouche
+@verbatim
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ Version 2, December 2004
-Copyright @copyright{} 2012 Erkin Batu Altunbaş
+Copyright © 2004 Sam Hocevar <sam@hocevar.net>
-@quotation
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
@@ -1766,9 +1944,8 @@ as the name is changed.
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
-@end quotation
-
-
+@end verbatim
+@end cartouche
@node GNU Free Documentation License
@appendix GNU Free Documentation License
diff --git a/manuals/ponysay_front.xcf b/manuals/ponysay_front.xcf
index c785502..bbc7eed 100644
--- a/manuals/ponysay_front.xcf
+++ b/manuals/ponysay_front.xcf
Binary files differ
diff --git a/ponyquotes/ponies b/ponyquotes/ponies
index 0834dcd..e70bec5 100644
--- a/ponyquotes/ponies
+++ b/ponyquotes/ponies
@@ -10,6 +10,7 @@ applejack+applejackscarecrow+fillyjack+fillyjacktravel
archer
berrypunch
bigmac
+blaze
blinkie
blossomforth
bonbon+bonbonstand
diff --git a/ponysay b/ponysay
index f70cb2d..8115916 100755
--- a/ponysay
+++ b/ponysay
@@ -2,17 +2,25 @@
# -*- coding: utf-8 -*-
'''
-ponysay.py - Ponysay, a cowsay reimplementation for ponies
-Copyright (C) 2012 Erkin Batu Altunbaş
+ponysay.py - Ponysay, cowsay reimplementation for ponies
+Copyright (C) 2012 Erkin Batu Altunbaş et al.
-Authors: Erkin Batu Altunbaş: Project leader, helped write the first implementation
+This program is free software. It comes without any warranty, to
+the extent permitted by applicable law. You can redistribute it
+and/or modify it under the terms of the Do What The Fuck You Want
+To Public License, Version 2, as published by Sam Hocevar. See
+http://sam.zoy.org/wtfpl/COPYING for more details.
+
+
+Authors of ponysay.py:
+
+ Erkin Batu Altunbaş: Project leader, helped write the first implementation
Mattias "maandree" Andrée: Major contributor of both implementions
Elis "etu" Axelsson: Major contributor of current implemention and patcher of the first implementation
Sven-Hendrik "svenstaro" Haase: Major contributor of the first implementation
Jan Alexander "heftig" Steffens: Major contributor of the first implementation
Kyah "L-four" Rindlisbacher: Patched the first implementation
-License: WTFPL
'''
import os
@@ -25,14 +33,7 @@ from subprocess import Popen, PIPE
'''
The version of ponysay
'''
-VERSION = '2.3'
-
-
-'''
-The directory where ponysay is installed, this is modified when building with make
-'''
-INSTALLDIR = '/usr'
-
+VERSION = 'dev' # this line should not be edited, it is fixed by the build system
'''
@@ -106,11 +107,11 @@ class Ponysay():
return
maplines = []
- for sharedir in sharedirs:
- if os.path.isfile(sharedir + 'ucsmap'):
+ for ucsmap in ucsmaps:
+ if os.path.isfile(ucsmap):
mapfile = None
try:
- mapfile = open(sharedir + 'ucsmap', 'r')
+ mapfile = open(ucsmap, 'r')
maplines += [line.replace('\n', '') for line in mapfile.readlines()]
finally:
if mapfile is not None:
@@ -149,11 +150,11 @@ class Ponysay():
return
maplines = []
- for sharedir in sharedirs:
- if os.path.isfile(sharedir + 'ucsmap'):
+ for ucsmap in ucsmaps:
+ if os.path.isfile(ucsmap):
mapfile = None
try:
- mapfile = open(sharedir + 'ucsmap', 'r')
+ mapfile = open(ucsmap, 'r')
maplines += [line.replace('\n', '') for line in mapfile.readlines()]
finally:
if mapfile is not None:
@@ -864,8 +865,8 @@ class ArgParser():
elif dashed: self.files.append(arg)
elif arg == '++': tmpdashed = True
elif arg == '--': dashed = True
- elif (len(arg) > 1) and ((arg[0] == '-') or (arg[0] == '+')):
- if (len(arg) > 2) and ((arg[:2] == '--') or (arg[:2] == '++')):
+ elif (len(arg) > 1) and (arg[0] in ('-', '+')):
+ if (len(arg) > 2) and (arg[:2] in ('--', '++')):
if dontget > 0:
dontget -= 1
elif (arg in self.optmap) and (self.optmap[arg][1] == ARGUMENTLESS):
@@ -1628,55 +1629,66 @@ usekms = Ponysay.isUsingKMS()
'''
-Root share/ directories
-'''
-sharedirs = []
-_sharedirs = [HOME + '/.local/share/ponysay/', INSTALLDIR + '/share/ponysay/']
-for sharedir in _sharedirs:
- if os.path.isdir(sharedir):
- sharedirs.append(sharedir)
-
-
-'''
The directories where pony files are stored, ttyponies/ are used if the terminal is Linux VT (also known as TTY) and not with KMS
'''
+appendset = set()
ponydirs = []
-if linuxvt and not usekms: _ponydirs = [d + 'ttyponies/' for d in sharedirs]
-else: _ponydirs = [d + 'ponies/' for d in sharedirs]
+if linuxvt and not usekms: _ponydirs = [HOME + '/.local/share/ponysay/ttyponies/', '/usr/share/ponysay/ttyponies/']
+else: _ponydirs = [HOME + '/.local/share/ponysay/ponies/', '/usr/share/ponysay/ponies/']
for ponydir in _ponydirs:
- if os.path.isdir(ponydir):
+ if os.path.isdir(ponydir) and (ponydir not in appendset):
ponydirs.append(ponydir)
+ appendset.add(ponydir)
'''
The directories where pony files are stored, extrattyponies/ are used if the terminal is Linux VT (also known as TTY) and not with KMS
'''
+appendsetset = set()
extraponydirs = []
-if linuxvt and not usekms: _extraponydirs = [d + 'extrattyponies/' for d in sharedirs]
-else: _extraponydirs = [d + 'extraponies/' for d in sharedirs]
+if linuxvt and not usekms: _extraponydirs = [HOME + '/.local/share/ponysay/extrattyponies/', '/usr/share/ponysay/extrattyponies/']
+else: _extraponydirs = [HOME + '/.local/share/ponysay/extraponies/', '/usr/share/ponysay/extraponies/']
for extraponydir in _extraponydirs:
- if os.path.isdir(extraponydir):
+ if os.path.isdir(extraponydir) and (extraponydir not in appendset):
extraponydirs.append(extraponydir)
+ appendset.add(extraponydir)
'''
The directories where quotes files are stored
'''
+appendset = set()
quotedirs = []
-_quotedirs = [d + 'quotes/' for d in sharedirs]
+_quotedirs = [HOME + '/.local/share/ponysay/quotes/', '/usr/share/ponysay/quotes/']
for quotedir in _quotedirs:
- if os.path.isdir(quotedir):
+ if os.path.isdir(quotedir) and (quotedir not in appendset):
quotedirs.append(quotedir)
+ appendset.add(quotedir)
'''
The directories where balloon style files are stored
'''
+appendset = set()
balloondirs = []
-_balloondirs = [d + 'balloons/' for d in sharedirs]
+_balloondirs = [HOME + '/.local/share/ponysay/balloons/', '/usr/share/ponysay/balloons/']
for balloondir in _balloondirs:
- if os.path.isdir(balloondir):
+ if os.path.isdir(balloondir) and (balloondir not in appendset):
balloondirs.append(balloondir)
+ appendset.add(balloondir)
+
+
+'''
+ucsmap files
+'''
+appendset = set()
+ucsmaps = []
+_ucsmaps = [HOME + '/.local/share/ponysay/ucsmap', '/usr/share/ponysay/ucsmap']
+for ucsmap in _ucsmaps:
+ if os.path.isdir(ucsmap) and (ucsmap not in appendset):
+ ucsmaps.append(ucsmap)
+ appendset.add(ucsmap)
+
usage_saythink = '\033[34;1m(ponysay | ponythink)\033[21;39m'
@@ -1713,10 +1725,10 @@ opts.add_argumentless(['++onelist'])
opts.add_argumentless(['-h', '--help'], help = 'Print this help message.')
opts.add_argumentless(['-v', '--version'], help = 'Print the version of the program.')
opts.add_argumentless(['-l', '--list'], help = 'List pony names.')
-opts.add_argumentless(['-L', '--altlist'], help = 'List pony names with alternatives.')
+opts.add_argumentless(['-L', '--symlist', '--altlist'], help = 'List pony names with alternatives.')
opts.add_argumentless(['+l', '++list'], help = 'List non-MLP:FiM pony names.')
-opts.add_argumentless(['+L', '++altlist'], help = 'List non-MLP:FiM pony names with alternatives.')
-opts.add_argumentless(['-B', '--balloonlist'], help = 'List balloon styles.')
+opts.add_argumentless(['+L', '++symlist', '++altlist'], help = 'List non-MLP:FiM pony names with alternatives.')
+opts.add_argumentless(['-B', '--bubblelist', '--balloonlist'], help = 'List balloon styles.')
opts.add_argumentless(['-c', '--compact'], help = 'Compress messages.')
opts.add_argumented( ['-W', '--wrap'], arg = 'COLUMN', help = 'Specify the column when the message should be wrapped.')
opts.add_argumented( ['-b', '--bubble', '--balloon'], arg = 'STYLE', help = 'Select a balloon style.')
diff --git a/ponysay.pdf b/ponysay.pdf
index f90f885..1a6e2b4 100644
--- a/ponysay.pdf
+++ b/ponysay.pdf
Binary files differ
diff --git a/setup.py b/setup.py
new file mode 100755
index 0000000..018dc7a
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,875 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+import os
+import shutil
+import sys
+from subprocess import Popen, PIPE
+
+
+
+PONYSAY_VERSION = '2.5'
+
+
+
+manpages = [('en', 'English'), # must be first
+ ('es', 'Spanish')]
+
+sharedirs = [('ponies', 'xterm ponies', 'PONYDIR'), # must be first
+ ('ttyponies', 'tty ponies', 'TTYPONYDIR'),
+ ('extraponies', 'extra xterm ponies', 'XPONYDIR'),
+ ('extrattyponies', 'extra tty ponies', 'XTTYPONYDIR'),
+ ('quotes', 'pony quotes', 'QUOTEDIR'),
+ ('balloons', 'balloon styles', 'BALLOONDIR')]
+
+sharefiles = [('ucs', 'ucsmap')]
+
+commands = ['ponysay', 'ponythink']
+
+shells = [('bash', '/usr/share/bash-completion/completions/ponysay', 'GNU Bash'),
+ ('fish', '/usr/share/fish/completions/ponysay.fish', 'Friendly interactive shell'),
+ ('zsh', '/usr/share/zsh/site-functions/_ponysay', 'zsh')]
+
+mansections = [('ponysay', '6'),
+ ('cowsay', '1'),
+ ('fortune', '6')]
+
+miscfiles = [('COPYING', '/usr/share/licenses/ponysay/COPYING'),
+ ('CREDITS', '/usr/share/licenses/ponysay/CREDITS')]
+
+
+
+
+COPY = 'copy'
+HARD = 'hard'
+SYMBOLIC = 'symbolic'
+
+class Setup():
+ def __init__(self):
+ usage_script = '\033[34;1msetup.py\033[21;39m'
+ usage_help = '(version | help)'
+ usage_proc = '[\033[4mconfigurations\033[24m] ([build] | prebuilt | install | (uninstall|clean)[-old] | view)'
+
+ usage = '%s %s\n%s %s' % (usage_script, usage_help, usage_script, usage_proc)
+
+ usage = usage.replace('\033[', '\0')
+ for sym in ('[', ']', '(', ')', '|', '...'):
+ usage = usage.replace(sym, '\033[2m' + sym + '\033[22m')
+ usage = usage.replace('\0', '\033[')
+
+ opts = ArgParser(program = 'setup.py',
+ description = 'installer for ponysay',
+ usage = usage)
+
+
+ opts.add_argumentless(alternatives = ['--help'])
+ opts.add_argumentless(alternatives = ['--version'])
+
+ opts.add_argumentless(help = 'Install everything that is not explicity excluded', alternatives = ['--everything', '--with-everything'])
+ opts.add_argumentless(help = 'Install only the essentials\nNote that this can vary depending on version', alternatives = ['--minimal'])
+ opts.add_argumentless(help = 'Install nothing (except legal documents] that is not explicity included', alternatives = ['--nothing', '--with-nothing'])
+
+ for command in commands:
+ opts.add_argumentless(help = 'Do not install the %s command' % (command), alternatives = ['--without-' + command])
+ opts.add_argumented (help = 'Install the %s command, and set file name\nDefualt = /usr/bin/%s' % (command, command), alternatives = ['--with-' + command], arg='EXEC')
+
+ opts.add_argumentless(help = 'Do not install a user shared cache', alternatives = ['--without-shared-cache'])
+ opts.add_argumented (help = 'Install a user shared cache at CACHEDIR\nDefault = /var/cache/ponysay', alternatives = [ '--with-shared-cache'], arg='CACHEDIR')
+
+ for shell in shells:
+ opts.add_argumentless(help = 'Do not install completion for ' + shell[2], alternatives = ['--without-' + shell[0]])
+ opts.add_argumented (help = 'Set file name for the completion for ponysay in' + shell[2], alternatives = [ '--with-' + shell[0]], arg='PONYSAY_%s_FILE' % (shell[0].upper()))
+ opts.add_argumentless(help = 'Only install explicitly included shell completions', alternatives = ['--without-shell'])
+ opts.add_argumented (help = 'Set share/ directory used for shell completions\nDefault = $SHAREDIR', alternatives = [ '--with-shell'], arg='SHAREDIR')
+
+ opts.add_argumentless(help = 'Do not install PDF manual\nDefault', alternatives = ['--without-pdf'])
+ opts.add_argumented (help = 'Set directory for PDF manual\nDefault = $PREFIX/doc', alternatives = [ '--with-pdf'], arg='DOCDIR')
+ opts.add_argumentless(help = 'Do not compress PDF manual\nDefault', alternatives = ['--without-pdf-compression'])
+ opts.add_argumented (help = 'Select compression for PDF manual\nDefault = gz, xz is also recognised', alternatives = [ '--with-pdf-compression'], arg='COMPRESSION')
+ opts.add_argumentless(help = 'Do not install info manual', alternatives = ['--without-info'])
+ opts.add_argumented (help = 'Set directory for info manual\nDefault = $SHARE/info', alternatives = [ '--with-info'], arg='INFODIR')
+ opts.add_argumentless(help = 'Do not use install-info when installing info manual', alternatives = ['--without-info-install'])
+ opts.add_argumented (help = 'Use install-info when installing info manual, and set description\nDefault', alternatives = [ '--with-info-install'], arg='DESCIPTION')
+ opts.add_argumentless(help = 'Do not compress info manual', alternatives = ['--without-info-compression'])
+ opts.add_argumented (help = 'Select compression for info manual\nDefault = gz, xz is also recognised', alternatives = [ '--with-info-compression'], arg='COMPRESSION')
+
+ for man in manpages:
+ opts.add_argumentless(help = 'Do not install %s manpage manual' % (man[1]), alternatives = ['--without-man-' + man[0]])
+ opts.add_argumented (help = 'Set directory for %s manpage\nDefault = $SHARE/man' % (man[1]), alternatives = [ '--with-man-' + man[0]], arg='MANDIR')
+ opts.add_argumentless(help = 'Do not install any manpages', alternatives = ['--without-man'])
+ opts.add_argumented (help = 'Set directory for all man pages\nDefault = $SHARE/man', alternatives = [ '--with-man'], arg='MANDIR')
+ for man in manpages:
+ opts.add_argumentless(help = 'Do not compress %s manpage' % (man[1]), alternatives = ['--without-man-%s-compression' % (man[0])])
+ opts.add_argumented (help = 'Select compression for %s manpage\nDefault = gz, xz is also recognised' % (man[1]),
+ alternatives = [ '--with-man-%s-compression' % (man[0])], arg='COMPRESSION')
+ opts.add_argumentless(help = 'Do not compress any installed manpage', alternatives = ['--without-man-compression'])
+ opts.add_argumented (help = 'Select compression for installed manpages\nDefault = gz, xz is also recognised', alternatives = [ '--with-man-compression'], arg='COMPRESSION')
+
+ for man in mansections:
+ opts.add_argumented (help = 'Change the section for the %s manpage\nDefault = %s' % man, alternatives = ['--man-section-' + man[0]], arg='SECTION')
+
+ for dir in sharedirs:
+ opts.add_argumentless(help = 'Do not install ' + dir[0], alternatives = ['--without-' + dir[0]])
+ opts.add_argumented (help = 'Set directory for %s\nDefault = $SHAREDIR/ponysay/%s' % (dir[1], dir[0]), alternatives = [ '--with-' + dir[0]], arg=dir[2])
+ opts.add_argumentless(help = 'Do not install UCS pony name map', alternatives = ['--without-ucs'])
+ opts.add_argumented (help = 'Set file for the UCS pony name map\nDefault = $SHAREDIR/ponysay/ucsmap', alternatives = [ '--with-ucs'], arg='UCSFILE')
+
+ opts.add_argumentless(help = 'Let the installer set the env name for python in ponysay\nDefault', alternatives = ['--without-custom-env-python'])
+ opts.add_argumented (help = 'Set the env name for python in ponysay', alternatives = ['--with-custom-env-python'], arg='PYTHON')
+ opts.add_argumented (help = 'Set a prefix to all implicit directories\nDefault = /usr', alternatives = ['--prefix'], arg='PREFIX')
+ opts.add_argumentless(help = 'Change all implicit configurations to fit local user a installation for the current user', alternatives = ['--private'])
+ opts.add_argumentless(help = 'Change all implicit directories to fit installation to /opt', alternatives = ['--opt'])
+ opts.add_argumented (help = 'Set the system\'s directory for command executables\nDefault = $PREFIX/bin', alternatives = ['--bin-dir'], arg='BINDIR')
+ opts.add_argumented (help = 'Set the system\'s directory for non-command executables\nDefault = $PREFIX/lib\nNot used.', alternatives = ['--lib-dir'], arg='LIBDIR')
+ opts.add_argumented (help = 'Set the system\'s directory for resource files\nDefault = $PREFIX/share', alternatives = ['--share-dir'], arg='SHAREDIR')
+ opts.add_argumented (help = 'Set the system\'s directory for cache directories\nDefault = /var/cache', alternatives = ['--cache-dir'], arg='CACHEDIR')
+
+ opts.add_argumented (help = 'Set off environment for installation\nEmpty by default', alternatives = ['--dest-dir'], arg='DESTDIR')
+
+ opts.add_argumented (help = 'Set how to link identical files\nDefault = hard, copy and symbolic are also recognised', alternatives = ['--linking'], arg='TYPE')
+
+
+ opts.parse()
+
+
+ self.linking = HARD
+ if opts.opts['--linking'] is not None:
+ self.linking = opts.opts['--linking'][0]
+
+
+ if (len(opts.files) > 1) or (opts.opts['--help'] is not None) or ((len(opts.files) == 1) and (opts.files[0] == 'help')):
+ opts.help()
+ elif (opts.opts['--version'] is not None) or ((len(opts.files) == 1) and (opts.files[0] == 'version')):
+ print('Ponysay %s installer' % (PONYSAY_VERSION))
+ else:
+ if len(opts.files) == 0:
+ opts.files = ['build']
+ method = opts.files[0]
+ if method == 'clean': self.clean()
+ elif method == 'clean-old': self.cleanOld()
+ else:
+ conf = self.configure(opts.opts)
+ self.viewconf(conf)
+ if method == 'build': self.build (conf)
+ elif method == 'prebuilt': self.install (conf)
+ elif method == 'install': self.build (conf); self.install(conf); self.clean()
+ elif method == 'uninstall': self.uninstall (conf)
+ elif method == 'uninstall-old': self.uninstallOld(conf)
+ elif not method == 'view':
+ opts.help()
+
+
+ '''
+ Display configurations
+ '''
+ def viewconf(self, conf):
+ RED = '\033[31m%s\033[39m'
+ GREEN = '%s\033[32m%s\033[39m'
+ YELLOW = '\033[33m%s\033[39m'
+
+ for command in commands:
+ if conf[command] is not None: print(GREEN % ('Installing command ' + command + ' as ', conf[command]))
+ else: print(RED % ('Skipping installion of command ' + command))
+ if conf['shared-cache'] is not None: print(GREEN % ('Installing shared cache at ', conf['shared-cache']))
+ else: print(RED % ('Skipping installation of shared cache'))
+ for shell in [item[0] for item in shells]:
+ if conf[shell] is not None: print(GREEN % ('Installing auto-completion for ' + shell + ' as ', conf[shell]))
+ else: print(RED % ('Skipping installation of auto-completion for ' + shell))
+ if conf['pdf'] is not None: print(GREEN % ('Installing PDF manual to ', conf['pdf']))
+ else: print(RED % ('Skipping installation of PDF manual'))
+ if conf['pdf-compression'] is not None: print(GREEN % ('Compressing PDF manual with ', conf['pdf-compression']))
+ else: print(RED % ('Skipping compression of PDF manual'))
+ if conf['info'] is not None: print(GREEN % ('Installing info manual to ', conf['info']))
+ else: print(RED % ('Skipping installation of info manual'))
+ if conf['info-install'] is not None: print(GREEN % ('Installing info manual with install-info with description: ', conf['info-install']))
+ else: print(RED % ('Skipping installation of info manual with install-info'))
+ if conf['info-compression'] is not None: print(GREEN % ('Compressing info manual with ', conf['info-compression']))
+ else: print(RED % ('Skipping compression of info manual'))
+ for man in manpages:
+ key = 'man-' + man[0]
+ if conf[key] is not None: print(GREEN % ('Installing ' + man[1] + ' manpage to ', conf[key]))
+ else: print(RED % ('Skipping installation of ' + man[1] + ' manpage'))
+ key += '-compression'
+ if conf[key] is not None: print(GREEN % ('Compressing ' + man[1] + ' manpage with ', conf[key]))
+ else: print(RED % ('Skipping compression of ' + man[1] + ' manpage'))
+ for man in mansections: print(GREEN % ('References to manpage for ' + man[0] + ' points to section ', conf['man-section-' + man[0]]))
+ for dir in sharedirs:
+ if conf[dir[0]] is not None: print(GREEN % ('Installing ' + dir[1] + ' to ', conf[dir[0]]))
+ else: print(RED % ('Skipping installation of ' + dir[1]))
+ for file in sharefiles:
+ if conf[file[0]] is not None: print(GREEN % ('Installing ' + file[1] + ' as ', conf[file[0]]))
+ else: print(RED % ('Skipping installation of ' + file[1]))
+ if conf['custom-env-python'] is not None: print(GREEN % ('Using custom env reference in python script shebang: ', conf['custom-env-python']))
+ else: print(YELLOW % ('Looking for best env reference in python script shebang'))
+ for miscfile in miscfiles: print(GREEN % ('Installing ' + miscfile[0] + ' to ', conf[miscfile[0]]))
+
+ print()
+
+
+ '''
+ Compile ponysay
+ '''
+ def build(self, conf):
+ print('\033[1;34m::\033[39mCompiling...\033[21m')
+
+ def compressCommand(ext):
+ if ext == 'gz': return 'gzip -9 -f'
+ if ext == 'xz': return 'xz -9e -f'
+
+ def compress(source, destination, ext):
+ print('%s < %s > %s' % (compressCommand(ext), source, destination))
+ (fileout, filein) = (None, None)
+ try:
+ fileout = open(destination, 'w+')
+ filein = open(source, 'r')
+ Popen(compressCommand(ext).split(' '), stdout=fileout, stdin=filein).communicate()
+ finally:
+ if fileout is not None: fileout.close()
+ if filein is not None: filein .close()
+
+ env = conf['custom-env-python']
+ if env is None:
+ (out, err) = Popen(['env', 'python', '--version'], stdout=PIPE, stderr=PIPE).communicate()
+ out = out.decode('utf8', 'replace') + err.decode('utf8', 'replace')
+ out = out.replace('\n', '')
+ env = out.split(' ')[1].split('.')[0]
+ if int(env) < 3: env = 'python3'
+ else: env = 'python'
+ mane = False
+ for command in commands:
+ if conf[command] is not None:
+ mane = True
+ break
+ if mane:
+ (fileout, filein) = (None, None)
+ try:
+ fileout = open('ponysay.install', 'w+')
+ filein = open('ponysay', 'r')
+ data = ''.join(filein.readlines())
+
+ data = data.replace('#!/usr/bin/env python', '#!/usr/bin/env ' + env)
+ for sharedir in [item[0] for item in sharedirs]:
+ data = data.replace('/usr/share/ponysay/' + sharedir, conf[sharedir])
+ for sharefile in sharefiles:
+ data = data.replace('/usr/share/ponysay/' + sharefile[1], conf[sharefile[0]])
+ data = data.replace('\nVERSION = \'dev\'', '\nVERSION = \'%s\'' % (PONYSAY_VERSION))
+
+ fileout.write(data)
+ finally:
+ if fileout is not None: fileout.close()
+ if filein is not None: filein .close()
+
+ for man in manpages:
+ key = 'man-' + man[0]
+ section = conf['man-section-ponysay']
+ if man is manpages[0]: lang = ''
+ else: lang = '.' + man[0]
+ if conf[key] is not None:
+ src = 'manuals/manpage' + lang + '.0'
+ dest = src + '.install'
+ (fileout, filein) = (None, None)
+ try:
+ fileout = open(dest, 'w+')
+ filein = open(src, 'r')
+ data = ''.join(filein.readlines())
+
+ data = data.replace('\n.TH PONYSAY 0', '\n.TH PONYSAY ' + conf['man-section-ponysay'])
+ for section in [item[0] for item in mansections]:
+ data = data.replace('\n.BR %s (0)' % (section), '\n.BR %s (%s)' % (section, conf['man-section-' + section]))
+
+ fileout.write(data)
+ finally:
+ if fileout is not None: fileout.close()
+ if filein is not None: filein .close()
+ src = dest
+ ext = conf[key + '-compression']
+ if ext is not None:
+ dest = 'manuals/manpage' + lang + '.0.' + ext
+ compress(src, dest, ext)
+
+ if conf['info'] is not None:
+ print('makeinfo manuals/ponysay.texinfo')
+ os.system('makeinfo manuals/ponysay.texinfo')
+ ext = conf['info-compression']
+ if ext is not None:
+ compress('ponysay.info', 'ponysay.info.' + ext, ext)
+
+ if conf['pdf-compression'] is not None:
+ ext = conf['pdf-compression']
+ if ext is not None:
+ compress('ponysay.pdf', 'ponysay.pdf.' + ext, ext)
+
+ for shell in [item[0] for item in shells]:
+ if conf[shell] is not None:
+ src = 'completion/%s-completion.%s' % (shell, 'sh' if shell == 'bash' else shell)
+ for command in commands:
+ if conf[command] is not None:
+ dest = src + '.' + command
+ (fileout, filein) = (None, None)
+ try:
+ fileout = open(dest, 'w+')
+ filein = open(src, 'r')
+ data = ''.join(filein.readlines())
+
+ data = data.replace('/usr/bin/ponysay', conf[command])
+ data = data.replace('/ponysay', '\0')
+ data = data.replace('ponysay', command)
+ for sharedir in [item[0] for item in sharedirs]:
+ data = data.replace('/usr/share/ponysay/' + sharedir, conf[sharedir])
+ data = data.replace('\0', '/ponysay')
+
+ fileout.write(data)
+ finally:
+ if fileout is not None: fileout.close()
+ if filein is not None: filein .close()
+
+ if conf['quotes'] is not None:
+ self.removeLists([], ['quotes'])
+ os.mkdir('quotes')
+ ponymap = None
+ try:
+ ponymap = open('ponyquotes/ponies', 'r')
+ ponies = [line.replace('\n', '') for line in ponymap.readlines()]
+ for _ponies in ponies:
+ for pony in _ponies.split('+'):
+ print('Generating quote files for \033[34m' + pony + '\033[39m')
+ for file in os.listdir('ponyquotes'):
+ if file.startswith(pony + '.'):
+ if os.path.isfile('ponyquotes/' + file):
+ shutil.copy('ponyquotes/' + file, 'quotes/' + _ponies + file[file.find('.'):])
+ finally:
+ if ponymap is not None:
+ ponymap.close()
+ print()
+
+
+ '''
+ Install compiled ponysay
+ '''
+ def install(self, conf):
+ print('\033[1;34m::\033[39mInstalling...\033[21m')
+
+ for command in commands:
+ dests = []
+ if conf[command] is not None:
+ dests.append(conf[command])
+ if len(dests) > 0:
+ self.cp(False, 'ponysay.install', dests)
+ print('Setting mode for ponysay.install copies to 755')
+ if self.linking == COPY:
+ for dest in dests:
+ os.chmod(dest, 0o755)
+ else:
+ os.chmod(dests[0], 0o755)
+ if conf['shared-cache'] is not None:
+ dir = conf['shared-cache']
+ if not os.path.exists(dir):
+ pdir = dir[:dir.rfind('/') + 1]
+ if not os.path.exists(pdir):
+ print('Creating intermediate-level directories needed for ' + dir)
+ os.makedirs(pdir)
+ print('Creating directory ' + dir + ' with mode mask 777')
+ os.mkdir(dir, 0o777)
+ for shell in [item[0] for item in shells]:
+ if conf[shell] is not None:
+ for command in commands:
+ if conf[command] is not None:
+ src = 'completion/%s-completion.%s.%s' % (shell, 'sh' if shell == 'bash' else shell, command)
+ dest = conf[shell].replace('ponysay', command)
+ self.cp(False, src, [dest])
+ if conf['pdf'] is not None:
+ src = 'ponysay.pdf' + ('' if conf['pdf-compression'] is None else '.' + conf['pdf-compression'])
+ dest = conf['pdf'] + '/' + src
+ self.cp(False, src, [dest])
+ if conf['info'] is not None:
+ installinfo = []
+ dests = []
+ ext = ('' if conf['info-compression'] is None else '.' + conf['info-compression'])
+ src = 'ponysay.info' + ext
+ for command in commands:
+ if conf[command] is not None:
+ dests.append(conf['info'] + '/' + command + '.info' + ext)
+ if conf['info-install'] is not None:
+ cmdarr = ['install-info', '--entry=Miscellaneous', '--description=' + conf['info-install'], '--dir-file=' + conf['info'] + '/dir', dest]
+ cmd = ' '.join(['\'%s\'' % (elem.replace('\'', '\'\\\'\'')) for elem in cmdarr])
+ installinfo.append((cmd, 'Installing info manual ' + dest + ' with install-info'))
+ self.cp(False, src, dests)
+ for pair in installinfo:
+ print(pair[1])
+ os.system(pair[0])
+ for man in manpages:
+ key = 'man-' + man[0]
+ section = conf['man-section-ponysay']
+ if man is manpages[0]: sub = 'man' + section
+ else: sub = man[0] + '/man' + section
+ if man is manpages[0]: lang = ''
+ else: lang = '.' + man[0]
+ if conf[key] is not None:
+ src = 'manuals/manpage' + lang + '.0.' + ('install' if conf[key + '-compression'] is None else conf[key + '-compression'])
+ dests = []
+ for command in commands:
+ if conf[command] is not None:
+ dest = '%s/%s/%s.%s%s' % (conf[key], sub, command, section, '' if conf[key + '-compression'] is None else '.' + conf[key + '-compression'])
+ dests.append(dest)
+ self.cp(False, src, dests)
+ for dir in sharedirs:
+ if conf[dir[0]] is not None:
+ self.cp(True, dir[0], [conf[dir[0]]])
+ for file in sharefiles:
+ if conf[file[0]] is not None:
+ self.cp(False, 'share/' + file[1], [conf[file[0]]])
+ for file in miscfiles:
+ self.cp(False, file[0], [conf[file[0]]])
+ print()
+
+
+ '''
+ Uninstall ponysay
+ '''
+ def uninstall(self, conf):
+ print('\033[1;34m::\033[39mUninstalling...\033[21m')
+
+ (files, dirs, infos) = ([], [], [])
+
+ for command in commands:
+ if conf[command] is not None:
+ files.append(conf[command])
+ if conf['shared-cache'] is not None:
+ dirs.append(conf['shared-cache'])
+ for shell in [item[0] for item in shells]:
+ if conf[shell] is not None:
+ for command in commands:
+ if conf[command] is not None:
+ files.append(conf[shell].replace('ponysay', command))
+ if conf['pdf'] is not None:
+ files.append(conf['pdf'] + '/ponysay.pdf' + ('' if conf['pdf-compression'] is None else '.' + conf['pdf-compression']))
+ if conf['info'] is not None:
+ for command in commands:
+ if conf[command] is not None:
+ file = conf['info'] + '/' + command + '.info' + ('' if conf['info-compression'] is None else '.' + conf['info-compression'])
+ files.append(file)
+ if conf['info-install'] is not None:
+ infos.append(file)
+ for man in [item[0] for item in manpages]:
+ key = 'man-' + man
+ section = conf['man-section-ponysay']
+ if man is manpages[0]: sub = 'man' + section
+ else: sub = man[0] + '/man' + section
+ if conf[key] is not None:
+ for command in commands:
+ if conf[command] is not None:
+ files.append('%s/%s/%s.%s%s' % (conf[key], sub, command, section, '' if conf[key + '-compression'] is None else '.' + conf[key + '-compression']))
+ for dir in sharedirs:
+ if conf[dir[0]] is not None:
+ dirs.append(conf[dir[0]])
+ for file in sharefiles:
+ if conf[file[0]] is not None:
+ files.append(conf[file[0]])
+ for file in miscfiles:
+ files.append(conf[file[0]])
+
+ for info in infos:
+ cmdarr = ['install-info', '--delete', '--dir-file=' + conf['info'] + '/dir', info]
+ cmd = ' '.join(['\'%s\'' % (elem.replace('\'', '\'\\\'\'')) for elem in cmdarr])
+ print('Uninstalling info manual ' + info + ' with install-info')
+ os.system(cmd)
+
+ self.removeLists(files, dirs)
+ print()
+
+
+ '''
+ Uninstall file ponysay no longer uses
+ '''
+ def uninstallOld(self, conf):
+ print('\033[1;34m::\033[39mUninstalling old files...\033[21m')
+
+ instdir = conf['~prefix~'] + '/usr'
+ files = [instdir + f for f in ['bin/ponysaylist.pl', 'bin/ponysaytruncater', 'bin/ponysay.py', 'bin/ponythink.py']]
+ dirs = [instdir + d for d in ['lib/ponysay', 'share/ponies', 'share/ttyponies']]
+ #$(instdir)/lib/ponysay/truncater
+ #$(instdir)/lib/ponysay/list.pl
+ #$(instdir)/lib/ponysay/linklist.pl
+ #$(instdir)/lib/ponysay/pq4ps
+ #$(instdir)/lib/ponysay/pq4ps.pl
+ #$(instdir)/lib/ponysay/pq4ps-list
+ #$(instdir)/lib/ponysay/pq4ps-list.pl
+
+ self.removeLists(files, dirs)
+ print()
+
+
+ '''
+ Remove compiled files
+ '''
+ def clean(self):
+ print('\033[1;34m::\033[39mCleaning...\033[21m')
+
+ files = ['ponysay.info', 'ponysay.info.gz', 'ponysay.info.xz', 'ponysay.install']
+ dirs = ['quotes']
+ for comp in ['install', 'gz', 'xz']:
+ for man in manpages:
+ if man is manpages[0]: man = ''
+ else: man = '.' + man[0]
+ files.append('manuals/manpage' + man + '.0.' + comp)
+ for shell in [item[0] for item in shells]:
+ for command in commands:
+ files.append('completion/%s-completion.%s.%s' % (shell, 'sh' if shell == 'bash' else shell, command))
+
+ self.removeLists(files, dirs)
+ print()
+
+
+ '''
+ Remove compiled files ponysay is no longer compiling
+ '''
+ def cleanOld(self):
+ print('\033[1;34m::\033[39mCleaning old files...\033[21m')
+
+ files = ['truncater', 'ponysaytruncater', 'ponysay.py.install', 'ponysay.install~']
+ dirs = []
+ for shell in [item[0] for item in shells]:
+ files.append('completion/%s-completion.%s.install' % (shell, 'sh' if shell == 'bash' else shell))
+ files.append('completion/%s-completion-think.%s' % (shell, 'sh' if shell == 'bash' else shell))
+
+ self.removeLists(files, dirs)
+ print()
+
+
+ '''
+ Removes listed files and directories
+ '''
+ def removeLists(self, files, dirs):
+ for file in files:
+ if os.path.isfile(file) or os.path.islink(file):
+ print('Unlinking file %s' % (file))
+ os.unlink(file)
+ dir = file
+ while True:
+ dir = dir[:dir.rfind('/')]
+ if ('/ponysay/' in (dir + '/')) and (len(os.listdir(dir)) == 0):
+ print('Removing newly empty directory %s' % (dir))
+ os.rmdir(dir)
+ else:
+ break;
+ for dir in dirs:
+ if os.path.isdir(dir) or os.path.islink(dir):
+ print('Cascadingly removing directory %s' % (dir))
+ if os.path.islink(dir): os.unlink(dir)
+ else: shutil.rmtree(dir)
+ while True:
+ dir = dir[:dir.rfind('/')]
+ if ('/ponysay/' in (dir + '/')) and (len(os.listdir(dir)) == 0):
+ print('Removing newly empty directory %s' % (dir))
+ os.rmdir(dir)
+ else:
+ break;
+
+
+ '''
+ Copys a files or directory to multiple destinations
+ '''
+ def cp(self, recursive, source, destinations):
+ for dest in destinations:
+ dir = dest[:dest.rfind('/') + 1]
+ if not os.path.exists(dir):
+ print('Making directory ' + dir + ' with parents')
+ os.makedirs(dir)
+ if recursive:
+ target = destinations[0]
+ for dest in destinations if self.linking == COPY else [target]:
+ print('Copying directory %s to %s' % (source, dest))
+ if not os.path.exists(dest):
+ os.mkdir(dest)
+ for file in os.listdir(source):
+ src = source + '/' + file
+ self.cp(os.path.isdir(src), src, [dest + '/' + file])
+ if self.linking != COPY:
+ for dest in destinations[1:]:
+ print('Creating symbolic link %s with target directory %s' % (dest, target))
+ if os.path.exists(dest):
+ os.removeLists([], [dest])
+ os.symlink(target, dest)
+ else:
+ target = destinations[0]
+ for dest in destinations if self.linking == COPY else [target]:
+ print('Copying file %s to %s' % (source, dest))
+ shutil.copyfile(source, dest)
+ if self.linking == HARD:
+ for dest in destinations[1:]:
+ print('Creating hard link %s with target file %s' % (dest, target))
+ if os.path.exists(dest):
+ os.unlink(dest)
+ os.link(target, dest)
+ elif self.linking == SYMBOLIC:
+ for dest in destinations[1:]:
+ print('Creating symbolic link %s with target file %s' % (dest, target))
+ if os.path.exists(dest):
+ os.unlink(dest)
+ os.symlink(target, dest)
+
+
+ '''
+ Parses configurations
+ '''
+ def configure(self, opts):
+ (defaults, conf) = ({}, {})
+
+ for command in commands:
+ conf[command] = '/usr/bin/' + command
+ conf['shared-cache'] = '/var/cache/ponysay'
+ for shell in shells:
+ conf[shell[0]] = shell[1]
+ conf['pdf'] = '/usr/doc'
+ conf['pdf-compression'] = 'gz'
+ conf['info'] = '/usr/share/info'
+ conf['info-install'] = 'My Little Ponies for your terminal'
+ conf['info-compression'] = 'gz'
+ for manpage in manpages:
+ conf['man-' + manpage[0]] = '/usr/share/man'
+ conf['man-' + manpage[0] + '-compression'] = 'gz'
+ for sharedir in sharedirs:
+ conf[sharedir[0]] = '/usr/share/ponysay/' + sharedir[0]
+ for sharefile in sharefiles:
+ conf[sharefile[0]] = '/usr/share/ponysay/' + sharefile[1]
+ conf['custom-env-python'] = 'python3'
+ for miscfile in miscfiles:
+ conf[miscfile[0]] = miscfile[1]
+
+
+ if opts['--private'] is not None:
+ if opts['--prefix'] is None:
+ opts['--prefix'] = [os.environ['HOME'] + '/.local']
+
+ prefix = '/usr'
+ if opts['--prefix'] is not None:
+ prefix = opts['--prefix'][0]
+ for key in conf:
+ if conf[key] not in (None, False, True):
+ if conf[key].startswith('/usr'):
+ conf[key] = prefix + conf[key][4:]
+ conf['~prefix~'] = prefix
+
+ if opts['--opt'] is not None:
+ if opts['--bin-dir'] is None: opts['--bin-dir'] = ['/opt/ponysay/bin']
+ if opts['--lib-dir'] is None: opts['--lib-dir'] = ['/opt/ponysay/lib']
+ if opts['--share-dir'] is None: opts['--share-dir'] = ['/usr/share']
+ if opts['--with-shared-cache'] is None: opts['--with-shared-cache'] = ['/var/opt/ponysay/cache']
+ for sharedir in sharedirs:
+ conf[sharedir[0]] = '/opt/ponysay/share/' + sharedir[0]
+ for sharefile in sharefiles:
+ conf[sharefile[0]] = '/opt/ponysay/share/' + sharefile[1]
+
+ for dir in ['bin', 'lib', 'share']:
+ if opts['--' + dir + '-dir'] is not None:
+ d = opts['--' + dir + '-dir'][0]
+ for key in conf:
+ if conf[key] not in [None, True, False]:
+ if conf[key].startswith(prefix + '/' + dir):
+ conf[key] = d + conf[key][5 + len(dir):]
+ if opts['--cache-dir'] is not None:
+ dir = opts['--cache-dir'][0]
+ for key in conf:
+ if conf[key] not in (None, False, True):
+ if conf[key].startswith('/var/cache'):
+ conf[key] = dir + conf[key][10:]
+
+
+ for key in conf:
+ defaults[key] = conf[key]
+
+
+ if opts['--nothing'] is not None:
+ opts['--minimal'] = opts['--nothing']
+
+ for key in ['custom-env-python']:
+ conf[key] = None
+
+
+ if opts['--everything'] is None:
+ for key in ['pdf', 'pdf-compression']:
+ conf[key] = None
+
+ nomanen = opts['--minimal'] is not None
+ for manpage in manpages:
+ if (manpage is not manpages[0]) or nomanen:
+ for key in ['man-' + manpage[0]]:
+ conf[key] = None
+
+ if (opts['--private'] is not None) or (opts['--minimal'] is not None):
+ for key in ['info-install', 'shared-cache']:
+ conf[key] = None
+
+ if opts['--minimal'] is not None:
+ for key in ['info'] + [item[0] for item in shells]:
+ conf[key] = None
+ for sharedir in sharedirs:
+ if sharedir is not sharedirs[0]:
+ conf[sharedir[0]] = None
+ for sharefile in sharefiles:
+ conf[sharefile[0]] = None
+
+ if opts['--nothing'] is not None:
+ for command in commands:
+ conf[command] = None
+ conf[sharedirs[0][0]] = None
+
+
+ for coll in [['shell', '/usr/share', [item[0] for item in shells]],
+ ['man', '/usr/share/man', ['man-' + item[0] for item in manpages]],
+ ['man-compression', 'gz', ['man-' + item[0] + '-compression' for item in manpages]]
+ ]:
+ if opts['--without-' + coll[0]] is not None:
+ for item in coll[2]:
+ conf[item] = None
+ if opts['--with-' + coll[0]] is not None:
+ for item in coll[2]:
+ defaults[item] = conf[item] = defaults[item].replace(coll[1], coll[1] if opts['--with-' + coll[0]][0] is None else opts['--with-' + coll[0]][0]);
+
+
+ for key in conf:
+ if '--with-' + key not in opts:
+ continue
+ if opts['--with-' + key] is not None:
+ if defaults[key] in (False, True):
+ conf[key] = True
+ else:
+ conf[key] = defaults[key] if opts['--with-' + key][0] is None else opts['--with-' + key][0]
+ if opts['--without-' + key] is not None:
+ conf[key] = False if defaults[key] in (False, True) else None
+
+ for mansection in mansections:
+ if opts['--man-section-' + mansection[0]] is not None:
+ conf['man-section-' + mansection[0]] = opts['--man-section-' + mansection[0]][0]
+ else:
+ conf['man-section-' + mansection[0]] = mansection[1]
+
+
+ if opts['--dest-dir'] is not None:
+ destdir = opts['--dest-dir'][0]
+ for key in conf:
+ if conf[key] not in (None, False, True):
+ if conf.startswith('/'):
+ conf[key] = destdir + conf[key]
+
+ return conf
+
+
+
+ARGUMENTLESS = 0
+ARGUMENTED = 1
+'''
+Simple argument parser, a strip down of the one in ponysay and slitly modified
+'''
+class ArgParser():
+ '''
+ Constructor.
+ The short description is printed on same line as the program name
+ '''
+ def __init__(self, program, description, usage, longdescription = None):
+ self.__program = program
+ self.__description = description
+ self.__usage = usage
+ self.__longdescription = longdescription
+ self.__arguments = []
+ (self.opts, self.optmap) = ({}, {})
+
+ '''
+ Add option that takes no arguments
+ '''
+ def add_argumentless(self, alternatives, help = None):
+ ARGUMENTLESS
+ self.__arguments.append((ARGUMENTLESS, alternatives, None, help))
+ (stdalt, self.opts[stdalt]) = (alternatives[0], None)
+ for alt in alternatives: self.optmap[alt] = (stdalt, ARGUMENTLESS)
+
+ '''
+ Add option that takes one argument
+ '''
+ def add_argumented(self, alternatives, arg, help = None):
+ self.__arguments.append((ARGUMENTED, alternatives, arg, help))
+ (stdalt, self.opts[stdalt]) = (alternatives[0], None)
+ for alt in alternatives: self.optmap[alt] = (stdalt, ARGUMENTED)
+
+ '''
+ Parse arguments
+ '''
+ def parse(self, argv = sys.argv):
+ self.argcount = len(argv) - 1
+ self.files = []
+ (argqueue, optqueue, get) = ([], [], False)
+
+ for arg in argv[1:]:
+ if get:
+ get = False
+ if (arg is argv[-1]) or ((len(arg) > 2) and (arg[:2] in ('--', '++'))):
+ argqueue.append(None)
+ else:
+ argqueue.append(arg)
+ continue
+ if (len(arg) > 2) and (arg[:2] in ('--', '++')):
+ if (arg in self.optmap) and (self.optmap[arg][1] == ARGUMENTLESS):
+ optqueue.append(arg)
+ argqueue.append(None)
+ elif '=' in arg:
+ arg_opt = arg[:arg.index('=')]
+ if (arg_opt in self.optmap) and (self.optmap[arg_opt][1] == ARGUMENTED):
+ optqueue.append(arg_opt)
+ argqueue.append(arg[arg.index('=') + 1:])
+ else:
+ sys.stderr.write('%s: fatal: unrecognised option %s. see --help or the manual\n' % (self.__program, arg))
+ exit(-1)
+ elif (arg in self.optmap) and (self.optmap[arg][1] == ARGUMENTED):
+ optqueue.append(arg)
+ get = True
+ else:
+ sys.stderr.write('%s: fatal: unrecognised option %s. see --help or the manual\n' % (self.__program, arg))
+ exit(-1)
+ else:
+ self.files.append(arg)
+
+ (i, n) = (0, len(optqueue))
+ if len(argqueue) < n:
+ argqueue.append(None)
+ while i < n:
+ (opt, arg, i) = (optqueue[i], argqueue[i], i + 1)
+ opt = self.optmap[opt][0]
+ if (opt not in self.opts) or (self.opts[opt] is None):
+ self.opts[opt] = []
+ self.opts[opt].append(arg)
+
+ '''
+ Prints a colourful help message
+ '''
+ def help(self):
+ print('\033[1m%s\033[21m - %s\n' % (self.__program, self.__description))
+ if self.__longdescription is not None:
+ print(self.__longdescription)
+ print()
+ print('\n\033[1mUSAGE:\033[21m', end='')
+ first = True
+ for line in self.__usage.split('\n'):
+ if first: first = False
+ else: print(' or', end='')
+ print('\t%s' % (line))
+ print('\n\033[1mCONFIGURATIONS:\033[21m\n')
+ for opt in self.__arguments:
+ (opt_type, opt_alts, opt_arg, opt_help) = opt[0:4]
+ if opt_help is not None:
+ for opt_alt in opt_alts:
+ if opt_alt is opt_alts[-1]:
+ print('\t%s \033[4m%s\033[24m' % (opt_alt, opt_arg) if opt_type == ARGUMENTED else '\t' + opt_alt)
+ else:
+ print('\t\033[2m' + opt_alt + '\033[22m')
+ first = True
+ for line in opt_help.split('\n'):
+ print(('\t\t\033[32;1m%s\033[21;39m' if first else '\t\t%s') % (line))
+ first = False
+ print()
+ print()
+
+
+
+if __name__ == '__main__':
+ Setup()
+