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

Parameterizable dynamic profiles #5571

Open
letmaik opened this issue Apr 25, 2020 · 4 comments
Open

Parameterizable dynamic profiles #5571

letmaik opened this issue Apr 25, 2020 · 4 comments
Labels
Area-Commandline wt.exe's commandline arguments Area-Settings Issues related to settings and customizability, for console or terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal.
Milestone

Comments

@letmaik
Copy link
Member

letmaik commented Apr 25, 2020

Description of the new feature/enhancement

Eventually the plugin system will allow to contribute new dynamic profiles. I think it would be useful if there was a way to parameterize dynamic profiles. Currently, the automatically provided "commandline" has to be overridden to customize anything. I think this breaks abstraction/layering/encapsulation/... and often there would be no need for it if dynamic profile providers become smarter. See examples below. If the community can't come up with more use cases then it's not worth the effort obviously. This issue is about collecting ideas and opinions.

Proposed technical implementation details (optional)

Instead of:

            {
                "guid": "{f9679c4b-7da6-409d-a372-86ebe9127f2a}",
                "commandline" : "powershell.exe -ExecutionPolicy ByPass -NoExit -Command \"& '%USERPROFILE%\\Miniconda3\\shell\\condabin\\conda-hook.ps1' ; conda activate tensorflow\"",
                "icon" : "%USERPROFILE%/Miniconda3/Menu/Iconleak-Atrous-PSConsole.ico",
                "name" : "Miniconda (tensorflow)"
            }

I'd like:

            {
                "guid": "{f9679c4b-7da6-409d-a372-86ebe9127f2a}",
                "source": "Continuum.Miniconda3",
                "name" : "Miniconda (tensorflow)",
                "options": {
                  "env": "tensorflow", // defaults to "base"
                  "shell": "powershell" // or "cmd"
                }
            }

Instead of:

            {
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "name": "PowerShell",
                "source": "Windows.Terminal.PowershellCore",
                "commandline": "C:\\Program Files\\PowerShell\\6\\pwsh.exe --NoLogo"  
            }

I'd like:

            {
                "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}",
                "hidden": false,
                "name": "PowerShell",
                "source": "Windows.Terminal.PowershellCore",
                "options": {
                  "nologo": true
                }
            }
@letmaik letmaik added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Apr 25, 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 Apr 25, 2020
@jdhitsolutions
Copy link

I agree it might be nice to separate command-line arguments, from the command line. Although I'd probably opt for something like:

  {
                "commandline": "powershell.exe",
                "arguments" : "-nologo -noprofile",
                "guid": "{ca3da2bd-de18-40f7-9fc6-234345d1e89f}",
                "icon": "ms-appx:///ProfileIcons/{61c54bbd-c2c6-5271-96e7-009a87ff44bf}.png",
                "name": "Windows PowerShell No Profile",
                "tabTitle": "PS No Profile",
                "useAcrylic": true
            }

Taking this a step further I can envision a scenario launching a profile with WT.exe and specifying dynamic arguments.

@DHowett-MSFT
Copy link
Contributor

DHowett-MSFT commented May 1, 2020

Yeah, we should definitely have a story for this. I'm a bit scarred by Docker's ENTRYPOINT versus CMD nonsense, but it makes some amount of sense. If you set the entrypoint/command properly, docker run containerapp becomes a stand-in for app, because it passes all of its arguments to app internally. It makes sense.

It'll take work to comport all these things, and no small amount of design (to make sure it keeps working for everyone), but I love the idea of wt -p PSCore -nologo test.ps1.

@DHowett-MSFT DHowett-MSFT added Area-Commandline wt.exe's commandline arguments Area-Settings Issues related to settings and customizability, for console or terminal Product-Terminal The new Windows Terminal. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels May 1, 2020
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label May 1, 2020
@DHowett-MSFT DHowett-MSFT added this to the Terminal Backlog milestone May 1, 2020
@letmaik
Copy link
Member Author

letmaik commented May 1, 2020

Yeah, I agree with you guys that just using extra arguments might be more sensible. And if for some reason this wouldn't work because the thing to customize appears in weird places, then one could always write a wrapper script that makes it nice again.

@TBBle
Copy link

TBBle commented May 2, 2021

