From: W. Trevor King Date: Wed, 20 Jan 2010 12:19:56 +0000 (-0500) Subject: Add better help message on COMMAND-less be call X-Git-Tag: 1.0.0~59^2~46^2~19 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=34b5bbd98e420672ecce64ba085bbf1a4205267e;p=be.git Add better help message on COMMAND-less be call --- diff --git a/libbe/ui/command_line.py b/libbe/ui/command_line.py index 7ba6cf5..17f7b35 100644 --- a/libbe/ui/command_line.py +++ b/libbe/ui/command_line.py @@ -285,7 +285,14 @@ def main(): except CallbackExit: return 0 except libbe.command.UserError, e: - print >> ui.io.stdout, 'ERROR:\n', e + if str(e).endswith('COMMAND'): + # no command given, print usage string + print >> ui.io.stdout, 'ERROR:' + print >> ui.io.stdout, be.usage(), '\n', e + print >> ui.io.stdout, 'For example, try' + print >> ui.io.stdout, ' be help' + else: + print >> ui.io.stdout, 'ERROR:\n', e return 1 command_name = args.pop(0)