diff options
author | W. Trevor King <wking@drexel.edu> | 2009-12-31 14:32:39 -0500 |
---|---|---|
committer | W. Trevor King <wking@drexel.edu> | 2009-12-31 14:32:39 -0500 |
commit | cfae8a8302f06a84196700138d7ddbb25e91ea31 (patch) | |
tree | e5e158f424e01edeb83c0d6132af8b5c1d1808ea /libbe/command/show.py | |
parent | 80e76f70d58672167b17ddaced6c7856ba703ece (diff) | |
download | bugseverywhere-cfae8a8302f06a84196700138d7ddbb25e91ea31.tar.gz |
Added UserInterface and other improved abstractions for command handling
Diffstat (limited to 'libbe/command/show.py')
-rw-r--r-- | libbe/command/show.py | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/libbe/command/show.py b/libbe/command/show.py index 1a569a6..5ab6dc7 100644 --- a/libbe/command/show.py +++ b/libbe/command/show.py @@ -34,13 +34,14 @@ class Show (libbe.command.Command): >>> import sys >>> import libbe.bugdir >>> bd = libbe.bugdir.SimpleBugDir(memory=False) - >>> cmd = Show() - >>> cmd._storage = bd.storage - >>> cmd._setup_io = lambda i_enc,o_enc : None - >>> cmd.stdout = sys.stdout - >>> cmd.stdout.encoding = 'ascii' - - >>> ret = cmd.run(args=['/a',]) # doctest: +ELLIPSIS + >>> io = libbe.command.StringInputOutput() + >>> io.stdout = sys.stdout + >>> io.stdout.encoding = 'ascii' + >>> ui = libbe.command.UserInterface(io=io) + >>> ui.storage_callbacks.set_bugdir(bd) + >>> cmd = Show(ui=ui) + + >>> ret = ui.run(cmd, args=['/a',]) # doctest: +ELLIPSIS ID : a Short name : abc/a Severity : minor @@ -52,7 +53,7 @@ class Show (libbe.command.Command): Bug A <BLANKLINE> - >>> ret = cmd.run({'xml':True}, ['/a']) # doctest: +ELLIPSIS + >>> ret = ui.run(cmd, {'xml':True}, ['/a']) # doctest: +ELLIPSIS <?xml version="1.0" encoding="..." ?> <be-xml> <version> @@ -71,6 +72,7 @@ class Show (libbe.command.Command): <summary>Bug A</summary> </bug> </be-xml> + >>> ui.cleanup() >>> bd.cleanup() """ name = 'show' |