diff --git a/src/wormhole/scripts/cli_args.py b/src/wormhole/scripts/cli_args.py index 369ab20..fd8e11f 100644 --- a/src/wormhole/scripts/cli_args.py +++ b/src/wormhole/scripts/cli_args.py @@ -27,6 +27,8 @@ g.add_argument("--hide-progress", action="store_true", help="supress progress-bar display") g.add_argument("--dump-timing", type=type(u""), # TODO: hide from --help output metavar="FILE", help="(debug) write timing data to file") +g.add_argument("--twisted", action="store_true", + help="use Twisted-based implementations, for testing") parser.set_defaults(timing=None) subparsers = parser.add_subparsers(title="subcommands", dest="subcommand") diff --git a/src/wormhole/scripts/runner.py b/src/wormhole/scripts/runner.py index d68b353..f89f01e 100644 --- a/src/wormhole/scripts/runner.py +++ b/src/wormhole/scripts/runner.py @@ -20,12 +20,20 @@ def dispatch(args): if args.func == "usage/tail": from ..servers import cmd_usage return cmd_usage.tail_usage(args) + if args.func == "send/send": + if args.twisted: + from . import cmd_send_twisted + return cmd_send_twisted.send_twisted_sync(args) from . import cmd_send_blocking return cmd_send_blocking.send_blocking(args) if args.func == "receive/receive": + if args.twisted: + from . import cmd_receive_twisted + return cmd_receive_twisted.receive_twisted_sync(args) from . import cmd_receive_blocking return cmd_receive_blocking.receive_blocking(args) + raise ValueError("unknown args.func %s" % args.func) def run(args, cwd, stdout, stderr, executable=None):