Fixed `be help` (used to raise NotImplementedError)
authorW. Trevor King <wking@drexel.edu>
Wed, 20 Jan 2010 12:32:56 +0000 (07:32 -0500)
committerW. Trevor King <wking@drexel.edu>
Wed, 20 Jan 2010 12:32:56 +0000 (07:32 -0500)
libbe/command/help.py
libbe/ui/command_line.py

index 8e66405ca2437558fc46e0dfeded659830aaa2fb..1fc88f028bdeb9b23b0193ec89a121a571afa59f 100644 (file)
@@ -58,7 +58,7 @@ class Help (libbe.command.Command):
     def _run(self, **params):
         if params['topic'] == None:
             if hasattr(self.ui, 'help'):
-                self.ui.help()
+                print >> self.stdout, self.ui.help().rstrip('\n')
         elif params['topic'] in libbe.command.commands():
             module = libbe.command.get_command(params['topic'])
             Class = libbe.command.get_command_class(module,params['topic'])
index 17f7b35cd50de82bbb059dd71a78d59a07cdf8e1..9c97eec54a655fcfd71a3590117ef02a2e33f4b3 100644 (file)
@@ -250,6 +250,16 @@ class BE (libbe.command.Command):
     def full_version(self, *args):
         return libbe.version.version(verbose=True)
 
+class CommandLine (libbe.command.UserInterface):
+    def __init__(self, *args, **kwargs):
+        libbe.command.UserInterface.__init__(self, *args, **kwargs)
+        self.restrict_file_access = False
+        self.storage_callbacks = None
+    def help(self):
+        be = BE(ui=self)
+        self.setup_command(be)
+        return be.help()
+
 def dispatch(ui, command, args):
     parser = CmdOptionParser(command)
     try:
@@ -273,9 +283,7 @@ def dispatch(ui, command, args):
 
 def main():
     io = libbe.command.StdInputOutput()
-    ui = libbe.command.UserInterface(io)
-    ui.restrict_file_access = False
-    ui.storage_callbacks = None
+    ui = CommandLine(io)
     be = BE(ui=ui)
     ui.setup_command(be)