merge conf resolve

This commit is contained in:
Mattias Andrée 2012-08-18 19:00:38 +02:00
commit 4e84c65197
2 changed files with 13 additions and 20 deletions

View file

@ -367,15 +367,19 @@ class ponysay():
alts.append(pair) alts.append(pair)
pairs = alts pairs = alts
if not len(pairs) == 0:
pair = pairs[random.randrange(0, len(pairs))] pair = pairs[random.randrange(0, len(pairs))]
qfile = None qfile = None
try: try:
qfile = open(pair[1], 'r') qfile = open(pair[1], 'r')
args.message = '\n'.join(qfile.readlines()) args.message = '\n'.join(qfile.readlines()).strip()
finally: finally:
if qfile is not None: if qfile is not None:
qfile.close() qfile.close()
args.pony = [pair[0]] args.pony = [pair[0]]
else:
args.pony = args.quote
args.message = 'I got nuthin\' good to say :('
self.print_pony(args) self.print_pony(args)

View file

@ -68,17 +68,6 @@ say() {
fi fi
} }
# If no stdin and no arguments then print usage and exit
if [ -t 0 ] && [ $# == 0 ]; then
usage
exit
fi
# Check for cowsay # 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