From cfae8a8302f06a84196700138d7ddbb25e91ea31 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Thu, 31 Dec 2009 14:32:39 -0500 Subject: Added UserInterface and other improved abstractions for command handling --- libbe/command/help.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libbe/command/help.py') diff --git a/libbe/command/help.py b/libbe/command/help.py index 6e55598..d509d31 100644 --- a/libbe/command/help.py +++ b/libbe/command/help.py @@ -28,11 +28,12 @@ class Help (libbe.command.Command): >>> import sys >>> import libbe.bugdir + >>> io = libbe.command.StringInputOutput() + >>> io.stdout = sys.stdout + >>> ui = libbe.command.UserInterface(io=io) >>> cmd = Help() - >>> cmd._setup_io = lambda i_enc,o_enc : None - >>> cmd.stdout = sys.stdout - >>> ret = cmd.run(args=['help']) + >>> ret = ui.run(cmd, args=['help']) usage: be help [options] [TOPIC] Options: @@ -61,8 +62,7 @@ class Help (libbe.command.Command): elif params['topic'] in libbe.command.commands(): module = libbe.command.get_command(params['topic']) Class = libbe.command.get_command_class(module,params['topic']) - c = Class(get_unconnected_storage=self.get_unconnected_storage, - ui=self.ui) + c = Class(ui=self.ui) print >> self.stdout, c.help().rstrip('\n') elif params['topic'] in TOPICS: print >> self.stdout, TOPICS[params['topic']].rstrip('\n') -- cgit