aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile57
-rw-r--r--README.md22
-rw-r--r--completion/bash-completion.sh24
-rw-r--r--completion/fish-completion.fish31
-rwxr-xr-xlinklist.pl35
-rwxr-xr-xlist.pl41
-rwxr-xr-xponysay297
-rwxr-xr-xponysay.py510
-rwxr-xr-xpq4ps39
-rwxr-xr-xpq4ps-list.pl24
-rwxr-xr-xpq4ps.pl26
11 files changed, 578 insertions, 528 deletions
diff --git a/Makefile b/Makefile
index 0095614..8e9d426 100644
--- a/Makefile
+++ b/Makefile
@@ -1,8 +1,11 @@
PREFIX="/usr"
INSTALLDIR="$(DESTDIR)$(PREFIX)"
+SED_PREFIX=$$(sed -e 's/\//\\\//g' <<<$(PREFIX))
+all: core truncater manpages infomanual ponythinkcompletion
-all: truncater manpages infomanual ponythinkcompletion
+core:
+ sed -e 's/'\''\/usr\//'\'"$(SED_PREFIX)"'\//g' <"ponysay.py" >"ponysay.py.install"
truncater:
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o "truncater" "truncater.c"
@@ -16,16 +19,16 @@ infomanual:
gzip -9 -f "ponysay.info"
ponysaycompletion:
- sed -e 's/\/usr\//'"$$(sed -e 's/\//\\\//g' <<<$(PREFIX))"'\//g' <"completion/bash-completion.sh" >"completion/bash-completion.sh.install"
- sed -e 's/\/usr\//'"$$(sed -e 's/\//\\\//g' <<<$(PREFIX))"'\//g' <"completion/fish-completion.fish" >"completion/fish-completion.fish.install"
- sed -e 's/\/usr\//'"$$(sed -e 's/\//\\\//g' <<<$(PREFIX))"'\//g' <"completion/zsh-completion.zsh" >"completion/zsh-completion.zsh.install"
+ sed -e 's/'\''\/usr\//'\'"$(SED_PREFIX)"'\//g' <"completion/bash-completion.sh" >"completion/bash-completion.sh.install"
+ sed -e 's/'\''\/usr\//'\'"$(SED_PREFIX)"'\//g' <"completion/fish-completion.fish" >"completion/fish-completion.fish.install"
+ sed -e 's/'\''\/usr\//'\'"$(SED_PREFIX)"'\//g' <"completion/zsh-completion.zsh" >"completion/zsh-completion.zsh.install"
ponythinkcompletion: ponysaycompletion
sed -e 's/ponysay/ponythink/g' <"completion/bash-completion.sh.install" | sed -e 's/\/ponythink\//\/ponysay\//g' -e 's/\\\/ponythink\\\//\\\/ponysay\\\//g' >"completion/bash-completion-think.sh"
sed -e 's/ponysay/ponythink/g' <"completion/fish-completion.fish.install" | sed -e 's/\/ponythink\//\/ponysay\//g' -e 's/\\\/ponythink\\\//\\\/ponysay\\\//g' >"completion/fish-completion-think.fish"
sed -e 's/ponysay/ponythink/g' <"completion/zsh-completion.zsh.install" | sed -e 's/\/ponythink\//\/ponysay\//g' -e 's/\\\/ponythink\\\//\\\/ponysay\\\//g' >"completion/zsh-completion-think.zsh"
-install-min: truncater
+install-min: core truncater
mkdir -p "$(INSTALLDIR)/share/ponysay/"
mkdir -p "$(INSTALLDIR)/share/ponysay/ponies"
mkdir -p "$(INSTALLDIR)/share/ponysay/ttyponies"
@@ -34,17 +37,14 @@ install-min: truncater
cp -P ttyponies/*.pony "$(INSTALLDIR)/share/ponysay/ttyponies/"
cp -P quotes/*.* "$(INSTALLDIR)/share/ponysay/quotes/"
- mkdir -p "$(INSTALLDIR)/bin/"
- install "ponysay" "$(INSTALLDIR)/bin/ponysay"
- ln -sf "ponysay" "$(INSTALLDIR)/bin/ponythink"
+ mkdir -p "$(INSTALLDIR)/bin/"
+ install "ponysay" "$(INSTALLDIR)/bin/ponysay"
+ install "ponysay.py" "$(INSTALLDIR)/bin/ponysay.py"
+ ln -sf "ponysay" "$(INSTALLDIR)/bin/ponythink"
+ ln -sf "ponysay.py" "$(INSTALLDIR)/bin/ponythink.py"
- mkdir -p "$(INSTALLDIR)/lib/ponysay/"
- install -s "truncater" "$(INSTALLDIR)/lib/ponysay/truncater"
- install "list.pl" "$(INSTALLDIR)/lib/ponysay/list.pl"
- install "linklist.pl" "$(INSTALLDIR)/lib/ponysay/linklist.pl"
- install "pq4ps" "$(INSTALLDIR)/lib/ponysay/pq4ps"
- install "pq4ps.pl" "$(INSTALLDIR)/lib/ponysay/pq4ps.pl"
- install "pq4ps-list.pl" "$(INSTALLDIR)/lib/ponysay/pq4ps-list.pl"
+ mkdir -p "$(INSTALLDIR)/lib/ponysay/"
+ install -s "truncater" "$(INSTALLDIR)/lib/ponysay/truncater"
mkdir -p "$(INSTALLDIR)/share/licenses/ponysay/"
install "COPYING" "$(INSTALLDIR)/share/licenses/ponysay/COPYING"
@@ -103,7 +103,7 @@ install: install-no-info install-info
'| |_| \___/ |_| |_| \__, ||___/ \__,_| \__, | |\n'\
'| |___/ |___/ |\n'\
'\\--------------------------------------------------/'
- @echo '' | ./ponysay -f ./`if [[ "$$TERM" = "linux" ]]; then echo ttyponies; else echo ponies; fi`/pinkiecannon.pony | tail --lines=30 ; echo -e '\n'
+ @echo 'dummy' | ./ponysay -f ./`if [[ "$$TERM" = "linux" ]]; then echo ttyponies; else echo ponies; fi`/pinkiecannon.pony | tail --lines=30 ; echo -e '\n'
uninstall:
if [ -d "$(INSTALLDIR)/share/ponysay" ]; then rm -fr "$(INSTALLDIR)/share/ponysay" ; fi
@@ -129,19 +129,28 @@ uninstall-old:
if [ -d "$(INSTALLDIR)/share/ponies" ]; then rm -fr "$(INSTALLDIR)/share/ponies" ; fi
if [ -d "$(INSTALLDIR)/share/ttyponies" ]; then rm -fr "$(INSTALLDIR)/share/ttyponies" ; fi
if [ -f "$(INSTALLDIR)/bin/ponysaytruncater" ]; then unlink "$(INSTALLDIR)/bin/ponysaytruncater" ; fi
+ if [ -d "$(INSTALLDIR)/lib/ponysay/link.pl" ]; then unlink "$(INSTALLDIR)/lib/ponysay/link.pl" ; fi
+ if [ -d "$(INSTALLDIR)/lib/ponysay/linklist.pl" ]; then unlink "$(INSTALLDIR)/lib/ponysay/linklist.pl" ; fi
+ if [ -d "$(INSTALLDIR)/lib/ponysay/pq4ps" ]; then unlink "$(INSTALLDIR)/lib/ponysay/pq4ps" ; fi
+ if [ -d "$(INSTALLDIR)/lib/ponysay/pq4ps.pl" ]; then unlink "$(INSTALLDIR)/lib/ponysay/pq4ps.pl" ; fi
if [ -d "$(INSTALLDIR)/lib/ponysay/pq4ps-list" ]; then unlink "$(INSTALLDIR)/lib/ponysay/pq4ps-list" ; fi
+ if [ -d "$(INSTALLDIR)/lib/ponysay/pq4ps-list.pl" ]; then unlink "$(INSTALLDIR)/lib/ponysay/pq4ps-list.pl" ; fi
clean:
- if [ -f "truncater" ]; then rm -f "truncater" ; fi
- if [ -f "completion/bash-completion-think.sh" ]; then rm -f "completion/bash-completion-think.sh" ; fi
- if [ -f "completion/fish-completion-think.fish" ]; then rm -f "completion/fish-completion-think.fish"; fi
- if [ -f "completion/zsh-completion-think.zsh" ]; then rm -f "completion/zsh-completion-think.zsh" ; fi
- if [ -f "manuals/manpage.6.gz" ]; then rm -f "manuals/manpage.6.gz" ; fi
- if [ -f "manuals/manpage.es.6.gz" ]; then rm -f "manuals/manpage.es.6.gz" ; fi
- if [ -f "ponysay.info.gz" ]; then rm -f "ponysay.info.gz" ; fi
+ if [ -f "truncater" ]; then rm -f "truncater" ; fi
+ if [ -f "completion/bash-completion-think.sh" ]; then rm -f "completion/bash-completion-think.sh" ; fi
+ if [ -f "completion/fish-completion-think.fish" ]; then rm -f "completion/fish-completion-think.fish" ; fi
+ if [ -f "completion/zsh-completion-think.zsh" ]; then rm -f "completion/zsh-completion-think.zsh" ; fi
+ if [ -f "completion/bash-completion.sh.install" ]; then rm -f "completion/bash-completion.sh.install" ; fi
+ if [ -f "completion/fish-completion.fish.install" ]; then rm -f "completion/fish-completion.fish.install"; fi
+ if [ -f "completion/zsh-completion.zsh.install" ]; then rm -f "completion/zsh-completion.zsh.install" ; fi
+ if [ -f "manuals/manpage.6.gz" ]; then rm -f "manuals/manpage.6.gz" ; fi
+ if [ -f "manuals/manpage.es.6.gz" ]; then rm -f "manuals/manpage.es.6.gz" ; fi
+ if [ -f "ponysay.info.gz" ]; then rm -f "ponysay.info.gz" ; fi
+ if [ -f "ponysay.py.install" ]; then rm -f "ponysay.py.install" ; fi
clean-old:
- if [ -f "ponysaytruncater" ]; then rm -f "ponysaytruncater" ; fi
+ if [ -f "ponysaytruncater" ]; then rm -f "ponysaytruncater"; fi
## Scripts for maintainers
diff --git a/README.md b/README.md
index e27fb3e..f7bc972 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,7 @@ First of all, you need `cowsay` from your local repositories.
Obtain it from [here](http://www.nog.net/~tony/warez) if you wish to compile it yourself.
This is often sufficient, but if is not you may be missing one of the standard packages: [bash](ftp://ftp.gnu.org/gnu/bash/), [coreutils](ftp://ftp.gnu.org/gnu/coreutils/) or [sed](ftp://ftp.gnu.org/gnu/sed/).
-[Download](https://github.com/erkin/ponysay/downloads) or clone the project.
+[Download](/erkin/ponysay/downloads) or clone the project.
In the terminal, `cd` into the ponysay directory and `make && make install`.
This will install ponysay into the $PREFIX (`/usr` by default, meaning you may need to `make install` as root, e.g. `sudo make install`.)
@@ -46,7 +46,7 @@ This requires that you have the `fortune` utility installed. You can install it
or just fetch the source code from [here](ftp://ftp.ibiblio.org/pub/linux/games/amusements/fortune/).
You can try [this](http://www.reddit.com/r/mylittlelinux/comments/srixi/using_ponysay_with_a_ponified_fortune_warning/) script or
-[ponypipe](https://github.com/maandree/ponypipe) to ponify fortunes.
+[ponypipe](/maandree/ponypipe) to ponify fortunes.
Edit your `~/.bashrc` and add this to the end of the file
@@ -84,19 +84,17 @@ Dependencies
### Required runtime dependencies
-`bash`: required for the main script [file: ponysay]
+`bash`: bash is used in a minor part of the program to make everything work, this will be removed later
-`cowsay`: this is a wrapper for cowsay
-
-`coreutils`: the main script uses stty, cut, ls, cat, sort, readlink, pwd, head and tail
+`coreutils`: stty in coreutils used to determine size of the terminal, other parts of coreutils will not be needed for long
-`sed`: used to remove .pony from pony names when running `ponysay -l` and `ponysay -l`
+`cowsay`: this is a wrapper for cowsay
-`perl`: required to run `ponysay -l` and `ponysay -L`
+`python3`: Written in python 3
### Package building dependencies
-`gcc`: used for compiling ponysaytruncater.c
+`gcc`: used for compiling ponysaytruncater.c (???)
`gzip`: used for compressing manpages
@@ -110,13 +108,13 @@ FAQ
__Q:__ The output looks like a mess in _(TTY/PuTTY/other)_!
-__A:__ Unfortunately, there's nothing much we can do about it. See [issue 1](https://github.com/erkin/ponysay/issues/1).
+__A:__ Unfortunately, there's nothing much we can do about it. See [issue 1](/erkin/ponysay/issues/1).
__Q:__ You are missing _(my-favourite-pony)_!
-__A:__ [Ask](https://github.com/erkin/ponysay/issues) and we'll add!
+__A:__ [Ask](/erkin/ponysay/issues) and we'll add!
__Q:__ Which programs do you use to generate the pony files?
__A:__ The pony files are actually mostly a bunch of selected [browser ponies](http://web.student.tuwien.ac.at/~e0427417/browser-ponies/ponies.html)
-that are generated into cow files via [img2xterm](https://github.com/rossy2401/img2xterm) or [util-say](https://github.com/maandree/util-say).
+that are generated into cow files via [img2xterm](/rossy2401/img2xterm) or [util-say](/maandree/util-say).
diff --git a/completion/bash-completion.sh b/completion/bash-completion.sh
index 26e1134..11b99ea 100644
--- a/completion/bash-completion.sh
+++ b/completion/bash-completion.sh
@@ -8,28 +8,18 @@ _ponysay()
options='-v -h -l -f -W -q'
COMPREPLY=( $( compgen -W "$options" -- "$cur" ) )
- if [ $prev = "-f" ]; then
- COMPREPLY=()
-
- sysponies=/usr/share/ponysay/ponies/
- usrponies=~/.local/share/ponysay/ponies/
- if [[ $TERM = "linux" ]]; then
- sysponies=/usr/share/ponysay/ttyponies/
- usrponies=~/.local/share/ponysay/ttyponies/
- fi
-
- [ -d $sysponies ] && COMPREPLY+=( $( compgen -W "$(ls --color=no $sysponies | sed -e 's/.pony//g')" -- "$cur" ) )
- [ -d $usrponies ] && COMPREPLY+=( $( compgen -W "$(ls --color=no $usrponies | sed -e 's/.pony//g')" -- "$cur" ) )
+ if [ $prev = "-f" ]; then
+ ponies=$('/usr/bin/ponysay.py' --onelist)
+ COMPREPLY=( $( compgen -W "$ponies" -- "$cur" ) )
+
+ elif [ $prev = "-q" ]; then
+ quoters=$('/usr/bin/ponysay.py' --quoters)
+ COMPREPLY=( $( compgen -W "$quoters" -- "$cur" ) )
elif [ $prev = "-W" ]; then
cols=$(( `stty size | cut -d ' ' -f 2` - 10 ))
COMPREPLY=( $cols $(( $cols / 2 )) 100 60 )
- elif [ $prev = "-q" ]; then
- qcmd=/usr/lib/ponysay/pq4ps
- quoters=$($qcmd -l)
- COMPREPLY=( $( compgen -W "$quoters" -- "$cur" ) )
-
fi
}
diff --git a/completion/fish-completion.fish b/completion/fish-completion.fish
index 89f7a19..727460b 100644
--- a/completion/fish-completion.fish
+++ b/completion/fish-completion.fish
@@ -3,43 +3,20 @@
#
# Author: Elis Axelsson <etu AT elis DOT nu>
-if test $TERM = "linux"
- set -g systempath /usr/share/ponysay/ttyponies/
- set -g homepath ~/.local/share/ponysay/ttyponies/
-else
- set -g systempath /usr/share/ponysay/ponies/
- set -g homepath ~/.local/share/ponysay/ponies/
-end
-
-if test -d $systempath
- set -g systemponies (ls --color=no $systempath | sed -e 's/\.pony//' -e 's/_.*//' | perl -pe 's/([a-z])([A-Z])/\1\\\ \2/' )
-end
-
-if test -d $homepath
- set -g homeponies (ls --color=no $homepath | sed -e 's/\.pony//' -e 's/_.*//' | perl -pe 's/([a-z])([A-Z])/\1\\\ \2/' )
-end
-
-
-set -g qcmd /usr/lib/ponysay/pq4ps
-set -g quoters ($qcmd -l)
+set -g ponies ('/usr/bin/ponysay.pl' --onelist)
+set -g quoters ('/usr/bin/ponysay.pl' --quoters)
complete -c ponysay -s h --description "Help of ponysay"
complete -c ponysay -s v --description "Version of ponysay"
complete -c ponysay -s l --description "List pony files"
complete -c ponysay -s L --description "List pony files with alternatives"
-complete -c ponysay -s f -a "$homeponies $systemponies" --description "Select a pony"
+complete -c ponysay -s f -a "$ponies" --description "Select a pony"
complete -c ponysay -s q -a "$quoters" --description "Select ponies for MLP:FiM quotes"
complete -c ponysay -s W -a "Integer" --description "The screen column where the message should be wrapped"
-set -e systempath
-set -e homepath
-
-set -e systemponies
-set -e homeponies
-
-set -e qcmd
+set -e ponies
set -e quoters
diff --git a/linklist.pl b/linklist.pl
deleted file mode 100755
index c0377aa..0000000
--- a/linklist.pl
+++ /dev/null
@@ -1,35 +0,0 @@
-#!/usr/bin/perl
-
-# ponysaylist
-# Prints a list of ponies in columns
-#
-# Licensed under WTFPL
-# See COPYING for details
-
-# Author: Mattias Andrée, maandree@kth.se
-# spider-mario
-
-
-use strict;
-use warnings;
-use utf8;
-
-my %hash;
-
-{
- local @ARGV = @ARGV;
- while ((my ($source, $target), @ARGV) = @ARGV) {
- unless ($source eq $target) {
- push @{$hash{$target}}, $source;
- }
- }
-}
-
-while ((my ($source, $target), @ARGV) = @ARGV) {
- if ($source eq $target) {
- my @list = @{$hash{$source} // []};
- print $source;
- print ' (', join(' ', @list), ')' if @list;
- print "\n";
- }
-}
diff --git a/list.pl b/list.pl
deleted file mode 100755
index 2004484..0000000
--- a/list.pl
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env perl
-
-# ponysaylist
-# Prints a list of ponies in columns
-#
-# Licensed under WTFPL
-# See COPYING for details
-
-# Author: Mattias Andrée, maandree@kth.se
-# spider-mario
-
-
-use strict;
-use warnings;
-use utf8;
-use feature qw(say);
-use integer;
-use List::Util qw(max);
-
-my $scrw = shift @ARGV // 1;
-
-#for (@ARGV) {
-# # Format names from pony names
-# s/(?<=[a-z])(?=[A-Z])/ /;
-# s/_(.*)/\t($1)/;
-#}
-
-my $maxw = max 1, map {length} @ARGV;
-
-my $cols = max 1, (($scrw + 2) / ($maxw + 2));
-
-my @list = map {sprintf "%-${maxw}s", $_} @ARGV;
-
-my $rows = (@list + $cols - 1) / $cols;
-
-my @rowlist;
-for my $i (0 .. $#list) {
- push @{$rowlist[$i % $rows]}, $list[$i];
-}
-
-say join ' ', @$_ for @rowlist;
diff --git a/ponysay b/ponysay
index 9936fae..891ec7f 100755
--- a/ponysay
+++ b/ponysay
@@ -1,294 +1,25 @@
#!/usr/bin/env bash
-VERSION=1.4.1
-
-
-
-# Get bash script directory's parent
INSTALLDIR="$(dirname $( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))"
+LIBDIR="$INSTALLDIR/lib/ponysay"
-# Directory for installed media files
-SYSTEMSHARE="$INSTALLDIR/share/ponysay"
-HOMESHARE="${HOME}/.local/share/ponysay"
-
-# Subscripts
-listcmd="$INSTALLDIR/lib/ponysay/list.pl"
-linklistcmd="$INSTALLDIR/lib/ponysay/linklist.pl"
-truncatercmd="$INSTALLDIR/lib/ponysay/truncater"
-quotecmd="$INSTALLDIR/lib/ponysay/pq4ps"
-qlistcmd="$INSTALLDIR/lib/ponysay/pq4ps-list.pl"
-
-pony="*" # Selected pony
-wrap="" # Message wrap column
-ponies=() # Selected ponies
+truncatercmd="$LIBDIR/truncater"
scrw=`(stty size <&2 || echo 0 0) | cut -d ' ' -f 2` # Screen width
-scrh=`(stty size <&2 || echo 0 0) | cut -d ' ' -f 1` # Screen height
-
-# KMS ponies extension
-kmscmd=""
-[ "$TERM" = "linux" ] && kmscmd=$(for c in $(echo $PATH":" | sed -e 's/:/\/ponysay2kmsponysay /g'); do if [ -f $c ]; then echo $c; break; fi done)
-[ ! "$kmscmd" = "" ] && TERM="-linux-"
-
-# Directories for installed ponies files
-if [ "$TERM" = "linux" ]; then
- SYSTEMPONIES="$SYSTEMSHARE/ttyponies"
- HOMEPONIES="$HOMESHARE/ttyponies"
-else
- SYSTEMPONIES="$SYSTEMSHARE/ponies"
- HOMEPONIES="$HOMESHARE/ponies"
-fi
-# Cowsay script
-if [ ${0} == *ponythink ]; then
- if [ "$PONYSAY_COWTHINK" = "" ]; then
- cmd=cowthink
- customcmd=0
- else
- cmd="$PONYSAY_COWTHINK"
- customcmd=1
- fi
-else
- if [ "$PONYSAY_COWSAY" = "" ]; then
- cmd=cowsay
- customcmd=0
- else
- cmd="$PONYSAY_COWSAY"
- customcmd=1
- fi
-fi
-
-
-
-# Ponysay version print function
-version() {
- echo "ponysay v$VERSION"
-}
-
-# Marks ponies in lists that have quotes
-qoutelist() {
- bash -c "$("$qlistcmd" $("$quotecmd" --list))"
-}
-
-# Pony list function
-list() {
- if [ -d $SYSTEMPONIES ]; then
- echo -e "\\e[01mponyfiles located in $SYSTEMPONIES:\\e[21m"
- perl $listcmd $scrw $(ls --color=no $SYSTEMPONIES | sed -e 's/\.pony$//' | sort) | qoutelist
+function wtrunc {
+ if [ "$PONYSAY_FULL_WIDTH" = 'yes' ] || [ "$PONYSAY_FULL_WIDTH" = 'y' ] || [ "$PONYSAY_FULL_WIDTH" = '1' ]; then
+ cat
+ else
+ if [[ -f $truncatercmd ]]; then
+ $truncatercmd $scrw
+ else
+ cat
fi
- if [ -d $HOMEPONIES ]; then
- echo -e "\\e[01mponyfiles located in $HOMEPONIES:\\e[21m"
- perl $listcmd $scrw $(ls --color=no $HOMEPONIES | sed -e 's/\.pony$//' | sort) | qoutelist
- fi
- if [ ! -d $SYSTEMPONIES ] && [ ! -d $HOMEPONIES ]; then
- echo >&2 "All the ponies are missing! Call the Princess!"
- fi
-}
-
-# Pony list function with symlink map, for one directory
-_linklist() {
- echo -e "\\e[01mponyfiles located in $1:\\e[21m"
- files=$(ls --color=no $1 | sed -e 's/\.pony$//' | sort)
-
- args=""
-
- for file in $files; do
- target="$(readlink $1"/"$file".pony")"
-
- if [ "$target" = "" ]; then
- target=$file
- else
- target=$(echo $target | sed -e 's/^\.\///g' -e 's/\.pony$//g')
- fi
-
- args=$(echo $args $file $target)
- done
-
- perl $listcmd $scrw $(perl $linklistcmd $(echo $args) | sed -e 's/ /_/g') | sed -e 's/_/ /g' | qoutelist
-}
-
-# Pony list function with symlink map, for both directories
-linklist() {
- _linklist $SYSTEMPONIES
-
- if [ -d $HOMEPONIES ]; then
- _linklist $HOMEPONIES
- fi
-}
-
-# Pony quotes
-ponyquotes() {
- [ "$TERM" = "-linux-" ] && TERM="linux"
- "$0" ${wrap:+-W$wrap} $("$quotecmd" $@)
-}
-
-# Usage help print function
-usage() {
- version
- cat <<EOF
-
-Usage:
-${0##*/} [options] [message]
-
-If [message] is not provided, reads the message from STDIN.
-
-Options:
- -v Show version and exit.
- -h Show this help and exit.
- -l List pony files.
- -L List pony files with synonyms inside brackets.
- -q Use the pony quote feature.
- -f[name] Select a pony (either a file name or a pony name.)
- -W[column] The screen column where the message should be wrapped.
-
-See man ponysay(6) for more information.
-EOF
+ fi
}
-# Function for printing the ponies and the message
-say() {
- # Ponies use UTF-8 drawing characters. Prevent a Perl warning.
- export PERL_UNICODE=S
-
- # Clear screen in TTY
- ( [ "$TERM" = "linux" ] || [ "$TERM" = "-linux-" ] ) && echo -ne '\e[H\e[2J'
-
- # Set PONYSAY_SHELL_LINES to default if not specified
- [ "$PONYSAY_SHELL_LINES" = "" ] && PONYSAY_SHELL_LINES=2
-
- # Width trunction
- function wtrunc {
- if [ "$PONYSAY_FULL_WIDTH" = 'yes' ] || [ "$PONYSAY_FULL_WIDTH" = 'y' ] || [ "$PONYSAY_FULL_WIDTH" = '1' ]; then
- cat
- else
- if [ -f $truncatercmd ]; then
- $truncatercmd $scrw
- else
- cat
- fi
- fi
- }
-
- # Height trunction, show top
- function htrunchead {
- head --lines=$(( $scrh - $PONYSAY_SHELL_LINES ))
- }
-
- # Height trunction, show bottom
- function htrunctail {
- tail --lines=$(( $scrh - $PONYSAY_SHELL_LINES ))
- }
-
- # Simplification of customisation of cowsay
- if [ $customcmd = 0 ]; then
- function cowcmd {
- pcmd='#!/usr/bin/perl\nuse utf8;'
- ccmd=$(for c in $(echo $PATH":" | sed -e 's/:/\/'"$cmd"' /g'); do if [ -f $c ]; then echo $c; break; fi done)
-
- if [ ${0} == *ponythink ]; then
- cat <(echo -e $pcmd) $ccmd > "/tmp/ponythink"
- perl '/tmp/ponythink' "$@"
- rm '/tmp/ponythink'
- else
- perl <(cat <(echo -e $pcmd) $ccmd) "$@"
- fi
- }
- else
- function cowcmd {
- $cmd "$@"
- }
- fi
-
- # KMS ponies support
- if [ "$kmscmd" = "" ]; then
- function runcmd {
- cowcmd -f "$pony" "$@"
- }
- else
- function runcmd {
- cowcmd -f <($kmscmd "$pony") "$@"
- }
- fi
-
- # Print the pony and the message
- if [ "$TERM" = "linux" ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = 'yes' ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = 'y' ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = '1' ]; then
- if [ "$PONYSAY_BOTTOM" = 'yes' ] || [ "$PONYSAY_BOTTOM" = 'y' ] || [ "$PONYSAY_BOTTOM" = '1' ]; then
- runcmd "${wrap:+-W$wrap}" | wtrunc | htrunctail
- else
- runcmd "${wrap:+-W$wrap}" | wtrunc | htrunchead
- fi
- else
- runcmd "${wrap:+-W$wrap}" | wtrunc
- fi
-}
-
-
-
-# If no stdin and no arguments then print usage and exit
-if [ -t 0 ] && [ $# == 0 ]; then
- usage
- exit
-fi
-
-
-
-# Parse options
-while getopts "f:W:Llhvq" OPT; do
- case ${OPT} in
- v) version; exit ;;
- h) usage; exit ;;
- f) ponies+=( $OPTARG ) ;;
- l) list; exit ;;
- L) linklist; exit ;;
- W) wrap="$OPTARG" ;;
- q) shift $((OPTIND - 1)); ponyquotes "$*"; exit ;;
- \?) usage >&2; exit 1 ;;
- esac
-done
-shift $((OPTIND - 1))
-
-
-# Check for cowsay
-hash $cmd &>/dev/null; if [ $? -ne 0 ]; then
- cat >&2 <<EOF
-You don't seem to have the $cmd program.
-Please install it in order to use this wrapper.
-
-Alternatively, symlink it to '$cmd' in anywhere in \$PATH
-if it actually exists under a different filename.
-EOF
- exit 1
-fi
-
-
-# Select random pony for the set of -f arguments
-if [ ! ${#ponies[@]} == 0 ]; then
- pony="${ponies[$RANDOM%${#ponies[@]}]}"
-fi
-
-
-# Pony not a file? Search for it
-if [ ! -f $pony ]; then
- ponies=()
- [ -d $SYSTEMPONIES ] && ponies+=( "$SYSTEMPONIES"/$pony.pony )
- [ -d $HOMEPONIES ] && ponies+=( "$HOMEPONIES"/$pony.pony )
-
- if (( ${#ponies} < 1 )); then
- echo >&2 "All the ponies are missing! Call the Princess!"
- exit 1
- fi
-
- # Choose a random pony
- pony="${ponies[$RANDOM%${#ponies[@]}]}"
-fi
-
-
-# Print pony with message
-if [ -n "$*" ]; then
- # Handle a message given via arguments
- say <<<"$*"
-else
- # Handle a message given in stdin
- say
-fi
+# Ponies use UTF-8 drawing characters. Prevent a Perl warning.
+export PERL_UNICODE=S
+"$0.py" "$@" | wtrunc
diff --git a/ponysay.py b/ponysay.py
new file mode 100755
index 0000000..6284dd7
--- /dev/null
+++ b/ponysay.py
@@ -0,0 +1,510 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+
+'''
+ponysay.py - POC of ponysay in python
+Copyright (C) 2012 Erkin Batu Altunbaş
+
+Authors: 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 first implementation
+ Sven-Hendrik "svenstaro" Haase: Major contributor first implementation
+ Kyah "L-four" Rindlisbacher: Patched the first implementation
+ Jan Alexander "heftig" Steffens: Major contributor first implementation
+
+License: WTFPL
+'''
+
+import argparse
+import os
+import sys
+import random
+from subprocess import Popen, PIPE
+
+
+'''
+The version of ponysay
+'''
+VERSION = '2.0-rc1'
+
+
+'''
+The directory where ponysay is installed, this is modified when building with make
+'''
+INSTALLDIR = '/usr'
+
+
+'''
+The user's home directory
+'''
+HOME = os.environ['HOME']
+
+
+'''
+Whether the program is execute in Linux VT (TTY)
+'''
+linuxvt = os.environ['TERM'] == 'linux'
+
+
+'''
+Whether the program is launched in subshell/being redirected
+'''
+redirected = False #not sys.stdout.isatty() # currently impossible, we need to get rid of the little shell script first
+
+
+'''
+The directories where pony files are stored, ttyponies/ are used if the terminal is Linux VT (also known as TTY)
+'''
+ponydirs = []
+if linuxvt: _ponydirs = [HOME + '/.local/share/ponysay/ttyponies/', INSTALLDIR + '/share/ponysay/ttyponies/']
+else: _ponydirs = [HOME + '/.local/share/ponysay/ponies/', INSTALLDIR + '/share/ponysay/ponies/' ]
+for ponydir in _ponydirs:
+ if os.path.isdir(ponydir):
+ ponydirs.append(ponydir)
+
+
+'''
+The directories where quotes files are stored
+'''
+quotedirs = []
+_quotedirs = [HOME + '/.local/share/ponysay/quotes/', INSTALLDIR + '/share/ponysay/quotes/']
+for quotedir in _quotedirs:
+ if os.path.isdir(quotedir):
+ quotedirs.append(quotedir)
+
+
+
+'''
+Argument parsing
+'''
+parser = argparse.ArgumentParser(prog = 'ponysay', description = 'cowsay wrapper for ponies')
+
+parser.add_argument('-v', '--version', action = 'version', version = '%s %s' % ('ponysay', VERSION))
+parser.add_argument('-l', '--list', action = 'store_true', dest = 'list', help = 'list pony files')
+parser.add_argument('-L', '--altlist', action = 'store_true', dest = 'linklist', help = 'list pony files with alternatives')
+parser.add_argument( '--quoters', action = 'store_true', dest = 'quoters', help = 'list ponies with quotes (visible in -l and -L)') # for shell completions
+parser.add_argument( '--onelist', action = 'store_true', dest = 'onelist', help = 'list pony files in one columns') # for shell completions
+parser.add_argument('-W', '--wrap', action = 'store', dest = 'wrap', help = 'specify the column when the message should be wrapped')
+parser.add_argument('-f', '--pony', action = 'append', dest = 'pony', help = 'select a pony (either a file name or a pony name)')
+parser.add_argument('-q', '--quote', nargs = '*', dest = 'quote', help = 'select a pony which will quote herself')
+parser.add_argument('message', nargs = '?', help = 'message to ponysay')
+
+args = parser.parse_args()
+# TODO implement if [ -t 0 ] && [ $# == 0 ]; then
+# usage
+# exit
+# fi
+
+
+
+'''
+This is the mane class of ponysay
+'''
+class ponysay():
+ '''
+ Starts the part of the program the arguments indicate
+ '''
+ def __init__(self, args):
+ if args.list and redirected:
+ args.list = False
+ args.onelist = True
+
+ if args.list: self.list()
+ elif args.linklist: self.linklist()
+ elif args.quoters: self.quoters()
+ elif args.onelist: self.onelist()
+ elif args.quote: self.quote(args)
+ else: self.print_pony(args)
+
+
+ ##
+ ## Auxiliary methods
+ ##
+
+ '''
+ Returns one .pony-file with full path, names is filter for names, also accepts filepaths
+ '''
+ def __getponypath(self, names = None):
+ ponies = {}
+
+ if not names == None:
+ for name in names:
+ if os.path.isfile(name):
+ return name
+
+ for ponydir in ponydirs:
+ for ponyfile in os.listdir(ponydir):
+ pony = ponyfile[:-5]
+ if pony not in ponies:
+ ponies[pony] = ponydir + ponyfile
+
+ if names == None:
+ names = list(ponies.keys())
+
+ return ponies[names[random.randrange(0, len(names))]]
+
+
+ '''
+ Returns a set with all ponies that have quotes and are displayable
+ '''
+ def __quoters(self):
+ quotes = []
+ quoteshash = set()
+ _quotes = []
+ for quotedir in quotedirs:
+ _quotes += [item[:item.index('.')] for item in os.listdir(INSTALLDIR + '/share/ponysay/quotes/')]
+ for quote in _quotes:
+ if not quote == '':
+ if not quote in quoteshash:
+ quoteshash.add(quote)
+ quotes.append(quote)
+
+ ponies = set()
+ for ponydir in ponydirs:
+ for pony in os.listdir(ponydir):
+ if not pony[0] == '.':
+ p = pony[:-5] # remove .pony
+ for quote in quotes:
+ if ('+' + p + '+') in ('+' + quote + '+'):
+ if not p in ponies:
+ ponies.add(p)
+
+ return ponies
+
+
+ '''
+ Returns a list with all (pony, quote file) pairs
+ '''
+ def __quotes(self):
+ quotes = []
+ for quotedir in quotedirs:
+ quotes += [quotedir + item for item in os.listdir(quotedir)]
+ rc = []
+
+ for ponydir in ponydirs:
+ for pony in os.listdir(ponydir):
+ if not pony[0] == '.':
+ p = pony[:-5] # remove .pony
+ for quote in quotes:
+ q = quote[quote.rindex('/') + 1:]
+ if ('+' + p + '+') in ('+' + q + '+'):
+ rc.append((p, quote))
+
+ return rc
+
+
+ '''
+ Gets the size of the terminal in (rows, columns)
+ '''
+ def __gettermsize(self):
+ termsize = Popen(['stty', 'size'], stdout=PIPE, stdin=sys.stderr).communicate()[0]
+ termsize = termsize.decode('utf8', 'replace')[:-1].split(' ') # [:-1] removes a \n
+ termsize = [int(item) for item in termsize]
+ return termsize
+
+
+ ##
+ ## Listing methods
+ ##
+
+ '''
+ Lists the available ponies
+ '''
+ def list(self):
+ termsize = self.__gettermsize()
+ quoters = self.__quoters()
+
+ for ponydir in ponydirs: # Loop ponydirs
+ print('\033[1mponyfiles located in ' + ponydir + '\033[21m')
+
+ ponies = os.listdir(ponydir)
+ ponies = [item[:-5] for item in ponies] # remove .pony from file name
+ ponies.sort()
+
+ width = len(max(ponies, key = len)) + 2 # Get the longest ponyfilename lenght + 2 spaces
+
+ x = 0
+ for pony in ponies:
+ spacing = ' ' * (width - len(pony))
+ print(('\033[1m' + pony + '\033[21m' if (pony in quoters) else pony) + spacing, end='') # Print ponyfilename
+ x += width
+ if x > (termsize[1] - width): # If too wide, make new line
+ print()
+ x = 0
+
+ print('\n');
+
+
+ '''
+ Lists the available ponies with alternatives inside brackets
+ '''
+ def linklist(self):
+ termsize = self.__gettermsize()
+ quoters = self.__quoters()
+
+ for ponydir in ponydirs: # Loop ponydirs
+ print('\033[1mponyfiles located in ' + ponydir + '\033[21m')
+
+ files = os.listdir(ponydir)
+ files = [item[:-5] for item in files] # remove .pony from file name
+ files.sort()
+ pairs = [(item, os.readlink(ponydir + item + '.pony') if os.path.islink(ponydir + item + '.pony') else '') for item in files]
+
+ ponymap = {}
+ for pair in pairs:
+ if pair[1] == '':
+ if pair[0] not in ponymap:
+ ponymap[pair[0]] = []
+ else:
+ target = pair[1][:-5]
+ if '/' in target:
+ target = target[target.rindex('/') + 1:]
+ if target in ponymap:
+ ponymap[target].append(pair[0])
+ else:
+ ponymap[target] = [pair[0]]
+
+ width = 0
+ ponies = []
+ widths = []
+ for pony in ponymap:
+ w = len(pony)
+ item = '\033[1m' + pony + '\033[21m' if (pony in quoters) else pony
+ syms = ponymap[pony]
+ if len(syms) > 0:
+ w += 2 + len(syms)
+ item += ' ('
+ first = True
+ for sym in syms:
+ w += len(sym)
+ if not first:
+ item += ' '
+ else:
+ first = False
+ item += '\033[1m' + sym + '\033[21m' if (sym in quoters) else sym
+ item += ')'
+ ponies.append(item)
+ widths.append(w)
+ if width < w:
+ width = w
+
+ width += 2;
+ x = 0
+ index = 0
+ for pony in ponies:
+ spacing = ' ' * (width - widths[index])
+ index += 1
+ print(pony + spacing, end='') # Print ponyfilename
+ x += width
+ if x > (termsize[1] - width): # If too wide, make new line
+ print()
+ x = 0
+
+ print('\n');
+
+
+ '''
+ Lists with all ponies that have quotes and are displayable
+ '''
+ def quoters(self):
+ last = ""
+ ponies = []
+ for pony in self.__quoters():
+ ponies.append(pony)
+ ponies.sort()
+ for pony in ponies:
+ if not pony == last:
+ last = pony
+ print(pony)
+
+
+ '''
+ Lists the available ponies one one column without anything bold
+ '''
+ def onelist(self):
+ last = ""
+ ponies = []
+ for ponydir in ponydirs: # Loop ponydirs
+ ponies += os.listdir(ponydir)
+ ponies = [item[:-5] for item in ponies] # remove .pony from file name
+ ponies.sort()
+ for pony in ponies:
+ if not pony == last:
+ last = pony
+ print(pony)
+
+
+ ##
+ ## Displaying methods
+ ##
+
+ '''
+ Returns (the cowsay command, whether it is a custom program)
+ '''
+ def __getcowsay(self):
+ isthink = 'think.py' in __file__
+
+ if isthink:
+ cowthink = os.environ['PONYSAY_COWTHINK'] if 'PONYSAY_COWTHINK' in os.environ else None
+ return ('cowthink', False) if (cowthink is None) or (cowthink == '') else (cowthink, True)
+
+ cowsay = os.environ['PONYSAY_COWSAY'] if 'PONYSAY_COWSAY' in os.environ else None
+ return ('cowsay', False) if (cowsay is None) or (cowsay == '') else (cowsay, True)
+
+
+ '''
+ Print the pony with a speech or though bubble
+ '''
+ def print_pony(self, args):
+ if args.message == None:
+ msg = sys.stdin.read().strip()
+ else:
+ msg = args.message
+
+ pony = self.__getponypath(args.pony)
+ (cowsay, customcowsay) = self.__getcowsay()
+
+ cmd = [cowsay, '-f', self.__kms(pony)]
+ if args.wrap is not None:
+ cmd += ['-W', args.wrap]
+ cmd.append(msg)
+
+ if linuxvt:
+ print('\033[H\033[2J', end='')
+
+ proc = Popen(cmd, stdout=PIPE, stdin=sys.stderr)
+ output = proc.communicate()[0].decode('utf8', 'replace')
+ if (len(output) > 0) and (output[-1] == '\n'):
+ output = output[:-1]
+ exit_value = proc.returncode
+
+
+ env_bottom = os.environ['PONYSAY_BOTTOM'] if 'PONYSAY_BOTTOM' in os.environ else None
+ if env_bottom is None: env_bottom = ''
+
+ env_height = os.environ['PONYSAY_TRUNCATE_HEIGHT'] if 'PONYSAY_TRUNCATE_HEIGHT' in os.environ else None
+ if env_height is None: env_height = ''
+
+ env_lines = os.environ['PONYSAY_SHELL_LINES'] if 'PONYSAY_SHELL_LINES' in os.environ else None
+ if (env_lines is None) or (env_lines == ''): env_lines = '2'
+
+ lines = self.__gettermsize()[1] - int(env_lines)
+
+
+ if not exit_value == 0:
+ sys.stderr.write('Unable to successfully execute' + (' custom ' if customcowsay else ' ') + 'cowsay [' + cowsay + ']\n')
+ else:
+ if linuxvt or (env_height is ("yes", "y", "1")):
+ if env_bottom is ("yes", "y", "1"):
+ for line in output[: -lines]:
+ print(line)
+ else:
+ for line in output[: lines]:
+ print(line)
+ else:
+ print(output);
+
+
+ ## TODO not implement, but it will be obsolete if we rewrite cowsay
+ '''
+ (if not customcowsay)
+
+ pcmd='#!/usr/bin/perl\nuse utf8;'
+ ccmd=$(for c in $(echo $PATH":" | sed -e 's/:/\/'"$cmd"' /g'); do if [ -f $c ]; then echo $c; break; fi done)
+
+ if [ ${0} == *ponythink ]; then
+ cat <(echo -e $pcmd) $ccmd > "/tmp/ponythink"
+ perl '/tmp/ponythink' "$@"
+ rm '/tmp/ponythink'
+ else
+ perl <(cat <(echo -e $pcmd) $ccmd) "$@"
+ fi
+ '''
+
+
+ '''
+ Print the pony with a speech or though bubble and a self quote
+ '''
+ def quote(self, args):
+ pairs = self.__quotes()
+ if len(args.quote) > 0:
+ ponyset = set(args.quote)
+ alts = []
+ for pair in pairs:
+ if pair[0] in ponyset:
+ alts.append(pair)
+ pairs = alts
+
+ if not len(pairs) == 0:
+ pair = pairs[random.randrange(0, len(pairs))]
+ qfile = None
+ try:
+ qfile = open(pair[1], 'r')
+ args.message = '\n'.join(qfile.readlines()).strip()
+ finally:
+ if qfile is not None:
+ qfile.close()
+ args.pony = [pair[0]]
+ elif len(args.quote) == 0:
+ sys.stderr.write('All the ponies are mute! Call the Princess!')
+ exit(1)
+ else:
+ args.pony = args.quote[random.randrange(0, len(args.quote))]
+ args.message = 'I got nuthin\' good to say :('
+
+ self.print_pony(args)
+
+
+ '''
+ Returns the file name of the input pony converted to a KMS pony, or if KMS is not used, the input pony itself
+ '''
+ def __kms(self, pony):
+ if not linuxvt:
+ return pony
+
+ env_kms = os.environ['PONYSAY_KMS_PALETTE'] if 'PONYSAY_KMS_PALETTE' in os.environ else None
+ if env_kms is None: env_kms = ''
+
+ env_kms_cmd = os.environ['PONYSAY_KMS_PALETTE_CMD'] if 'PONYSAY_KMS_PALETTE_CMD' in os.environ else None
+ if (env_kms_cmd is not None) and (not env_kms_cmd == ''):
+ env_kms = Popen(shlex.split(env_kms_cmd), stdout=PIPE, stdin=sys.stderr).communicate()[0].decode('utf8', 'replace')
+ if env_kms[-1] == '\n':
+ env_kms = env_kms[:-1]
+
+ if env_kms == '':
+ return pony
+
+ palette = env_kms
+ palettefile = env_kms.replace('\033]P', '')
+
+ kmsponies = '/var/cache/ponysay/kmsponies/' + palettefile
+ kmspony = kmsponies + pony
+
+ if not os.path.isfile(kmspony):
+ protokmsponies = '/var/cache/ponysay/protokmsponies/'
+ protokmspony = protokmsponies + pony
+
+ _protokmspony = '\'' + protokmspony.replace('\'', '\'\\\'\'') + '\''
+ _kmspony = '\'' + kmspony.replace('\'', '\'\\\'\'') + '\''
+ _pony = '\'' + pony.replace('\'', '\'\\\'\'') + '\''
+
+ if not os.path.isfile(protokmspony):
+ os.makedirs(protokmsponies)
+ if not os.system('ponysay2ttyponysay < ' + _pony + ' > ' + _protokmspony) == 0:
+ sys.stderr.write('Unable to run ponysay2ttyponysay successfully, you need util-say for KMS support\n')
+ exit(1)
+
+ os.makedirs(kmsponies)
+ if not os.system('tty2colourfultty -e -p ' + palette + ' < ' + _protokmspony + ' > ' + _kmspony) == 0:
+ sys.stderr.write('Unable to run tty2colourfultty successfully, you need util-say for KMS support\n')
+ exit(1)
+
+ return kmspony
+
+
+
+'''
+Start the program from ponysay.__init__ if this is the executed file
+'''
+if __name__ == '__main__':
+ ponysay(args)
diff --git a/pq4ps b/pq4ps
deleted file mode 100755
index 576a4e8..0000000
--- a/pq4ps
+++ /dev/null
@@ -1,39 +0,0 @@
-#!/usr/bin/env bash
-
-INSTALLDIR="$(dirname "$(dirname "$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )")")" # Get main bash script directory's parent
-
-if [ $# == 1 ] && ([ "$1" == '-l' ] || [ "$1" == '--list' ]); then
- perl "$0.pl" "$INSTALLDIR" | cut -d @ -f 1 | uniq
-else
- _ponies="$(perl "$0.pl" "$INSTALLDIR")"
- ponies=()
-
- if (( $# > 0 )); then
- p=()
- for arg in "$@"; do
- p+="$(echo "$_ponies" | grep "^$arg@") "
- done
- _ponies=$p
- fi
-
- ponies=( $_ponies )
-
- if (( ${#ponies[@]} == 0 )); then
- ponies=()
- for arg in "$@"; do
- ponies+=( "$arg" )
- done
-
- p="${ponies[$RANDOM%${#ponies[@]}]}"
- q='I am totally speechless'
- echo "-f" $p $q
- else
- pony="${ponies[$RANDOM%${#ponies[@]}]}"
-
- p="$(echo $pony | cut -d '@' -f 1)"
- f="$(echo $pony | cut -d '@' -f 2)"
- q="$(cat "$INSTALLDIR/share/ponysay/quotes/$f")"
-
- echo "-f" $p $q
- fi
-fi
diff --git a/pq4ps-list.pl b/pq4ps-list.pl
deleted file mode 100755
index d4517c5..0000000
--- a/pq4ps-list.pl
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/usr/bin/perl
-
-print "(sed";
-
-foreach $arg (@ARGV)
-{
- print " -e 's/ $arg / \e[1m$arg\e[21m /g'";
- print " -e 's/ $arg)/ \e[1m$arg\e[21m)/g'";
- print " -e 's/($arg /(\e[1m$arg\e[21m /g'";
- print " -e 's/($arg)/(\e[1m$arg\e[21m)/g'";
- print " -e 's/ $arg\$/ \e[1m$arg\e[21m/g'";
- print " -e 's/^$arg /\e[1m$arg\e[21m /g'";
- print " -e 's/^$arg\$/\e[1m$arg\e[21m/g'";
-}
-
-print " | sed";
-
-foreach $arg (@ARGV)
-{
- print " -e 's/ $arg)/ \e[1m$arg\e[21m)/g'";
- print " -e 's/ $arg\$/ \e[1m$arg\e[21m/g'"
-}
-
-print ")";
diff --git a/pq4ps.pl b/pq4ps.pl
deleted file mode 100755
index 2f45053..0000000
--- a/pq4ps.pl
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/perl
-
-opendir(DIR, $ARGV[0]."/share/ponysay/ponies/");
-@files = readdir(DIR);
-
-opendir(DIR, $ARGV[0]."/share/ponysay/quotes/");
-@quotes = readdir(DIR);
-
-
-foreach $file (@files)
-{
- $_ = $file;
- $_ =~ s/\.pony$//g;
- $f = $_;
- if (! /^\./)
- { foreach $quote (@quotes)
- {
- $_ = $quote;
- $_ =~ s/\.\d+//g;
- $_ = '+'.$_.'+';
- if (! /^\./)
- { if (/\+$f\+/)
- { print $f."@".$quote."\n";
- } }
- } }
-}