mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-21 20:18:00 +01:00
some edits
This commit is contained in:
parent
e5b783e528
commit
70c27ca36f
25 changed files with 177 additions and 158 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -6,5 +6,5 @@
|
||||||
/completion/*-completion-think.*
|
/completion/*-completion-think.*
|
||||||
/manuals/manpage.*.gz
|
/manuals/manpage.*.gz
|
||||||
/ponysay.info.gz
|
/ponysay.info.gz
|
||||||
/ponysaytruncater
|
/truncater
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
Version 1.3
|
Version 1.3
|
||||||
|
|
||||||
New Ponies: forestspirit, raggedy, rhyme
|
New ponies: forestspirit, raggedy, rhyme
|
||||||
|
|
||||||
|
|
||||||
Version 1.2
|
Version 1.2
|
||||||
|
|
||||||
|
@ -8,8 +9,8 @@ Version 1.2
|
||||||
|
|
||||||
Support for extension: kmsponies4ponysay.
|
Support for extension: kmsponies4ponysay.
|
||||||
|
|
||||||
New ponies: ace, filthyrich, blueblood, gingergold, hayfever,
|
New ponies: ace, filthyrich, blueblood, gingergold, hayfever,
|
||||||
highscore, junebug, mrsparkle, persnickety, ponet,
|
highscore, junebug, mrsparkle, persnickety, ponet,
|
||||||
screwloose, tornadobolt.
|
screwloose, tornadobolt.
|
||||||
|
|
||||||
Pony symlinks added: mrsparkle → nightlight
|
Pony symlinks added: mrsparkle → nightlight
|
||||||
|
@ -19,6 +20,8 @@ Version 1.2
|
||||||
Arbitrary spaces in '-f' argument is not longer accepted (it causes
|
Arbitrary spaces in '-f' argument is not longer accepted (it causes
|
||||||
problems with file names including spaces).
|
problems with file names including spaces).
|
||||||
|
|
||||||
|
Note: Identifies itself as version 1.1
|
||||||
|
|
||||||
|
|
||||||
Version 1.1
|
Version 1.1
|
||||||
|
|
||||||
|
|
61
Makefile
61
Makefile
|
@ -1,15 +1,15 @@
|
||||||
all: ponysaytruncater manpages infomanual ponythinkcompletion
|
all: truncater manpages infomanual ponythinkcompletion
|
||||||
|
|
||||||
ponysaytruncater:
|
truncater:
|
||||||
gcc -o "ponysaytruncater" "ponysaytruncater.c"
|
gcc -o "truncater" "truncater.c"
|
||||||
|
|
||||||
manpages:
|
manpages:
|
||||||
gzip -9 < "manuals/manpage.6" > "manuals/manpage.6.gz"
|
gzip -9 < "manuals/manpage.6" > "manuals/manpage.6.gz"
|
||||||
gzip -9 < "manuals/manpage.es.6" > "manuals/manpage.es.6.gz"
|
gzip -9 < "manuals/manpage.es.6" > "manuals/manpage.es.6.gz"
|
||||||
|
|
||||||
infomanual:
|
infomanual:
|
||||||
makeinfo "manuals/ponysay.texinfo"
|
makeinfo "manuals/ponysay.texinfo"
|
||||||
gzip -9 "ponysay.info"
|
gzip -9 "ponysay.info"
|
||||||
|
|
||||||
ponythinkcompletion:
|
ponythinkcompletion:
|
||||||
sed -e 's/ponysay/ponythink/g' <"completion/bash-completion.sh" | sed -e 's/\/ponythink\//\/ponysay\//g' -e 's/\\\/ponythink\\\//\\\/ponysay\\\//g' >"completion/bash-completion-think.sh"
|
sed -e 's/ponysay/ponythink/g' <"completion/bash-completion.sh" | sed -e 's/\/ponythink\//\/ponysay\//g' -e 's/\\\/ponythink\\\//\\\/ponysay\\\//g' >"completion/bash-completion-think.sh"
|
||||||
|
@ -21,47 +21,47 @@ install: all
|
||||||
mkdir -p "$(DESTDIR)/usr/share/ponysay/ponies"
|
mkdir -p "$(DESTDIR)/usr/share/ponysay/ponies"
|
||||||
mkdir -p "$(DESTDIR)/usr/share/ponysay/ttyponies"
|
mkdir -p "$(DESTDIR)/usr/share/ponysay/ttyponies"
|
||||||
mkdir -p "$(DESTDIR)/usr/share/ponysay/quotes"
|
mkdir -p "$(DESTDIR)/usr/share/ponysay/quotes"
|
||||||
cp -P ponies/*.pony "$(DESTDIR)/usr/share/ponysay/ponies/"
|
cp -P ponies/*.pony "$(DESTDIR)/usr/share/ponysay/ponies/"
|
||||||
cp -P ttyponies/*.pony "$(DESTDIR)/usr/share/ponysay/ttyponies/"
|
cp -P ttyponies/*.pony "$(DESTDIR)/usr/share/ponysay/ttyponies/"
|
||||||
cp -P quotes/*.* "$(DESTDIR)/usr/share/ponysay/quotes/"
|
cp -P quotes/*.* "$(DESTDIR)/usr/share/ponysay/quotes/"
|
||||||
|
|
||||||
mkdir -p "$(DESTDIR)/usr/bin/"
|
mkdir -p "$(DESTDIR)/usr/bin/"
|
||||||
install "ponysay" "$(DESTDIR)/usr/bin/ponysay"
|
install "ponysay" "$(DESTDIR)/usr/bin/ponysay"
|
||||||
ln -sf "ponysay" "$(DESTDIR)/usr/bin/ponythink"
|
ln -sf "ponysay" "$(DESTDIR)/usr/bin/ponythink"
|
||||||
install "pq4ps" "$(DESTDIR)/usr/bin/pq4ps"
|
|
||||||
install "pq4ps.pl" "$(DESTDIR)/usr/bin/pq4ps.pl"
|
|
||||||
install "pq4ps-list" "$(DESTDIR)/usr/bin/pq4ps-list"
|
|
||||||
install "pq4ps-list.pl" "$(DESTDIR)/usr/bin/pq4ps-list.pl"
|
|
||||||
|
|
||||||
mkdir -p "$(DESTDIR)/usr/lib/ponysay/"
|
mkdir -p "$(DESTDIR)/usr/lib/ponysay/"
|
||||||
install -s "ponysaytruncater" "$(DESTDIR)/usr/lib/ponysay/truncater"
|
install -s "truncater" "$(DESTDIR)/usr/lib/ponysay/truncater"
|
||||||
install "ponysaylist.pl" "$(DESTDIR)/usr/lib/ponysay/list.pl"
|
install "list.pl" "$(DESTDIR)/usr/lib/ponysay/list.pl"
|
||||||
install "ponysaylinklist.pl" "$(DESTDIR)/usr/lib/ponysay/linklist.pl"
|
install "linklist.pl" "$(DESTDIR)/usr/lib/ponysay/linklist.pl"
|
||||||
|
install "pq4ps" "$(DESTDIR)/usr/lib/pq4ps"
|
||||||
|
install "pq4ps.pl" "$(DESTDIR)/usr/lib/pq4ps.pl"
|
||||||
|
install "pq4ps-list" "$(DESTDIR)/usr/lib/pq4ps-list"
|
||||||
|
install "pq4ps-list.pl" "$(DESTDIR)/usr/lib/pq4ps-list.pl"
|
||||||
|
|
||||||
mkdir -p "$(DESTDIR)/usr/share/bash-completion/completions/"
|
mkdir -p "$(DESTDIR)/usr/share/bash-completion/completions/"
|
||||||
install "completion/bash-completion.sh" "$(DESTDIR)/usr/share/bash-completion/completions/ponysay"
|
install "completion/bash-completion.sh" "$(DESTDIR)/usr/share/bash-completion/completions/ponysay"
|
||||||
install "completion/bash-completion-think.sh" "$(DESTDIR)/usr/share/bash-completion/completions/ponythink"
|
install "completion/bash-completion-think.sh" "$(DESTDIR)/usr/share/bash-completion/completions/ponythink"
|
||||||
|
|
||||||
mkdir -p "$(DESTDIR)/usr/share/fish/completions/"
|
mkdir -p "$(DESTDIR)/usr/share/fish/completions/"
|
||||||
install "completion/fish-completion.fish" "$(DESTDIR)/usr/share/fish/completions/ponysay.fish"
|
install "completion/fish-completion.fish" "$(DESTDIR)/usr/share/fish/completions/ponysay.fish"
|
||||||
install "completion/fish-completion-think.fish" "$(DESTDIR)/usr/share/fish/completions/ponythink.fish"
|
install "completion/fish-completion-think.fish" "$(DESTDIR)/usr/share/fish/completions/ponythink.fish"
|
||||||
|
|
||||||
mkdir -p "$(DESTDIR)/usr/share/zsh/site-functions/"
|
mkdir -p "$(DESTDIR)/usr/share/zsh/site-functions/"
|
||||||
install "completion/zsh-completion.zsh" "$(DESTDIR)/usr/share/zsh/site-functions/_ponysay"
|
install "completion/zsh-completion.zsh" "$(DESTDIR)/usr/share/zsh/site-functions/_ponysay"
|
||||||
install "completion/zsh-completion-think.zsh" "$(DESTDIR)/usr/share/zsh/site-functions/_ponythink"
|
install "completion/zsh-completion-think.zsh" "$(DESTDIR)/usr/share/zsh/site-functions/_ponythink"
|
||||||
|
|
||||||
mkdir -p "$(DESTDIR)/usr/share/licenses/ponysay/"
|
mkdir -p "$(DESTDIR)/usr/share/licenses/ponysay/"
|
||||||
install "COPYING" "$(DESTDIR)/usr/share/licenses/ponysay/COPYING"
|
install "COPYING" "$(DESTDIR)/usr/share/licenses/ponysay/COPYING"
|
||||||
|
|
||||||
mkdir -p "$(DESTDIR)/usr/share/man/man6"
|
mkdir -p "$(DESTDIR)/usr/share/man/man6"
|
||||||
install "manuals/manpage.6.gz" "$(DESTDIR)/usr/share/man/man6/ponysay.6.gz"
|
install "manuals/manpage.6.gz" "$(DESTDIR)/usr/share/man/man6/ponysay.6.gz"
|
||||||
ln -sf "ponysay.6.gz" "$(DESTDIR)/usr/share/man/man6/ponythink.6.gz"
|
ln -sf "ponysay.6.gz" "$(DESTDIR)/usr/share/man/man6/ponythink.6.gz"
|
||||||
|
|
||||||
mkdir -p "$(DESTDIR)/usr/share/man/es/man6"
|
mkdir -p "$(DESTDIR)/usr/share/man/es/man6"
|
||||||
install "manuals/manpage.es.6.gz" "$(DESTDIR)/usr/share/man/es/man6/ponysay.6.gz"
|
install "manuals/manpage.es.6.gz" "$(DESTDIR)/usr/share/man/es/man6/ponysay.6.gz"
|
||||||
ln -sf "ponysay.6.gz" "$(DESTDIR)/usr/share/man/es/man6/ponythink.6.gz"
|
ln -sf "ponysay.6.gz" "$(DESTDIR)/usr/share/man/es/man6/ponythink.6.gz"
|
||||||
|
|
||||||
mkdir -p "$(DESTDIR)/usr/share/info"
|
mkdir -p "$(DESTDIR)/usr/share/info"
|
||||||
install "ponysay.info.gz" "$(DESTDIR)/usr/share/info/ponysay.info.gz"
|
install "ponysay.info.gz" "$(DESTDIR)/usr/share/info/ponysay.info.gz"
|
||||||
install "ponysay.info.gz" "$(DESTDIR)/usr/share/info/ponythink.info.gz"
|
install "ponysay.info.gz" "$(DESTDIR)/usr/share/info/ponythink.info.gz"
|
||||||
install-info --dir-file="$(DESTDIR)/usr/share/info/dir" --entry="Miscellaneous" --description="My Little Ponies for your terminal" "$(DESTDIR)/usr/share/info/ponysay.info.gz"
|
install-info --dir-file="$(DESTDIR)/usr/share/info/dir" --entry="Miscellaneous" --description="My Little Ponies for your terminal" "$(DESTDIR)/usr/share/info/ponysay.info.gz"
|
||||||
|
@ -139,7 +139,7 @@ ttyponies:
|
||||||
|
|
||||||
pdfmanual:
|
pdfmanual:
|
||||||
texi2pdf "manuals/ponysay.texinfo"
|
texi2pdf "manuals/ponysay.texinfo"
|
||||||
git add "manuals/ponysay.texinfo"
|
git add "manuals/ponysay.texinfo" "ponysay.pdf"
|
||||||
if [[ -f "ponysay.aux" ]]; then unlink "ponysay.aux"; fi
|
if [[ -f "ponysay.aux" ]]; then unlink "ponysay.aux"; fi
|
||||||
if [[ -f "ponysay.cp" ]]; then unlink "ponysay.cp" ; fi
|
if [[ -f "ponysay.cp" ]]; then unlink "ponysay.cp" ; fi
|
||||||
if [[ -f "ponysay.cps" ]]; then unlink "ponysay.cps"; fi
|
if [[ -f "ponysay.cps" ]]; then unlink "ponysay.cps"; fi
|
||||||
|
@ -161,3 +161,4 @@ quotes: submodules
|
||||||
mkdir -p "quotes"
|
mkdir -p "quotes"
|
||||||
cp "ponyquotes4ponysay/ponyquotes/"*.* "quotes"
|
cp "ponyquotes4ponysay/ponyquotes/"*.* "quotes"
|
||||||
git add "quotes/"*.*
|
git add "quotes/"*.*
|
||||||
|
|
||||||
|
|
1
bin/ponysay
Symbolic link
1
bin/ponysay
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../ponysay
|
|
@ -5,7 +5,7 @@ _ponysay()
|
||||||
local cur prev words cword
|
local cur prev words cword
|
||||||
_init_completion -n = || return
|
_init_completion -n = || return
|
||||||
|
|
||||||
quotes=$(pq4ps --list 2>/dev/null)
|
quotes=$(/usr/lib/ponysay/pq4ps --list 2>/dev/null)
|
||||||
quotesexit=$?
|
quotesexit=$?
|
||||||
options='-v -h -l -f -W'
|
options='-v -h -l -f -W'
|
||||||
if [[ $quotesexit = 0 ]]; then
|
if [[ $quotesexit = 0 ]]; then
|
||||||
|
|
1
lib/ponysay/linklist.pl
Symbolic link
1
lib/ponysay/linklist.pl
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../linklist.pl
|
1
lib/ponysay/list.pl
Symbolic link
1
lib/ponysay/list.pl
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../list.pl
|
1
lib/ponysay/pq4ps
Symbolic link
1
lib/ponysay/pq4ps
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../pq4ps
|
1
lib/ponysay/pq4ps-list
Symbolic link
1
lib/ponysay/pq4ps-list
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../pq4ps-list
|
1
lib/ponysay/pq4ps-list.pl
Symbolic link
1
lib/ponysay/pq4ps-list.pl
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../pq4ps-list.pl
|
1
lib/ponysay/pq4ps.pl
Symbolic link
1
lib/ponysay/pq4ps.pl
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../pq4ps.pl
|
|
@ -33,4 +33,3 @@ while ((my ($source, $target), @ARGV) = @ARGV) {
|
||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -849,6 +849,8 @@ Arbitrary spaces in @command{-f} argument is not longer accepted (it causes prob
|
||||||
file names including spaces.)
|
file names including spaces.)
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
|
@b{Note}: Identifies itself as version 1.1
|
||||||
|
|
||||||
@heading Version 1.1
|
@heading Version 1.1
|
||||||
|
|
||||||
@itemize @bullet
|
@itemize @bullet
|
||||||
|
|
1
ponies/elsie.pony
Symbolic link
1
ponies/elsie.pony
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
./prettyvision.pony
|
222
ponysay
222
ponysay
|
@ -1,80 +1,86 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
version=1.1
|
VERSION=1.3
|
||||||
SCRIPTDIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # Get bash script directory
|
|
||||||
pony="*"
|
|
||||||
wrap=""
|
|
||||||
|
|
||||||
SYSTEMPONIES="$(dirname $SCRIPTDIR)/share/ponysay"
|
|
||||||
HOMEPONIES="${HOME}/.local/share/ponysay"
|
|
||||||
|
|
||||||
|
|
||||||
|
# Get bash script directory's parent
|
||||||
|
INSTALLDIR="$(dirname $( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))"
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
qlistcmd="$INSTALLDIR/lib/ponysay/pq4ps-list"
|
||||||
|
quotecmd="$INSTALLDIR/lib/ponysay/pq4ps"
|
||||||
|
|
||||||
|
pony="*" # Selected pony
|
||||||
|
wrap="" # Message wrap column
|
||||||
|
ponies=() # Selected ponies
|
||||||
|
|
||||||
|
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=""
|
kmscmd=""
|
||||||
[[ "$TERM" = "linux" ]] && kmscmd=$(for c in $(echo $PATH":" | sed -e 's/:/\/ponysay2kmsponysay /g'); do if [[ -f $c ]]; then echo $c; break; fi done)
|
[[ "$TERM" = "linux" ]] && kmscmd=$(for c in $(echo $PATH":" | sed -e 's/:/\/ponysay2kmsponysay /g'); do if [[ -f $c ]]; then echo $c; break; fi done)
|
||||||
[[ ! "$kmscmd" = "" ]] && TERM="-linux-"
|
[[ ! "$kmscmd" = "" ]] && TERM="-linux-"
|
||||||
|
|
||||||
|
# Directories for installed ponies files
|
||||||
if [ "$TERM" = "linux" ]; then
|
if [ "$TERM" = "linux" ]; then
|
||||||
SYSTEMPONIES="$SYSTEMPONIES/ttyponies"
|
SYSTEMPONIES="$SYSTEMSHARE/ttyponies"
|
||||||
HOMEPONIES="$HOMEPONIES/ttyponies"
|
HOMEPONIES="$HOMESHARE/ttyponies"
|
||||||
else
|
else
|
||||||
SYSTEMPONIES="$SYSTEMPONIES/ponies"
|
SYSTEMPONIES="$SYSTEMSHARE/ponies"
|
||||||
HOMEPONIES="$HOMEPONIES/ponies"
|
HOMEPONIES="$HOMESHARE/ponies"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$PONYSAY_COWSAY" = "" ]]; then
|
# Cowsay script
|
||||||
cmd=cowsay
|
if [[ ${0} == *ponythink ]]; then
|
||||||
customcmd=0
|
if [[ "$PONYSAY_COWTHINK" = "" ]]; then
|
||||||
|
cmd=cowthink
|
||||||
|
customcmd=0
|
||||||
|
else
|
||||||
|
cmd="$PONYSAY_COWTHINK"
|
||||||
|
customcmd=1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
cmd="$PONYSAY_COWSAY"
|
if [[ "$PONYSAY_COWSAY" = "" ]]; then
|
||||||
customcmd=1
|
cmd=cowsay
|
||||||
|
customcmd=0
|
||||||
|
else
|
||||||
|
cmd="$PONYSAY_COWSAY"
|
||||||
|
customcmd=1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ ${0} == *ponythink ]] &&
|
|
||||||
if [[ "$PONYSAY_COWTHINK" = "" ]]; then
|
|
||||||
cmd=cowthink
|
|
||||||
customcmd=0
|
|
||||||
else
|
|
||||||
cmd="$PONYSAY_COWTHINK"
|
|
||||||
customcmd=1
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
|
# Ponysay version print function
|
||||||
version() {
|
version() {
|
||||||
echo "ponysay v$version"
|
echo "ponysay v$VERSION"
|
||||||
}
|
}
|
||||||
|
|
||||||
scrw=`(stty size <&2 || echo 0 0) | cut -d ' ' -f 2`
|
# Pony list function
|
||||||
listcmd="${SCRIPTDIR}/../lib/ponysay/list.pl"
|
|
||||||
linklistcmd="${SCRIPTDIR}/../lib/ponysay/linklist.pl"
|
|
||||||
truncatercmd="${SCRIPTDIR}/../lib/ponysay/truncater"
|
|
||||||
[[ -f "./ponysaylist.pl" ]] && listcmd="./ponysaylist.pl"
|
|
||||||
[[ -f "./ponysaylinklist.pl" ]] && linklistcmd="./ponysaylinklist.pl"
|
|
||||||
[[ -f "./ponysaytruncater" ]] && truncatercmd="./ponysaytruncater"
|
|
||||||
|
|
||||||
haspq=1
|
|
||||||
if [[ -f './pq4ps-list' ]]; then
|
|
||||||
function qlist {
|
|
||||||
./pq4ps-list
|
|
||||||
}
|
|
||||||
elif [[ -f '/usr/bin/pq4ps-list' ]]; then
|
|
||||||
function qlist {
|
|
||||||
/usr/bin/pq4ps-list
|
|
||||||
}
|
|
||||||
else
|
|
||||||
haspq=0
|
|
||||||
function qlist {
|
|
||||||
cat
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
|
|
||||||
list() {
|
list() {
|
||||||
echo -e "\\e[01mponyfiles located in $SYSTEMPONIES:\\e[21m"
|
if [[ -d $SYSTEMPONIES ]]; then
|
||||||
perl $listcmd $scrw $(ls --color=no $SYSTEMPONIES | sed -e 's/\.pony$//' | sort) | qlist
|
echo -e "\\e[01mponyfiles located in $SYSTEMPONIES:\\e[21m"
|
||||||
|
perl $listcmd $scrw $(ls --color=no $SYSTEMPONIES | sed -e 's/\.pony$//' | sort) | $qlistcmd
|
||||||
|
fi
|
||||||
if [[ -d $HOMEPONIES ]]; then
|
if [[ -d $HOMEPONIES ]]; then
|
||||||
echo -e "\\e[01mponyfiles located in $HOMEPONIES:\\e[21m"
|
echo -e "\\e[01mponyfiles located in $HOMEPONIES:\\e[21m"
|
||||||
perl $listcmd $scrw $(ls --color=no $HOMEPONIES | sed -e 's/\.pony$//' | sort) | qlist
|
perl $listcmd $scrw $(ls --color=no $HOMEPONIES | sed -e 's/\.pony$//' | sort) | $qlistcmd
|
||||||
|
fi
|
||||||
|
if [[ ! -d $SYSTEMPONIES ]] && [[ ! -d $HOMEPONIES ]]; then
|
||||||
|
echo >&2 "All the ponies are missing! Call the Princess!"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Pony list function with symlink map, for one directory
|
||||||
_linklist() {
|
_linklist() {
|
||||||
echo -e "\\e[01mponyfiles located in $1:\\e[21m"
|
echo -e "\\e[01mponyfiles located in $1:\\e[21m"
|
||||||
files=$(ls --color=no $1 | sed -e 's/\.pony$//' | sort)
|
files=$(ls --color=no $1 | sed -e 's/\.pony$//' | sort)
|
||||||
|
@ -93,11 +99,10 @@ _linklist() {
|
||||||
args=$(echo $args $file $target)
|
args=$(echo $args $file $target)
|
||||||
done
|
done
|
||||||
|
|
||||||
scrw=`(stty size <&2 || echo 0 0) | cut -d ' ' -f 2`
|
perl $listcmd $scrw $(perl $linklistcmd $(echo $args) | sed -e 's/ /_/g') | sed -e 's/_/ /g' | $qlistcmd
|
||||||
|
|
||||||
perl $listcmd $scrw $(perl $linklistcmd $(echo $args) | sed -e 's/ /_/g') | sed -e 's/_/ /g' | qlist
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Pony list function with symlink map, for both directories
|
||||||
linklist() {
|
linklist() {
|
||||||
_linklist $SYSTEMPONIES
|
_linklist $SYSTEMPONIES
|
||||||
|
|
||||||
|
@ -106,6 +111,13 @@ linklist() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Pony quotes
|
||||||
|
ponyquotes() {
|
||||||
|
[[ "$TERM" = "-linux-" ]] && TERM="linux"
|
||||||
|
"$0" ${wrap:+-W$wrap} $("$quotecmd" "$*")
|
||||||
|
}
|
||||||
|
|
||||||
|
# Usage help print function
|
||||||
usage() {
|
usage() {
|
||||||
version
|
version
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
|
@ -120,15 +132,7 @@ Options:
|
||||||
-h Show this help and exit.
|
-h Show this help and exit.
|
||||||
-l List pony files.
|
-l List pony files.
|
||||||
-L List pony files with synonyms inside brackets.
|
-L List pony files with synonyms inside brackets.
|
||||||
EOF
|
|
||||||
|
|
||||||
if [[ $haspq = 1 ]]; then
|
|
||||||
cat <<EOF
|
|
||||||
-q Use the pony quote feature.
|
-q Use the pony quote feature.
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat <<EOF
|
|
||||||
-f[name] Select a pony (either a file name or a pony name.)
|
-f[name] Select a pony (either a file name or a pony name.)
|
||||||
-W[column] The screen column where the message should be wrapped.
|
-W[column] The screen column where the message should be wrapped.
|
||||||
|
|
||||||
|
@ -136,41 +140,41 @@ See man ponysay(6) for more information.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
# if no stdin and no arguments then print usage and exit
|
# Function for printing the ponies and the message
|
||||||
if [[ -t 0 && $# == 0 ]]; then
|
|
||||||
usage
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
say() {
|
say() {
|
||||||
# Ponies use UTF-8 drawing characters. Prevent a Perl warning.
|
# Ponies use UTF-8 drawing characters. Prevent a Perl warning.
|
||||||
export PERL_UNICODE=S
|
export PERL_UNICODE=S
|
||||||
|
|
||||||
if [ "$TERM" = "linux" ] || [ "$TERM" = "-linux-" ]; then
|
# Clear screen in TTY
|
||||||
echo -ne '\e[H\e[2J'
|
( [[ "$TERM" = "linux" ]] || [[ "$TERM" = "-linux-" ]]) && echo -ne '\e[H\e[2J'
|
||||||
fi
|
|
||||||
|
# Set PONYSAY_SHELL_LINES to default if not specified
|
||||||
|
[[ "$PONYSAY_SHELL_LINES" = "" ]] && PONYSAY_SHELL_LINES=2
|
||||||
|
|
||||||
|
# Width trunction
|
||||||
function wtrunc {
|
function wtrunc {
|
||||||
if [ "$PONYSAY_FULL_WIDTH" = 'yes' ] || [ "$PONYSAY_FULL_WIDTH" = 'y' ] || [ "$PONYSAY_FULL_WIDTH" = '1' ]; then
|
if [ "$PONYSAY_FULL_WIDTH" = 'yes' ] || [ "$PONYSAY_FULL_WIDTH" = 'y' ] || [ "$PONYSAY_FULL_WIDTH" = '1' ]; then
|
||||||
cat
|
cat
|
||||||
else
|
else
|
||||||
WIDTH=`(stty size <&2 || echo 0 0) | cut -d ' ' -f 2`
|
if [[ -f $truncatercmd ]]; then
|
||||||
$truncatercmd $WIDTH 2>/dev/null || cat
|
$truncatercmd $scrw
|
||||||
|
else
|
||||||
|
cat
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$PONYSAY_SHELL_LINES" = "" ]; then
|
# Height trunction, show top
|
||||||
PONYSAY_SHELL_LINES=2
|
|
||||||
fi
|
|
||||||
|
|
||||||
function htrunchead {
|
function htrunchead {
|
||||||
head --lines=$(( `stty size <&2 | cut -d ' ' -f 1` - $PONYSAY_SHELL_LINES ))
|
head --lines=$(( $scrh - $PONYSAY_SHELL_LINES ))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Height trunction, show bottom
|
||||||
function htrunctail {
|
function htrunctail {
|
||||||
tail --lines=$(( `stty size <&2 | cut -d ' ' -f 1` - $PONYSAY_SHELL_LINES ))
|
tail --lines=$(( $scrh - $PONYSAY_SHELL_LINES ))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Simplification of customisation of cowsay
|
||||||
if [[ $customcmd = 0 ]]; then
|
if [[ $customcmd = 0 ]]; then
|
||||||
function cowcmd {
|
function cowcmd {
|
||||||
pcmd='#!/usr/bin/perl\nuse utf8;'
|
pcmd='#!/usr/bin/perl\nuse utf8;'
|
||||||
|
@ -186,11 +190,11 @@ say() {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
function cowcmd {
|
function cowcmd {
|
||||||
echo "custom $cmd"
|
|
||||||
$cmd "$@"
|
$cmd "$@"
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# KMS ponies support
|
||||||
if [[ "$kmscmd" = "" ]]; then
|
if [[ "$kmscmd" = "" ]]; then
|
||||||
function runcmd {
|
function runcmd {
|
||||||
cowcmd -f "$pony" "$@"
|
cowcmd -f "$pony" "$@"
|
||||||
|
@ -200,7 +204,8 @@ say() {
|
||||||
cowcmd -f <($kmscmd "$pony") "$@"
|
cowcmd -f <($kmscmd "$pony") "$@"
|
||||||
}
|
}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Print the pony and the message
|
||||||
if [ "$TERM" = "linux" ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = 'yes' ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = 'y' ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = '1' ]; then
|
if [ "$TERM" = "linux" ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = 'yes' ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = 'y' ] || [ "$PONYSAY_TRUNCATE_HEIGHT" = '1' ]; then
|
||||||
if [ "$PONYSAY_BOTTOM" = 'yes' ] || [ "$PONYSAY_BOTTOM" = 'y' ] || [ "$PONYSAY_BOTTOM" = '1' ]; then
|
if [ "$PONYSAY_BOTTOM" = 'yes' ] || [ "$PONYSAY_BOTTOM" = 'y' ] || [ "$PONYSAY_BOTTOM" = '1' ]; then
|
||||||
runcmd "${wrap:+-W$wrap}" | wtrunc | htrunctail
|
runcmd "${wrap:+-W$wrap}" | wtrunc | htrunctail
|
||||||
|
@ -212,15 +217,18 @@ say() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
ponies=()
|
|
||||||
|
|
||||||
opts="f:W:Llhv"
|
|
||||||
if [[ $haspq ]]; then
|
# If no stdin and no arguments then print usage and exit
|
||||||
opts=$opts"q"
|
if [[ -t 0 && $# == 0 ]]; then
|
||||||
|
usage
|
||||||
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
usepq=0
|
|
||||||
while getopts $opts OPT; do
|
|
||||||
|
# Parse options
|
||||||
|
while getopts "f:W:Llhvq" OPT; do
|
||||||
case ${OPT} in
|
case ${OPT} in
|
||||||
v) version; exit ;;
|
v) version; exit ;;
|
||||||
h) usage; exit ;;
|
h) usage; exit ;;
|
||||||
|
@ -228,27 +236,14 @@ while getopts $opts OPT; do
|
||||||
l) list; exit ;;
|
l) list; exit ;;
|
||||||
L) linklist; exit ;;
|
L) linklist; exit ;;
|
||||||
W) wrap="$OPTARG" ;;
|
W) wrap="$OPTARG" ;;
|
||||||
q) usepq=1 ;;
|
q) ponyquotes; exit ;;
|
||||||
\?) usage >&2; exit 1 ;;
|
\?) usage >&2; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $((OPTIND - 1))
|
shift $((OPTIND - 1))
|
||||||
|
|
||||||
if [[ $usepq = 1 ]]; then
|
|
||||||
if [[ -f './pq4ps' ]]; then
|
|
||||||
function q {
|
|
||||||
./pq4ps $@
|
|
||||||
}
|
|
||||||
elif [[ -f '/usr/bin/pq4ps' ]]; then
|
|
||||||
function q {
|
|
||||||
/usr/bin/pq4ps $@
|
|
||||||
}
|
|
||||||
fi
|
|
||||||
[[ "$TERM" = "-linux-" ]] && TERM="linux"
|
|
||||||
$0 ${wrap:+-W$wrap} $(q "$*")
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
# Check for cowsay
|
||||||
hash $cmd &>/dev/null; if [ $? -ne 0 ]; then
|
hash $cmd &>/dev/null; if [ $? -ne 0 ]; then
|
||||||
cat >&2 <<EOF
|
cat >&2 <<EOF
|
||||||
You don't seem to have the $cmd program.
|
You don't seem to have the $cmd program.
|
||||||
|
@ -260,13 +255,15 @@ EOF
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Select random pony for the set of -f arguments
|
||||||
if [[ ! ${#ponies[@]} == 0 ]]; then
|
if [[ ! ${#ponies[@]} == 0 ]]; then
|
||||||
pony="${ponies[$RANDOM%${#ponies[@]}]}"
|
pony="${ponies[$RANDOM%${#ponies[@]}]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Pony not a file? Search for it
|
||||||
if [[ ! -f $pony ]]; then
|
if [[ ! -f $pony ]]; then
|
||||||
# Pony not a file? Search for it
|
|
||||||
|
|
||||||
ponies=()
|
ponies=()
|
||||||
[[ -d $SYSTEMPONIES ]] && ponies+=( "$SYSTEMPONIES"/$pony.pony )
|
[[ -d $SYSTEMPONIES ]] && ponies+=( "$SYSTEMPONIES"/$pony.pony )
|
||||||
[[ -d $HOMEPONIES ]] && ponies+=( "$HOMEPONIES"/$pony.pony )
|
[[ -d $HOMEPONIES ]] && ponies+=( "$HOMEPONIES"/$pony.pony )
|
||||||
|
@ -280,10 +277,13 @@ if [[ ! -f $pony ]]; then
|
||||||
pony="${ponies[$RANDOM%${#ponies[@]}]}"
|
pony="${ponies[$RANDOM%${#ponies[@]}]}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Print pony with message
|
||||||
if [[ -n "$*" ]]; then
|
if [[ -n "$*" ]]; then
|
||||||
# Handle a message given via arguments
|
# Handle a message given via arguments
|
||||||
say <<<"$*"
|
say <<<"$*"
|
||||||
else
|
else
|
||||||
|
# Handle a message given in stdin
|
||||||
say
|
say
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
BIN
ponysay.pdf
BIN
ponysay.pdf
Binary file not shown.
14
pq4ps
14
pq4ps
|
@ -1,15 +1,17 @@
|
||||||
#!/bin/bash
|
#!/bin/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
|
if [[ $# == 1 ]] && [[ "$1" == '-l' || "$1" == '--list' ]]; then
|
||||||
perl $0.pl | cut -d @ -f 1 | uniq
|
perl "$0.pl" "$INSTALLDIR" | cut -d @ -f 1 | uniq
|
||||||
else
|
else
|
||||||
_ponies="$(perl $0.pl)"
|
_ponies="$(perl "$0.pl" "$INSTALLDIR")"
|
||||||
ponies=()
|
ponies=()
|
||||||
|
|
||||||
if [[ ! $# == 0 ]]; then
|
if (( $# > 1 )); then
|
||||||
p=""
|
p=()
|
||||||
for arg in "$@"; do
|
for arg in "$@"; do
|
||||||
p=$p$(echo "$_ponies" | grep "^$arg@")" "
|
p+=( $(echo "$_ponies" | grep "^$arg@") )
|
||||||
done
|
done
|
||||||
_ponies=$p
|
_ponies=$p
|
||||||
fi
|
fi
|
||||||
|
@ -32,7 +34,7 @@ else
|
||||||
|
|
||||||
p="$(echo $pony | cut -d '@' -f 1)"
|
p="$(echo $pony | cut -d '@' -f 1)"
|
||||||
f="$(echo $pony | cut -d '@' -f 2)"
|
f="$(echo $pony | cut -d '@' -f 2)"
|
||||||
q="$(cat "/usr/share/ponysay/quotes/$f")"
|
q="$(cat "$INSTALLDIR/share/ponysay/quotes/$f")"
|
||||||
|
|
||||||
echo "-f" $p $q
|
echo "-f" $p $q
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cmd=$(echo $0 | sed -e 's/\-list$//g')
|
cmd="$(echo "$0" | sed -e 's/\-list$//g')"
|
||||||
pl=$0.pl
|
pl="$0.pl"
|
||||||
|
|
||||||
bash -c "$($pl $($cmd --list))"
|
bash -c "$("$pl" $($cmd --list))"
|
||||||
|
|
4
pq4ps.pl
4
pq4ps.pl
|
@ -1,9 +1,9 @@
|
||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
|
||||||
opendir(DIR, "/usr/share/ponysay/ponies/");
|
opendir(DIR, $ARGV[0]."/share/ponysay/ponies/");
|
||||||
@files = readdir(DIR);
|
@files = readdir(DIR);
|
||||||
|
|
||||||
opendir(DIR, "/usr/share/ponysay/quotes/");
|
opendir(DIR, $ARGV[0]."/share/ponysay/quotes/");
|
||||||
@quotes = readdir(DIR);
|
@quotes = readdir(DIR);
|
||||||
|
|
||||||
|
|
||||||
|
|
1
share/ponysay/ponies
Symbolic link
1
share/ponysay/ponies
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../ponies/
|
1
share/ponysay/quotes
Symbolic link
1
share/ponysay/quotes
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../quotes/
|
1
share/ponysay/ttyponies
Symbolic link
1
share/ponysay/ttyponies
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../../ttyponies/
|
1
ttyponies/elsie.pony
Symbolic link
1
ttyponies/elsie.pony
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
./prettyvision.pony
|
Loading…
Reference in a new issue