Extension: Ask for parameter for profile #11503

Open
opened 2026-01-31 02:49:30 +00:00 by claunia · 6 comments
Owner

Originally created by @bakutheleo on GitHub (Nov 20, 2020).

Description of the new feature/enhancement

I often have the need for multiple, but similar tabs. For example, an SSH terminal to various servers. Currently, afaik, I must create a new profile for each that specifies the specific server I want to connect to. This is not generally practical, as I have a large number of servers and may need to connect to any of them at any time. Currently I have to edit the profile entry in the config file with the new server name--thankfully that is read immediately so I can then use that profile, but this is still cumbersome.

Proposed technical implementation details (optional)

I would like to be able to specify a variable name in a profile that would request the value when I open that profile. For example, current a static entry for an ssh profile would be:

"commandline": "ssh user@servername"

It would be useful to be able to have a parameter so the value were requested from the user:

"commandline": "ssh user@%Server name%"

or multiple parameters:

"commandline": "ssh %user%@%Server name%"

When this profile is activated wt would ask the user for each parameter. This way I could have one profile that could handle whatever machine I want to connect to. Every time I open a new tab using this profile it would ask for the parameters to use in that tab. In my first example it would raise a dialog requesting Server name where I would enter the name of the server I want to connect to. In the second example it would also ask for the user. Of course this could be used for any purpose or other value.

I further suggest that if the same parameter name is used more than once it would only ask once, but use that for each reference. This would allow, for example, to use that parameter in the tab name:

"name": "SSS (%Server name%)",
"commandline": "ssh user@%Server name%"

In this example wt would ask for the value of "Server name" once, then use it in the tab title as well as the connection.

Originally created by @bakutheleo on GitHub (Nov 20, 2020). # Description of the new feature/enhancement I often have the need for multiple, but similar tabs. For example, an SSH terminal to various servers. Currently, afaik, I must create a new profile for each that specifies the specific server I want to connect to. This is not generally practical, as I have a large number of servers and may need to connect to any of them at any time. Currently I have to edit the profile entry in the config file with the new server name--thankfully that is read immediately so I can then use that profile, but this is still cumbersome. # Proposed technical implementation details (optional) I would like to be able to specify a variable name in a profile that would request the value when I open that profile. For example, current a static entry for an ssh profile would be: "commandline": "ssh user@servername" It would be useful to be able to have a parameter so the value were requested from the user: "commandline": "ssh user@%Server name%" or multiple parameters: "commandline": "ssh %user%@%Server name%" When this profile is activated wt would ask the user for each parameter. This way I could have one profile that could handle whatever machine I want to connect to. Every time I open a new tab using this profile it would ask for the parameters to use in that tab. In my first example it would raise a dialog requesting Server name where I would enter the name of the server I want to connect to. In the second example it would also ask for the user. Of course this could be used for any purpose or other value. I further suggest that if the same parameter name is used more than once it would only ask once, but use that for each reference. This would allow, for example, to use that parameter in the tab name: "name": "SSS (%Server name%)", "commandline": "ssh user@%Server name%" In this example wt would ask for the value of "Server name" once, then use it in the tab title as well as the connection.
claunia added the Issue-FeatureProduct-TerminalArea-Extensibility labels 2026-01-31 02:49:30 +00:00
Author
Owner

@DHowett commented on GitHub (Nov 20, 2020):

Hey, this is a cool idea! Thanks!

It's not something we're likely to do on our own, but I'm going to mark it up as a possible future extension. We're collecting these in #4000 to gauge what our plugin plan should encompass.

@DHowett commented on GitHub (Nov 20, 2020): Hey, this is a cool idea! Thanks! It's not something we're likely to do on our own, but I'm going to mark it up as a possible future extension. We're collecting these in #4000 to gauge what our plugin plan should encompass.
Author
Owner

@zadjii-msft commented on GitHub (Nov 20, 2020):

As an intermediary, you might have success with the commandline mode of the command palette. With that, you could type something like nt ssh user@serverName, and that'll open a new tab in the current window running ssh user@serverName.

@zadjii-msft commented on GitHub (Nov 20, 2020): As an intermediary, you might have success with the [commandline mode](https://docs.microsoft.com/en-us/windows/terminal/command-palette#command-line-mode) of the command palette. With that, you could type something like `nt ssh user@serverName`, and that'll open a new tab in the current window running `ssh user@serverName`.
Author
Owner

@bakutheleo commented on GitHub (Nov 21, 2020):

Thanks, good idea! I thought of done something like that but hadn't looked into it enough. Good workaround for now.

@bakutheleo commented on GitHub (Nov 21, 2020): Thanks, good idea! I thought of done something like that but hadn't looked into it enough. Good workaround for now.
Author
Owner

@bakutheleo commented on GitHub (Nov 21, 2020):

I must be missing something...I don't see a way to start an arbitrary executable that way. If I don't specify a specific profile it just says "No matching commands."

@bakutheleo commented on GitHub (Nov 21, 2020): I must be missing something...I don't see a way to start an arbitrary executable that way. If I don't specify a specific profile it just says "No matching commands."
Author
Owner

@zadjii-msft commented on GitHub (Nov 23, 2020):

Sorry, that's my bad. To get to commandline mode, you have to delete the leading > (on 1.5), or type a leading > (on 1.4). I know that's confusing, we just recently changed that to align with VsCode. See #7935

@zadjii-msft commented on GitHub (Nov 23, 2020): Sorry, that's my bad. To get to commandline mode, you have to delete the leading `>` (on 1.5), or type a leading `>` (on 1.4). I know that's confusing, we just recently changed that to align with VsCode. See #7935
Author
Owner

@bakutheleo commented on GitHub (Nov 23, 2020):

Got it, thanks, that was it! Keeps the current tab label, which is a little wierd. I know I can change that in the command.

@bakutheleo commented on GitHub (Nov 23, 2020): Got it, thanks, that was it! Keeps the current tab label, which is a little wierd. I know I can change that in the command.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#11503