diff --git a/src/wormhole/scripts/cmd_receive_file.py b/src/wormhole/scripts/cmd_receive_file.py index a24ea9e..aefdff6 100644 --- a/src/wormhole/scripts/cmd_receive_file.py +++ b/src/wormhole/scripts/cmd_receive_file.py @@ -14,6 +14,9 @@ def receive_file(args): transit_receiver = TransitReceiver(args.transit_helper) r = Receiver(APPID, args.relay_url) + if args.zeromode: + assert not args.code + args.code = "0-" code = args.code if not code: code = r.input_code("Enter receive-file wormhole code: ", diff --git a/src/wormhole/scripts/cmd_receive_text.py b/src/wormhole/scripts/cmd_receive_text.py index 93cf95b..64ba2da 100644 --- a/src/wormhole/scripts/cmd_receive_text.py +++ b/src/wormhole/scripts/cmd_receive_text.py @@ -10,6 +10,9 @@ def receive_text(args): from ..blocking.transcribe import Receiver, WrongPasswordError r = Receiver(APPID, args.relay_url) + if args.zeromode: + assert not args.code + args.code = "0-" code = args.code if not code: code = r.input_code("Enter receive-text wormhole code: ", diff --git a/src/wormhole/scripts/cmd_send_file.py b/src/wormhole/scripts/cmd_send_file.py index fb15c68..8858bc4 100644 --- a/src/wormhole/scripts/cmd_send_file.py +++ b/src/wormhole/scripts/cmd_send_file.py @@ -16,6 +16,9 @@ def send_file(args): transit_sender = TransitSender(args.transit_helper) i = Initiator(APPID, args.relay_url) + if args.zeromode: + assert not args.code + args.code = "0-" if args.code: i.set_code(args.code) code = args.code @@ -24,8 +27,11 @@ def send_file(args): other_cmd = "wormhole receive-file" if args.verify: other_cmd = "wormhole --verify receive-file" + if args.zeromode: + other_cmd += " -0" print("On the other computer, please run: %s" % other_cmd) - print("Wormhole code is '%s'" % code) + if not args.zeromode: + print("Wormhole code is '%s'" % code) print() if args.verify: diff --git a/src/wormhole/scripts/cmd_send_text.py b/src/wormhole/scripts/cmd_send_text.py index b10ce56..c25620f 100644 --- a/src/wormhole/scripts/cmd_send_text.py +++ b/src/wormhole/scripts/cmd_send_text.py @@ -10,6 +10,9 @@ def send_text(args): from ..blocking.transcribe import Initiator, WrongPasswordError i = Initiator(APPID, args.relay_url) + if args.zeromode: + assert not args.code + args.code = "0-" if args.code: i.set_code(args.code) code = args.code @@ -18,8 +21,11 @@ def send_text(args): other_cmd = "wormhole receive-text" if args.verify: other_cmd = "wormhole --verify receive-text" + if args.zeromode: + other_cmd += " -0" print("On the other computer, please run: %s" % other_cmd) - print("Wormhole code is: %s" % code) + if not args.zeromode: + print("Wormhole code is: %s" % code) print("") if args.verify: diff --git a/src/wormhole/scripts/runner.py b/src/wormhole/scripts/runner.py index e857da7..fb99d20 100644 --- a/src/wormhole/scripts/runner.py +++ b/src/wormhole/scripts/runner.py @@ -57,12 +57,16 @@ sp_restart.set_defaults(func=cmd_server.restart_server) p = subparsers.add_parser("send-text", description="Send a text mesasge", usage="wormhole send-text TEXT") p.add_argument("--code", metavar="CODE", help="human-generated code phrase") +p.add_argument("-0", dest="zeromode", action="store_true", + help="enable no-code anything-goes mode") p.add_argument("text", metavar="TEXT", help="the message to send (a string)") p.set_defaults(func=cmd_send_text.send_text) # CLI: receive-text p = subparsers.add_parser("receive-text", description="Receive a text message", usage="wormhole receive-text [CODE]") +p.add_argument("-0", dest="zeromode", action="store_true", + help="enable no-code anything-goes mode") p.add_argument("code", nargs="?", default=None, metavar="[CODE]", help=dedent("""\ The magic-wormhole code, from the sender. If omitted, the @@ -74,6 +78,8 @@ p.set_defaults(func=cmd_receive_text.receive_text) p = subparsers.add_parser("send-file", description="Send a file", usage="wormhole send-file FILENAME") p.add_argument("--code", metavar="CODE", help="human-generated code phrase") +p.add_argument("-0", dest="zeromode", action="store_true", + help="enable no-code anything-goes mode") p.add_argument("filename", metavar="FILENAME", help="The file to be sent") p.set_defaults(func=cmd_send_file.send_file) @@ -91,6 +97,8 @@ p.add_argument("--overwrite", action="store_true", output file already exists, the program will refuse to overwrite it."""), ) +p.add_argument("-0", dest="zeromode", action="store_true", + help="enable no-code anything-goes mode") p.add_argument("code", nargs="?", default=None, metavar="[CODE]", help=dedent("""\ The magic-wormhole code, from the sender. If omitted, the