mirror of
https://github.com/erkin/ponysay.git
synced 2024-11-23 04:47:59 +01:00
further improving quote fallback (you change may fallback quote ☹)
This commit is contained in:
parent
4e84c65197
commit
e8864eb219
1 changed files with 8 additions and 1 deletions
|
@ -84,6 +84,10 @@ parser.add_argument('-q', '--quote', nargs = '*', dest = 'quote',
|
||||||
parser.add_argument('message', nargs = '?', help = 'message to ponysay')
|
parser.add_argument('message', nargs = '?', help = 'message to ponysay')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
# TODO implement if [ -t 0 ] && [ $# == 0 ]; then
|
||||||
|
# usage
|
||||||
|
# exit
|
||||||
|
# fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -377,8 +381,11 @@ class ponysay():
|
||||||
if qfile is not None:
|
if qfile is not None:
|
||||||
qfile.close()
|
qfile.close()
|
||||||
args.pony = [pair[0]]
|
args.pony = [pair[0]]
|
||||||
|
elif len(args.quote) == 0:
|
||||||
|
sys.stderr.write('All the ponies are mute! Call the Princess!')
|
||||||
|
exit 1
|
||||||
else:
|
else:
|
||||||
args.pony = args.quote
|
args.pony = args.quote[random.randrange(0, len(args.quote))]
|
||||||
args.message = 'I got nuthin\' good to say :('
|
args.message = 'I got nuthin\' good to say :('
|
||||||
|
|
||||||
self.print_pony(args)
|
self.print_pony(args)
|
||||||
|
|
Loading…
Reference in a new issue