aboutsummaryrefslogtreecommitdiff
path: root/ponysay
diff options
context:
space:
mode:
authorJan Alexander Steffens (heftig) <jan.steffens@gmail.com>2012-02-26 20:12:59 +0100
committerJan Alexander Steffens (heftig) <jan.steffens@gmail.com>2012-02-26 20:13:34 +0100
commit2ddfe9d19b22cabf34f5670da0dbcd3f6cec52e9 (patch)
treef9cc38554d3cc75e6f02c0694ced00c74008dead /ponysay
parent0d3de45f023040a06651d72effd1cc0a56a50c9d (diff)
downloadponysay-2ddfe9d19b22cabf34f5670da0dbcd3f6cec52e9.tar.gz
ponysay-2ddfe9d19b22cabf34f5670da0dbcd3f6cec52e9.tar.bz2
ponysay-2ddfe9d19b22cabf34f5670da0dbcd3f6cec52e9.zip
Add support for passing through -W
Diffstat (limited to 'ponysay')
-rwxr-xr-xponysay9
1 files changed, 6 insertions, 3 deletions
diff --git a/ponysay b/ponysay
index 1fcecad..5fe2e7c 100755
--- a/ponysay
+++ b/ponysay
@@ -4,6 +4,7 @@ version=0.4
SYSTEMPONIES=/usr/share/ponies
HOMEPONIES="${HOME}/.ponies"
pony=
+wrap=
cmd=cowsay
[[ ${0} == *ponythink ]] && cmd=cowthink
@@ -22,14 +23,16 @@ usage() {
echo " -v Show version and exit"
echo " -h Show this help and exit"
echo " -f[name] Select a pony (Either a filename or a pony name)"
+ echo " -W[column] The screen column where the message should be wrapped"
}
-while getopts f:hv OPT
+while getopts f:W:hv OPT
do
case ${OPT} in
v) version; exit ;;
h) usage; exit ;;
- f) pony=$OPTARG ;;
+ f) pony="$OPTARG" ;;
+ W) wrap="$OPTARG" ;;
\?) usage >&2; exit 1 ;;
esac
done
@@ -57,4 +60,4 @@ fi
# Ponies use UTF-8 drawing characters. Prevent a Perl warning.
export PERL_UNICODE=S
-exec "$cmd" -f "$pony"
+exec "$cmd" -f "$pony" "${wrap:+-W$wrap}"