mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-02 23:31:25 -07:00
add support for opening shell on remote Windows host (#43919)
* add support for opening shell on remote Windows host * added arg completion and fix sanity check * remove uneeded arg
This commit is contained in:
parent
aef16ee195
commit
6ca4ea0c1f
3 changed files with 79 additions and 20 deletions
|
@ -564,7 +564,7 @@ def add_environments(parser, tox_version=False, tox_only=False):
|
|||
environments.add_argument('--remote',
|
||||
metavar='PLATFORM',
|
||||
default=None,
|
||||
help='run from a remote instance').completer = complete_remote
|
||||
help='run from a remote instance').completer = complete_remote_shell if parser.prog.endswith(' shell') else complete_remote
|
||||
|
||||
remote = parser.add_argument_group(title='remote arguments')
|
||||
|
||||
|
@ -685,6 +685,24 @@ def complete_remote(prefix, parsed_args, **_):
|
|||
return [i for i in images if i.startswith(prefix)]
|
||||
|
||||
|
||||
def complete_remote_shell(prefix, parsed_args, **_):
|
||||
"""
|
||||
:type prefix: unicode
|
||||
:type parsed_args: any
|
||||
:rtype: list[str]
|
||||
"""
|
||||
del parsed_args
|
||||
|
||||
with open('test/runner/completion/remote.txt', 'r') as completion_fd:
|
||||
images = completion_fd.read().splitlines()
|
||||
|
||||
# 2008 doesn't support SSH so we do not add to the list of valid images
|
||||
with open('test/runner/completion/windows.txt', 'r') as completion_fd:
|
||||
images.extend(["windows/%s" % i for i in completion_fd.read().splitlines() if i != '2008'])
|
||||
|
||||
return [i for i in images if i.startswith(prefix)]
|
||||
|
||||
|
||||
def complete_docker(prefix, parsed_args, **_):
|
||||
"""
|
||||
:type prefix: unicode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue