aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2012-08-18 19:00:38 +0200
committerMattias Andrée <maandree@operamail.com>2012-08-18 19:00:38 +0200
commit4e84c6519728736e625081bb088b4e5c85df1a9b (patch)
tree21490c39bfd83b964822556422420ee50c0e4b61
parentc2a3c19c9238e1e153e51a4182080e07b809a9da (diff)
parent378da89d3be748c4727839cb240255421fcd5789 (diff)
downloadponysay-4e84c6519728736e625081bb088b4e5c85df1a9b.tar.gz
ponysay-4e84c6519728736e625081bb088b4e5c85df1a9b.tar.bz2
ponysay-4e84c6519728736e625081bb088b4e5c85df1a9b.zip
merge conf resolve
-rwxr-xr-xponysay.py22
-rwxr-xr-xponysay.sh11
2 files changed, 13 insertions, 20 deletions
diff --git a/ponysay.py b/ponysay.py
index 1f52558..969ecb6 100755
--- a/ponysay.py
+++ b/ponysay.py
@@ -367,15 +367,19 @@ class ponysay():
alts.append(pair)
pairs = alts
- pair = pairs[random.randrange(0, len(pairs))]
- qfile = None
- try:
- qfile = open(pair[1], 'r')
- args.message = '\n'.join(qfile.readlines())
- finally:
- if qfile is not None:
- qfile.close()
- args.pony = [pair[0]]
+ 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]]
+ else:
+ args.pony = args.quote
+ args.message = 'I got nuthin\' good to say :('
self.print_pony(args)
diff --git a/ponysay.sh b/ponysay.sh
index 74dca7b..70137bd 100755
--- a/ponysay.sh
+++ b/ponysay.sh
@@ -68,17 +68,6 @@ say() {
fi
}
-
-
-# If no stdin and no arguments then print usage and exit
-if [ -t 0 ] && [ $# == 0 ]; then
- usage
- exit
-fi
-
-
-
-
# Check for cowsay
hash $cmd &>/dev/null; if [ $? -ne 0 ]; then
cat >&2 <<EOF