From 109bb3b47f41d5f415cd7e201939a1417a021dd0 Mon Sep 17 00:00:00 2001 From: Andrew LeCody Date: Wed, 14 Dec 2016 23:59:45 -0600 Subject: [PATCH] Mosh doesn't support "-l" for user, only user@host for args --- trezor_agent/__main__.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/trezor_agent/__main__.py b/trezor_agent/__main__.py index e910e3e..c94ff69 100644 --- a/trezor_agent/__main__.py +++ b/trezor_agent/__main__.py @@ -25,6 +25,21 @@ def ssh_args(label): return args + [identity['host']] +def mosh_args(label): + """Create SSH command for connecting specified server.""" + identity = device.interface.string_to_identity(label) + + args = [] + if 'port' in identity: + args += ['-p', identity['port']] + if 'user' in identity: + args += [identity['user']+'@'+identity['host']] + else: + args += [identity['host']] + + return args + + def create_parser(): """Create argparse.ArgumentParser for this tool.""" p = argparse.ArgumentParser() @@ -148,7 +163,7 @@ def run_agent(client_factory=client.Client): if args.connect: command = ['ssh'] + ssh_args(args.identity) + args.command elif args.mosh: - command = ['mosh'] + ssh_args(args.identity) + args.command + command = ['mosh'] + mosh_args(args.identity) + args.command else: command = args.command