Is there any way to connect to a remote container without open a foder?

Viewed 42

I am implementing a dev environment for Arduino an other MCUs. I have a container image with all the compilers and tool-chains required and I have an script to connect VSCode to it.

The connection magic is done by this:

CONTAINER_NAME="dev-environments-mcus"
hex=$(printf \{\"containerName\"\:\""$CONTAINER_NAME"\"\} | od -A n -t x1 | tr -d '[\n\t ]')
code --folder-uri vscode-remote://attached-container+${hex}/App_Home/mcu-projects

This works perfectly but the problem is that by doing this I am opening a specific folder in the container which is not ideal for a generic dev enviroment.

I would like to know if it is possible to replicate in cmdline the "Attach in new window" button behaviour, which open an "empty" window when you click on it.

Edit1: Replacing --folder-uri by --file-uri make my script work better but I would like to open no file or at least open the start page.

PS: Just in case you are curious this is the project github

1 Answers

Ok I think that I manage to solve it. I will share what I did just in case anyone find himself on the same situation.

I just had to use the option --file-uri rather than --folder-uri and append a slash / at then end of the command. Now no folder or empty file is open when VSCode starts.

This is how the script looks now:

CONTAINER_NAME="dev-environments-mcus"
hex=$(printf \{\"containerName\"\:\""$CONTAINER_NAME"\"\} | od -A n -t x1 | tr -d '[\n\t ]')
code --file-uri vscode-remote://attached-container+${hex}/
Related