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

Allow custom dynamic profile generator sources #7805

Closed
jnovick opened this issue Oct 2, 2020 · 4 comments
Closed

Allow custom dynamic profile generator sources #7805

jnovick opened this issue Oct 2, 2020 · 4 comments
Labels
Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@jnovick
Copy link

jnovick commented Oct 2, 2020

Description of the new feature/enhancement

A plug and play approach to dynamic profiles. This would allow people who want profiles generated dynamically to easily do so. Instead of Windows Terminal having to support lots of dynamic profile generators that different users suggest with lots of configuration options, users could create them themselves and possibly share via git. I tried searching to see if this was already suggested and was surprised it wasn't. If an issue already does exist and I just missed it then I apologize. Currently, there isn't even a way to easily script editing the settings file. Here are a few use cases:

Docker

One example use case is if someone wanted a dynamic profile for all docker containers that are currently running or maybe all containers regardless of whether they are running or not. This would address #4892 without locking in everyone to the same command. Some people may want volumes to be included while others may want to exec into the container without modifying it at all. Some may want to pass in specific environment variables or something. Point is, it would be customizable.

Customizing WSL profiles

Instead of the built in Windows.Terminal.Wsl generator, someone may want to allow specifying a different shell (commandline) or to pass in extra flags, etc. This would also address #5571 which does mention dynamic profiles as plugins.

SSH

If a user wants to dynamically generate profiles that directly ssh into other machines based off ~/.ssh/known_hosts. CUrrently, these can easily be added manually and look something like this:

{
    "guid": "{1190852f-d156-4583-853f-1f57e20eb4b5}",
    "hidden": false,
    "name": "ssh my-host.something.com",
    "commandline": "ssh [email protected]"
 }

Or if someone prefers to use ssh from WSL2 distro instead of openssh (Not sure if there is any advantage),

{
    "guid": "{1190852f-d156-4583-853f-1f57e20eb4b5}",
    "hidden": false,
    "name": "ssh my-host.something.com",
    "commandline": "wsl -d Ubuntu-20.04 ssh [email protected]"
 }

Proposed technical implementation details (optional)

My suggestion would be to add another top-level section that is an array of objects containing the source name and a script for generating profiles. Maybe this script is required to be a powershell or bash script with functions that match specific names. Maybe this script is allowed to be any language as long as it is executable. Perhaps it is required to be written in c and adhere to the IDynamicProfileGenerator.h that already exists. I am not sure whether it would be better for the script plugin to output json array that gets merged into the list of profiles automatically or whether it should just output list of names and guids and then have a second call based on source that actually determines what should happen for that profile which is what the existing dynamic profiles do. For example

{
    "$schema": "https://aka.ms/terminal-profiles-schema",
    "defaultProfile": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
    "customProfileSources":
    [
        {
            "name": "Docker",
            "script": "C:\\Path\\To\\Script"
        }
    ],
    "profiles":
    {
        "list":
        [
            {
                "guid": "{61c54bbd-c2c6-5271-96e7-009a87ff44bf}",
                "name": "Windows PowerShell",
                "commandline": "powershell.exe",
                "hidden": false
            },
            {
                "guid": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
                "name": "Command Prompt",
                "commandline": "cmd.exe",
                "hidden": false
            },
            {
                "guid": "{07b52e3e-de2c-5db4-bd2d-ba144ed6c273}",
                "hidden": false,
                "name": "Ubuntu-20.04",
                "source": "Windows.Terminal.Wsl"
            },
            {
                "guid": "{d77a2c51-7ad9-4bc5-995e-ac634f732a5b}",
                "hidden": false,
                "name": "container_name_or_id",
                "source": "Docker"
            }
        ]
    },
    "schemes": [],
    "actions": []
    // Other stuff...
}
@jnovick jnovick added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Oct 2, 2020
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Oct 2, 2020
@WSLUser
Copy link
Contributor

WSLUser commented Oct 2, 2020

/dup #4000 FWIW, this is actually in discussion now for #7774 to possibly serve as a test case.

@zadjii-msft
Copy link
Member

Hey thanks for the great writeup! We're actually working on something just like this over in #7584/#7632. We're going for more of an approach of "tools can generate profiles for the Terminal, and leave them somewhere the Terminal will know to look for them". The more elaborate case, where the Terminal runs the 3rd party generator at launch, is largely being tracked by #4000.

I'm gonna close this in favor of those threads, but feel free to hop on the discussion!

/dup #7584 #7632

@ghost
Copy link

ghost commented Oct 5, 2020

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost ghost closed this as completed Oct 5, 2020
@ghost ghost added Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Oct 5, 2020
@jnovick
Copy link
Author

jnovick commented Oct 5, 2020

Thank you for the response. I look forward to being able to utilize those features.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

3 participants