receive-text/file: accept CODE in argv
This commit is contained in:
parent
12414fd8be
commit
cef9abcdd7
|
@ -17,7 +17,10 @@ def receive_file(so):
|
|||
},
|
||||
}).encode("utf-8")
|
||||
r = Receiver(APPID, mydata)
|
||||
r.set_code(r.input_code("Enter receive-file wormhole code: "))
|
||||
code = so["code"]
|
||||
if not code:
|
||||
code = r.input_code("Enter receive-file wormhole code: ")
|
||||
r.set_code(code)
|
||||
|
||||
try:
|
||||
data = json.loads(r.get_data().decode("utf-8"))
|
||||
|
|
|
@ -8,7 +8,10 @@ def receive_text(so):
|
|||
# we're receiving
|
||||
data = json.dumps({"message": "ok"}).encode("utf-8")
|
||||
r = Receiver(APPID, data)
|
||||
r.set_code(r.input_code("Enter receive-text wormhole code: "))
|
||||
code = so["code"]
|
||||
if not code:
|
||||
code = r.input_code("Enter receive-text wormhole code: ")
|
||||
r.set_code(code)
|
||||
start = time.time()
|
||||
try:
|
||||
them_bytes = r.get_data()
|
||||
|
|
|
@ -7,7 +7,9 @@ class SendTextOptions(usage.Options):
|
|||
synopsis = "TEXT"
|
||||
|
||||
class ReceiveTextOptions(usage.Options):
|
||||
synopsis = ""
|
||||
def parseArgs(self, code=None):
|
||||
self["code"] = code
|
||||
synopsis = "[CODE]"
|
||||
|
||||
class SendFileOptions(usage.Options):
|
||||
def parseArgs(self, filename):
|
||||
|
@ -15,7 +17,9 @@ class SendFileOptions(usage.Options):
|
|||
synopsis = "FILENAME"
|
||||
|
||||
class ReceiveFileOptions(usage.Options):
|
||||
synopsis = ""
|
||||
def parseArgs(self, code=None):
|
||||
self["code"] = code
|
||||
synopsis = "[CODE]"
|
||||
|
||||
class Options(usage.Options):
|
||||
synopsis = "\nUsage: wormhole <command>"
|
||||
|
|
Loading…
Reference in New Issue
Block a user