mirror of
https://github.com/romanz/amodem.git
synced 2026-04-21 05:36:42 +08:00
Mosh doesn't support "-l" for user, only user@host for args
This commit is contained in:
@@ -25,6 +25,21 @@ def ssh_args(label):
|
|||||||
return args + [identity['host']]
|
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():
|
def create_parser():
|
||||||
"""Create argparse.ArgumentParser for this tool."""
|
"""Create argparse.ArgumentParser for this tool."""
|
||||||
p = argparse.ArgumentParser()
|
p = argparse.ArgumentParser()
|
||||||
@@ -148,7 +163,7 @@ def run_agent(client_factory=client.Client):
|
|||||||
if args.connect:
|
if args.connect:
|
||||||
command = ['ssh'] + ssh_args(args.identity) + args.command
|
command = ['ssh'] + ssh_args(args.identity) + args.command
|
||||||
elif args.mosh:
|
elif args.mosh:
|
||||||
command = ['mosh'] + ssh_args(args.identity) + args.command
|
command = ['mosh'] + mosh_args(args.identity) + args.command
|
||||||
else:
|
else:
|
||||||
command = args.command
|
command = args.command
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user