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/depend.py | |
parent | 80e76f70d58672167b17ddaced6c7856ba703ece (diff) | |
download | bugseverywhere-cfae8a8302f06a84196700138d7ddbb25e91ea31.tar.gz |
Added UserInterface and other improved abstractions for command handling
Diffstat (limited to 'libbe/command/depend.py')
-rw-r--r-- | libbe/command/depend.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/libbe/command/depend.py b/libbe/command/depend.py index 5e476fc..9068f3a 100644 --- a/libbe/command/depend.py +++ b/libbe/command/depend.py @@ -45,35 +45,37 @@ class Depend (libbe.command.Command): >>> import sys >>> import libbe.bugdir >>> bd = libbe.bugdir.SimpleBugDir(memory=False) - >>> cmd = Depend() - >>> 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 = Depend(ui=ui) - >>> ret = cmd.run(args=['/a', '/b']) + >>> ret = ui.run(cmd, args=['/a', '/b']) a blocked by: b - >>> ret = cmd.run(args=['/a']) + >>> ret = ui.run(cmd, args=['/a']) a blocked by: b - >>> ret = cmd.run({'show-status':True}, ['/a']) # doctest: +NORMALIZE_WHITESPACE + >>> ret = ui.run(cmd, {'show-status':True}, ['/a']) # doctest: +NORMALIZE_WHITESPACE a blocked by: b closed - >>> ret = cmd.run(args=['/b', '/a']) + >>> ret = ui.run(cmd, args=['/b', '/a']) b blocked by: a b blocks: a - >>> ret = cmd.run({'show-status':True}, ['/a']) # doctest: +NORMALIZE_WHITESPACE + >>> ret = ui.run(cmd, {'show-status':True}, ['/a']) # doctest: +NORMALIZE_WHITESPACE a blocked by: b closed a blocks: b closed - >>> ret = cmd.run({'repair':True}) - >>> ret = cmd.run({'remove':True}, ['/b', '/a']) + >>> ret = ui.run(cmd, {'repair':True}) + >>> ret = ui.run(cmd, {'remove':True}, ['/b', '/a']) b blocks: a - >>> ret = cmd.run({'remove':True}, ['/a', '/b']) + >>> ret = ui.run(cmd, {'remove':True}, ['/a', '/b']) + >>> ui.cleanup() >>> bd.cleanup() """ name = 'depend' |