diff options
author | Mattias Andrée <maandree@operamail.com> | 2012-08-18 19:06:38 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2012-08-18 19:06:38 +0200 |
commit | e8864eb219201d6b3218ebf59897c942dff42f30 (patch) | |
tree | 7e0257b8799b0e99d3607128f4e946bf96fc02f2 | |
parent | 4e84c6519728736e625081bb088b4e5c85df1a9b (diff) | |
download | ponysay-e8864eb219201d6b3218ebf59897c942dff42f30.tar.gz ponysay-e8864eb219201d6b3218ebf59897c942dff42f30.tar.bz2 ponysay-e8864eb219201d6b3218ebf59897c942dff42f30.zip |
further improving quote fallback (you change may fallback quote ☹)
-rwxr-xr-x | ponysay.py | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -84,6 +84,10 @@ parser.add_argument('-q', '--quote', nargs = '*', dest = 'quote', parser.add_argument('message', nargs = '?', help = 'message to ponysay') 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: qfile.close() args.pony = [pair[0]] + elif len(args.quote) == 0: + sys.stderr.write('All the ponies are mute! Call the Princess!') + exit 1 else: - args.pony = args.quote + args.pony = args.quote[random.randrange(0, len(args.quote))] args.message = 'I got nuthin\' good to say :(' self.print_pony(args) |