Profile scripting best practices #168
Unanswered
rkeithhill
asked this question in
Q&A
Replies: 4 comments
|
I tend to dot source my profiles anyway. I usually keep them in onedrive and then my normal profile just dot sources the onedrive ones. I should probably just investigate using junctions or something instead. I do like the idea and naming you have used. |
0 replies
|
I can't think where to put this, but it's worth discussing ... and documenting. |
0 replies
|
I also have one for Posh-git - Posh-Git_config.ps1. |
0 replies
|
Posh-Git definitely needs one. This would make for a lot of utility, especially if people are writing generally-useful things to put in their profile and are releasing them as scripts on the gallery. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I'm not sure where this belongs or if it even belongs in this repo but... Most of us probably have pretty complex profile scripts. My PSReadline custom configuration alone is over 200 lines. So I've taken to moving those "module-specific" configurations out into a separate file that sits by my profile.ps1 file. It is called "PSReadline_config.ps1" - I've seen this approach with Bash (.bash_aliases). I was thinking something like
<ModuleOrDescription>_config.ps1. Then in your profile script you just dot source it in like so:This has made it easier for me to share my PSReadline config with others.
BTW there is probably some best practices around "which" profile scripts to use. I'm old school and use the current user all hosts script and for PSReadline I check against the host name. I should probably use the console's profile
Microsoft.PowerShell_profile.psand ditch theif ($host.Name -eq 'ConsoleHost')check.All reactions