add --twisted to use the twisted CLI flavor
This commit is contained in:
		
							parent
							
								
									6d3d0c1cb3
								
							
						
					
					
						commit
						26f512fba4
					
				| 
						 | 
					@ -27,6 +27,8 @@ g.add_argument("--hide-progress", action="store_true",
 | 
				
			||||||
               help="supress progress-bar display")
 | 
					               help="supress progress-bar display")
 | 
				
			||||||
g.add_argument("--dump-timing", type=type(u""), # TODO: hide from --help output
 | 
					g.add_argument("--dump-timing", type=type(u""), # TODO: hide from --help output
 | 
				
			||||||
               metavar="FILE", help="(debug) write timing data to file")
 | 
					               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)
 | 
					parser.set_defaults(timing=None)
 | 
				
			||||||
subparsers = parser.add_subparsers(title="subcommands",
 | 
					subparsers = parser.add_subparsers(title="subcommands",
 | 
				
			||||||
                                   dest="subcommand")
 | 
					                                   dest="subcommand")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,12 +20,20 @@ def dispatch(args):
 | 
				
			||||||
    if args.func == "usage/tail":
 | 
					    if args.func == "usage/tail":
 | 
				
			||||||
        from ..servers import cmd_usage
 | 
					        from ..servers import cmd_usage
 | 
				
			||||||
        return cmd_usage.tail_usage(args)
 | 
					        return cmd_usage.tail_usage(args)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if args.func == "send/send":
 | 
					    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
 | 
					        from . import cmd_send_blocking
 | 
				
			||||||
        return cmd_send_blocking.send_blocking(args)
 | 
					        return cmd_send_blocking.send_blocking(args)
 | 
				
			||||||
    if args.func == "receive/receive":
 | 
					    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
 | 
					        from . import cmd_receive_blocking
 | 
				
			||||||
        return cmd_receive_blocking.receive_blocking(args)
 | 
					        return cmd_receive_blocking.receive_blocking(args)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    raise ValueError("unknown args.func %s" % args.func)
 | 
					    raise ValueError("unknown args.func %s" % args.func)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def run(args, cwd, stdout, stderr, executable=None):
 | 
					def run(args, cwd, stdout, stderr, executable=None):
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user