From: W. Trevor King Date: Thu, 3 Jun 2010 15:55:02 +0000 (-0400) Subject: Fix help message when too many arguments are passed to Hooke. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=13a5c0eda5ec90dbbf439df02ddcea3298c2c73b;p=hooke.git Fix help message when too many arguments are passed to Hooke. Previously, $ python bin/hooke x would raise an exception. Now it prints an error message and hooke's help: More than 0 arguments to bin/hooke: ['x'] Usage: hooke [options] ... --- diff --git a/hooke/hooke.py b/hooke/hooke.py index 859d634..6b49757 100644 --- a/hooke/hooke.py +++ b/hooke/hooke.py @@ -163,9 +163,9 @@ def main(): help='Add a command line Hooke command to run.') options,arguments = p.parse_args() if len(arguments) > 0: - print >> sys.stderr, 'Too many arguments to %s: %d > 0' \ - % (sys.argv[0], len(arguments)) - print >> sys.stderr, p.help() + print >> sys.stderr, 'More than 0 arguments to %s: %s' \ + % (sys.argv[0], arguments) + p.print_help(sys.stderr) sys.exit(1) hooke = Hooke(debug=__debug__)