cli: move TorArgs out to separate decorator

This commit is contained in:
Brian Warner 2017-01-15 22:13:10 -05:00
parent aa772858f5
commit 203216c0ff

View File

@ -146,6 +146,9 @@ CommonArgs = _compose(
click.option("--listen/--no-listen", default=True, click.option("--listen/--no-listen", default=True,
help="(debug) don't open a listening socket for Transit", help="(debug) don't open a listening socket for Transit",
), ),
)
TorArgs = _compose(
click.option("--tor", is_flag=True, default=False, click.option("--tor", is_flag=True, default=False,
help="use Tor when connecting", help="use Tor when connecting",
), ),
@ -154,6 +157,7 @@ CommonArgs = _compose(
# wormhole send (or "wormhole tx") # wormhole send (or "wormhole tx")
@wormhole.command() @wormhole.command()
@CommonArgs @CommonArgs
@TorArgs
@click.option( @click.option(
"--code", metavar="CODE", "--code", metavar="CODE",
help="human-generated code phrase", help="human-generated code phrase",
@ -183,6 +187,7 @@ def go(f, cfg):
# wormhole receive (or "wormhole rx") # wormhole receive (or "wormhole rx")
@wormhole.command() @wormhole.command()
@CommonArgs @CommonArgs
@TorArgs
@click.option( @click.option(
"--only-text", "-t", is_flag=True, "--only-text", "-t", is_flag=True,
help="refuse file transfers, only accept text transfers", help="refuse file transfers, only accept text transfers",
@ -245,6 +250,7 @@ def ssh():
metavar="USER", metavar="USER",
help="Add to USER's ~/.ssh/authorized_keys", help="Add to USER's ~/.ssh/authorized_keys",
) )
@TorArgs
@click.pass_context @click.pass_context
def ssh_invite(ctx, code_length, user): def ssh_invite(ctx, code_length, user):
""" """
@ -269,6 +275,7 @@ def ssh_invite(ctx, code_length, user):
"--yes", "-y", is_flag=True, "--yes", "-y", is_flag=True,
help="Skip confirmation prompt to send key", help="Skip confirmation prompt to send key",
) )
@TorArgs
@click.pass_obj @click.pass_obj
def ssh_accept(cfg, code, key_file, yes): def ssh_accept(cfg, code, key_file, yes):
""" """