Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connect to specified ssh host #50

Open
mayberts opened this issue Nov 22, 2023 · 2 comments
Open

connect to specified ssh host #50

mayberts opened this issue Nov 22, 2023 · 2 comments

Comments

@mayberts
Copy link

Hey, is there a way of passing arguments to open a specific ssh host? I know I can command id opensshremotes.openEmptyWindowInCurrentWindow which brings up the list of configured hosts, but I would like the be able to pass the hostname and the same for opening container with remote-containers.attachToRunningContainer which again opens the list

@nicollasricas
Copy link
Owner

Hi,

I believe you can do that for the openEmptyWindow (it works with the openEmptyWindowInCurrentWindow as well) passing the host information as JSON.

Here's how you can do it:

image

{
  "host": "127.0.0.1",
  "userName": "myuser",
  "port": 123456
}

Now for the attachToRunningContainer the only way you could achieve this would be creating a custom task. There are two ways this could be achieved:

  • Create a custom task inside your workspace and execute this task that will be executing the attachToRunningContainer command. Although I don't know if that will work because the workspace must be fully loaded so that tasks inside were considered. You can try and if it doesn't work create a multi-action and chain both commands with some delay.
  • Create a user level task that will work any workspace.

The 6.0 update adds a new action just for tasks and also support for arguments as types and not just JSON objects as the current latest released version does. The 6.0 won't be released until I finish the documentation.

Tasks.json:

{
  "label": "mycustomtask",
  "command": "${command:remote-containers.attachToRunningContainer}",
  "args": ["container id or name"]
}

image

I hope it helps, let me know.

@mayberts
Copy link
Author

Thanks for the info, the openEmptyWindowInCurrentWindow works, but the attaching container is not, but I am still testing it. I might wait for version 6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants