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/set.py | |
parent | 80e76f70d58672167b17ddaced6c7856ba703ece (diff) | |
download | bugseverywhere-cfae8a8302f06a84196700138d7ddbb25e91ea31.tar.gz |
Added UserInterface and other improved abstractions for command handling
Diffstat (limited to 'libbe/command/set.py')
-rw-r--r-- | libbe/command/set.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/libbe/command/set.py b/libbe/command/set.py index 4fe0117..46a63b4 100644 --- a/libbe/command/set.py +++ b/libbe/command/set.py @@ -34,19 +34,21 @@ class Set (libbe.command.Command): >>> import sys >>> import libbe.bugdir >>> bd = libbe.bugdir.SimpleBugDir(memory=False) - >>> cmd = Set() - >>> 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 = Set(ui=ui) - >>> ret = cmd.run(args=['target']) + >>> ret = ui.run(cmd, args=['target']) None - >>> ret = cmd.run(args=['target', 'abcdefg']) - >>> ret = cmd.run(args=['target']) + >>> ret = ui.run(cmd, args=['target', 'abcdefg']) + >>> ret = ui.run(cmd, args=['target']) abcdefg - >>> ret = cmd.run(args=['target', 'none']) - >>> ret = cmd.run(args=['target']) + >>> ret = ui.run(cmd, args=['target', 'none']) + >>> ret = ui.run(cmd, args=['target']) None + >>> ui.cleanup() >>> bd.cleanup() """ name = 'set' |