From 34b5bbd98e420672ecce64ba085bbf1a4205267e Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Wed, 20 Jan 2010 07:19:56 -0500 Subject: Add better help message on COMMAND-less be call --- libbe/ui/command_line.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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) -- cgit