Just came across another user-story for this (or at least, I think it's this) which is customising parts of the profile other than the command line.

Per #1669 (comment), my current full-coverage MSYS2 set of profiles look like

      {
        "guid": "{c1372a71-8d9f-49d7-99db-8cb284c50b98}",
        //"commandline": "\"C:/msys64/msys2_shell.cmd\" -defterm -no-start -msys2",
        "commandline": "C:/msys64/usr/bin/env.exe MSYS='enable_pcon winsymlinks:nativestrict' CHERE_INVOKING=1 MSYSTEM=MSYS /bin/bash --login",
        "icon": "C:/msys64/msys2.ico",
        "name": "MSYS2 MSYS"
      },
      {
        "guid": "{2367860f-e6b6-4e91-821a-287e0cceee71}",
        //"commandline": "\"C:/msys64/msys2_shell.cmd\" -defterm -no-start -mingw64",
        "commandline": "C:/msys64/usr/bin/env.exe MSYS='enable_pcon winsymlinks:nativestrict' CHERE_INVOKING=1 MSYSTEM=MINGW64 /bin/bash --login",
        "icon": "C:/msys64/mingw64.ico",
        "name": "MSYS2 MinGW 64-bit"
      },
      {
        "guid": "{098bcacf-f271-4b79-b6c3-315bb4240e54}",
        //"commandline": "\"C:/msys64/msys2_shell.cmd\" -defterm -no-start -mingw32",
        "commandline": "C:/msys64/usr/bin/env.exe MSYS='enable_pcon winsymlinks:nativestrict' CHERE_INVOKING=1 MSYSTEM=MINGW32 /bin/bash --login",
        "icon": "C:/msys64/mingw32.ico",
        "name": "MSYS2 MinGW 32-bit"
      },
      {
        "guid": "{20ca76e4-8d6f-4d37-8468-dbf02385dd18}",
        //"commandline": "\"C:/msys64/msys2_shell.cmd\" -defterm -no-start -ucrt64",
        "commandline": "C:/msys64/usr/bin/env.exe MSYS='enable_pcon winsymlinks:nativestrict' CHERE_INVOKING=1 MSYSTEM=UCRT64 /bin/bash --login",
        "icon": "C:/msys64/ucrt64.ico",
        "name": "MSYS2 UCRT 64-bit"
      },
      {
        "guid": "{87536769-301c-4fee-89c9-c1aa8950e471}",
        //"commandline": "\"C:/msys64/msys2_shell.cmd\" -defterm -no-start -clang64",
        "commandline": "C:/msys64/usr/bin/env.exe MSYS='enable_pcon winsymlinks:nativestrict' CHERE_INVOKING=1 MSYSTEM=CLANG64 /bin/bash --login",
        "icon": "C:/msys64/clang64.ico",
        "name": "MSYS2 Clang 64-bit"
      },

Apart from the name, they are all varying only in the value of the MSYSTEM env-var (included in the icon name), so once we have a dynamic profile generator for MSYS2, it'd be nice to be able to do something like

            {
                "guid": "{87536769-301c-4fee-89c9-c1aa8950e471}",
                "name": "MSYS2 Clang 64-bit",
                "source": "Some.Plugin.Profiles.MSYS2",
                "options": {
                  "msystem": "clang64" # Default is msys2
                }
            }

although in this case it's likely to be adding profiles (you would still keep the msys2 profile around for pacman, I expect), so given it's a closed set, perhaps this is not actually a good use-case for customisation, as the generator could generate all the profiles, and users can just enable/disable as they see fit.

The MSYS env-var might be a good use-case for customisation though, since that's used to hold a bunch of toggles. A dynamic profile generator (and given #2785 so we don't need to use env to set env-vars, which won't work with the "append command line args" proposal because that will affect the program's arguments, not env's arguments) might want to honour the <MSYSTEM>.ini file though, rather than exposing these via Windows Terminal.

So yeah, MSYS2 wouldn't need the functionality here, but it does illustrate a non-command-line use-case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Commandline wt.exe's commandline arguments Area-Settings Issues related to settings and customizability, for console or terminal Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

No branches or pull requests

6 participants
@TBBle @letmaik @jdhitsolutions @DHowett-MSFT @zadjii-msft and others