def receive(cfg, code, **kwargs):
    """
    Receive a text message, file, or directory (from 'wormhole send')
    """
    for name, value in kwargs.items():
        setattr(cfg, name, value)
    with cfg.timing.add("import", which="cmd_receive"):
        from . import cmd_receive
    if len(code) == 1:
        cfg.code = code[0]
    elif len(code) > 1:
        print("Pass either no code or just one code; you passed"
              " {}: {}".format(len(code), ', '.join(code)))
        raise SystemExit(1)
    else:
        cfg.code = None

    return go(cmd_receive.receive, cfg)