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/remove.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'libbe/command/remove.py') diff --git a/libbe/command/remove.py b/libbe/command/remove.py index 3b9d3f3..c6d481f 100644 --- a/libbe/command/remove.py +++ b/libbe/command/remove.py @@ -26,14 +26,15 @@ class Remove (libbe.command.Command): >>> import sys >>> import libbe.bugdir >>> bd = libbe.bugdir.SimpleBugDir(memory=False) - >>> cmd = Remove() - >>> cmd._storage = bd.storage - >>> cmd._setup_io = lambda i_enc,o_enc : None - >>> cmd.stdout = sys.stdout + >>> io = libbe.command.StringInputOutput() + >>> io.stdout = sys.stdout + >>> ui = libbe.command.UserInterface(io=io) + >>> ui.storage_callbacks.set_storage(bd.storage) + >>> cmd = Remove(ui=ui) >>> print bd.bug_from_uuid('b').status closed - >>> ret = cmd.run(args=['/b']) + >>> ret = ui.run(cmd, args=['/b']) Removed bug abc/b >>> bd.flush_reload() >>> try: @@ -41,6 +42,7 @@ class Remove (libbe.command.Command): ... except libbe.bugdir.NoBugMatches: ... print 'Bug not found' Bug not found + >>> ui.cleanup() >>> bd.cleanup() """ name = 'remove' -- cgit