PSProfile icon indicating copy to clipboard operation
PSProfile copied to clipboard

Add capability to specify which hosts a PSProfile setting should be applicable to

Open janegilring opened this issue 6 years ago • 2 comments

It would be useful to be able to specify what PowerShell hosts (PowerShell Core, Windows PowerShell, PowerShell ISE, VS Code, etc) a specific init script, script, module and so on should be loaded in. Default value could be "All" for such a setting.

This would make it possible to only load specific things in a specific host, for example some modules don't work in all hosts.

Another use case is that one might not want "heavy" things like large modules and such loaded when working in a specific environment such as VS Code, where a fast startup time is convenient when testing different things, reloading the integrated console and so on.

janegilring avatar Oct 25 '19 06:10 janegilring

I like it! I've been thinking about a way to add conditionals to each setting, which I think would cover this in a way. My initial thought was to support a ScriptBlock condition property on each non-essential section/setting where it makes sense. Thoughts?

scrthq avatar Oct 28 '19 05:10 scrthq

Yes, that would make it really flexible with regards to other conditions as well. Such as hostname (useful when sharing the same config across multiple machines) and operating systems.

Thumbs up 👍

janegilring avatar Oct 28 '19 05:10 janegilring