removing old stuff

This commit is contained in:
Mattias Andrée 2012-08-18 17:16:05 +02:00
parent 2e4e6474a5
commit 97329adb57

View file

@ -1,16 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
VERSION=1.4.1
# Get bash script directory's parent # Get bash script directory's parent
INSTALLDIR="$(dirname $( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))" INSTALLDIR="$(dirname $( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd ))"
# Directory for installed media files
SYSTEMSHARE="$INSTALLDIR/share/ponysay"
HOMESHARE="${HOME}/.local/share/ponysay"
# Subscripts # Subscripts
listcmd="$INSTALLDIR/lib/ponysay/list.pl" listcmd="$INSTALLDIR/lib/ponysay/list.pl"
linklistcmd="$INSTALLDIR/lib/ponysay/linklist.pl" linklistcmd="$INSTALLDIR/lib/ponysay/linklist.pl"
@ -30,14 +23,6 @@ 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
SYSTEMPONIES="$SYSTEMSHARE/ttyponies"
HOMEPONIES="$HOMESHARE/ttyponies"
else
SYSTEMPONIES="$SYSTEMSHARE/ponies"
HOMEPONIES="$HOMESHARE/ponies"
fi
# Cowsay script # Cowsay script
if [ ${0} == *ponythink ]; then if [ ${0} == *ponythink ]; then
@ -77,19 +62,6 @@ say() {
# Set PONYSAY_SHELL_LINES to default if not specified # Set PONYSAY_SHELL_LINES to default if not specified
[ "$PONYSAY_SHELL_LINES" = "" ] && PONYSAY_SHELL_LINES=2 [ "$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 # Height trunction, show top
function htrunchead { function htrunchead {
head --lines=$(( $scrh - $PONYSAY_SHELL_LINES )) head --lines=$(( $scrh - $PONYSAY_SHELL_LINES ))
@ -180,36 +152,3 @@ if it actually exists under a different filename.
EOF EOF
exit 1 exit 1
fi 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