From 680e149a41a66bd65c8a0dd4f5fd226fc6f92fbd Mon Sep 17 00:00:00 2001 From: Romain Bignon Date: Mon, 26 Apr 2010 20:09:58 +0200 Subject: [PATCH] command 'help' --- weboob/tools/application/prompt.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/weboob/tools/application/prompt.py b/weboob/tools/application/prompt.py index 8bf3ee8b..85bbace3 100644 --- a/weboob/tools/application/prompt.py +++ b/weboob/tools/application/prompt.py @@ -52,6 +52,13 @@ class PromptApplication(ConsoleApplication): def create_weboob(self): return Weboob(self.APPNAME, scheduler=PromptScheduler(self.prompt, self.read_cb)) + @ConsoleApplication.command("Display this notice") + def command_help(self): + print 'Available commands:' + for name, arguments, doc_string in self._commands: + command = '%s %s' % (name, arguments) + print ' %-30s %s' % (command, doc_string) + def prompt(self): sys.stdout.write('> ') sys.stdout.flush() @@ -61,4 +68,5 @@ class PromptApplication(ConsoleApplication): def read_cb(self, line): line = line.split() - self.process_command(*line) + if line: + self.process_command(*line)