command 'help'
This commit is contained in:
parent
31433c1610
commit
680e149a41
1 changed files with 9 additions and 1 deletions
|
|
@ -52,6 +52,13 @@ class PromptApplication(ConsoleApplication):
|
||||||
def create_weboob(self):
|
def create_weboob(self):
|
||||||
return Weboob(self.APPNAME, scheduler=PromptScheduler(self.prompt, self.read_cb))
|
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):
|
def prompt(self):
|
||||||
sys.stdout.write('> ')
|
sys.stdout.write('> ')
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
@ -61,4 +68,5 @@ class PromptApplication(ConsoleApplication):
|
||||||
|
|
||||||
def read_cb(self, line):
|
def read_cb(self, line):
|
||||||
line = line.split()
|
line = line.split()
|
||||||
|
if line:
|
||||||
self.process_command(*line)
|
self.process_command(*line)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue