CLI: avoid importing anything until command is actually run

In prep for moving the server launch command into the main CLI path,
without imposing dependency on pynacl/etc.
This commit is contained in:
Brian Warner 2015-04-01 16:01:32 -07:00
parent beb9e240d4
commit cf592d0766
4 changed files with 16 additions and 12 deletions

View File

@ -1,13 +1,14 @@
from __future__ import print_function
import sys, os, json, binascii
from wormhole.blocking.transcribe import Receiver, WrongPasswordError
from wormhole.blocking.transit import TransitReceiver, TransitError
from .progress import start_progress, update_progress, finish_progress
APPID = "lothar.com/wormhole/file-xfer"
def receive_file(args):
# we're receiving
import sys, os, json, binascii
from wormhole.blocking.transcribe import Receiver, WrongPasswordError
from wormhole.blocking.transit import TransitReceiver, TransitError
from .progress import start_progress, update_progress, finish_progress
transit_receiver = TransitReceiver(args.transit_helper)
r = Receiver(APPID, args.relay_url)

View File

@ -1,11 +1,12 @@
from __future__ import print_function
import sys, json, binascii
from wormhole.blocking.transcribe import Receiver, WrongPasswordError
APPID = "lothar.com/wormhole/text-xfer"
def receive_text(args):
# we're receiving
import sys, json, binascii
from wormhole.blocking.transcribe import Receiver, WrongPasswordError
r = Receiver(APPID, args.relay_url)
code = args.code
if not code:

View File

@ -1,13 +1,14 @@
from __future__ import print_function
import os, sys, json, binascii
from wormhole.blocking.transcribe import Initiator, WrongPasswordError
from wormhole.blocking.transit import TransitSender
from .progress import start_progress, update_progress, finish_progress
APPID = "lothar.com/wormhole/file-xfer"
def send_file(args):
# we're sending
import os, sys, json, binascii
from wormhole.blocking.transcribe import Initiator, WrongPasswordError
from wormhole.blocking.transit import TransitSender
from .progress import start_progress, update_progress, finish_progress
filename = args.filename
assert os.path.isfile(filename)
transit_sender = TransitSender(args.transit_helper)

View File

@ -1,11 +1,12 @@
from __future__ import print_function
import sys, json, binascii
from wormhole.blocking.transcribe import Initiator, WrongPasswordError
APPID = "lothar.com/wormhole/text-xfer"
def send_text(args):
# we're sending
import sys, json, binascii
from wormhole.blocking.transcribe import Initiator, WrongPasswordError
i = Initiator(APPID, args.relay_url)
code = i.get_code(args.code_length)
print("On the other computer, please run: wormhole receive-text")