aboutsummaryrefslogtreecommitdiff
path: root/ponysay
diff options
context:
space:
mode:
authorErkin Batu Altunbaş <erkinbatu@gmail.com>2012-04-05 17:17:13 +0200
committerErkin Batu Altunbaş <erkinbatu@gmail.com>2012-04-05 17:17:13 +0200
commit6fab3575cd77eb44764fe569d20ad9dbeeabb294 (patch)
tree1d7649d7bf1c428dca521543d60a9484a4601846 /ponysay
parenta6ca6e858a65acc0434d0bd1ad8ba39ffb0fcc71 (diff)
downloadponysay-6fab3575cd77eb44764fe569d20ad9dbeeabb294.tar.gz
ponysay-6fab3575cd77eb44764fe569d20ad9dbeeabb294.tar.bz2
ponysay-6fab3575cd77eb44764fe569d20ad9dbeeabb294.zip
quick addition of a listing argument
Diffstat (limited to 'ponysay')
-rwxr-xr-xponysay13
1 files changed, 12 insertions, 1 deletions
diff --git a/ponysay b/ponysay
index e7a8702..2f12451 100755
--- a/ponysay
+++ b/ponysay
@@ -13,6 +13,15 @@ version() {
echo "ponysay v$version"
}
+list() {
+ echo "ponyfiles located in $SYSTEMPONIES:"
+ ls -1 $SYSTEMPONIES | sed "s/.pony//"
+ if [[ -d $HOMEPONIES ]]; then
+ echo "ponyfiles located in $HOMEPONIES:"
+ ls -1 $HOMEPONIES | sed "s/.pony//"
+ fi
+}
+
usage() {
version
cat <<EOF
@@ -25,6 +34,7 @@ If [message] is not provided, reads the message from STDIN
Options:
-v Show version and exit
-h Show this help and exit
+ -l List ponyfiles.
-f[name] Select a pony (Either a filename or a pony name)
-W[column] The screen column where the message should be wrapped
EOF
@@ -37,12 +47,13 @@ say() {
exec "$cmd" -f "$pony" "${wrap:+-W$wrap}"
}
-while getopts f:W:hv OPT
+while getopts f:W:lhv OPT
do
case ${OPT} in
v) version; exit ;;
h) usage; exit ;;
f) pony="$OPTARG" ;;
+ l) list; exit ;;
W) wrap="$OPTARG" ;;
\?) usage >&2; exit 1 ;;
esac