mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-26 06:07:59 +01:00
merge conf resolve
This commit is contained in:
commit
4e84c65197
2 changed files with 13 additions and 20 deletions
22
ponysay.py
22
ponysay.py
|
@ -367,15 +367,19 @@ class ponysay():
|
||||||
alts.append(pair)
|
alts.append(pair)
|
||||||
pairs = alts
|
pairs = alts
|
||||||
|
|
||||||
pair = pairs[random.randrange(0, len(pairs))]
|
if not len(pairs) == 0:
|
||||||
qfile = None
|
pair = pairs[random.randrange(0, len(pairs))]
|
||||||
try:
|
qfile = None
|
||||||
qfile = open(pair[1], 'r')
|
try:
|
||||||
args.message = '\n'.join(qfile.readlines())
|
qfile = open(pair[1], 'r')
|
||||||
finally:
|
args.message = '\n'.join(qfile.readlines()).strip()
|
||||||
if qfile is not None:
|
finally:
|
||||||
qfile.close()
|
if qfile is not None:
|
||||||
args.pony = [pair[0]]
|
qfile.close()
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
11
ponysay.sh
11
ponysay.sh
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue