From 13a5c0eda5ec90dbbf439df02ddcea3298c2c73b Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 3 Jun 2010 11:55:02 -0400 Subject: [PATCH] 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] ... --- hooke/hooke.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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__) -- 2.26.2