Idea for ability to optionally override default modules and scripts install path - Duscussion and contribution is welcome!
PR Summary
What
I'm experimenting with a way to override PSResourceGet install path for modules and scripts, suggested in my comment https://github.com/PowerShell/PSResourceGet/issues/1494#issuecomment-2225201194.
This PR already got the basic logic working for getting the path override if present! 🥳
Todo
- [ ] Maintainers confirm this is something they want, else more work is for nothing.
- [x] Get env variable
PSResourceGetInstallPathOverrideif present and use it instead of default paths. - [ ] Create cmdlet
Set-PSResourceInstallPathOverride -Path <path> -Scope <CurrentUser|AllUsers>.- [x] Barebone functionality, as in set
PSResourceGetInstallPathOverrideand add it toPSModulePathif not already there. - [x]
-WhatIf - [ ] Check if running as admin and scope is current user?
- [ ] ^ Add "-Force" or "-IgnorePermissionsCheck" switch?
- [x] Barebone functionality, as in set
- [ ] ? Create cmdlet
Get-PSResourceGetInstallPathOverride? - [ ] ? Create cmdlet
Remove-PSResourceGetInstallPathOverride? - [ ] Make sure
Get-PSResourcesearches for all paths inPSModulePath- Ref. #889
- [ ] Document changes.
- [ ] Create tests.
Related issues / feature requests
- 2018-10-18: https://github.com/PowerShell/PowerShell/issues/8069
- 2021-06-09: https://github.com/PowerShell/PowerShell/issues/15552
- 2022-04-07: #627
- 2023-01-12: #889
- 2023-11-16: #1494
- 2024-06-08: #1661
PR Context
PR Checklist
- [x] PR has a meaningful title
- Use the present tense and imperative mood when describing your changes
- [ ] Summarized changes
- [ ] Make sure all
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header - [ ] This PR is ready to merge and is not Work in Progress.
- If the PR is work in progress, please add the prefix
WIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.
- If the PR is work in progress, please add the prefix
-
Breaking changes
- [ ] None
- OR
- [x] Documentation needed
- [ ] Issue filed:
-
User-facing changes
- [ ] Not Applicable
- OR
- [x] Documentation needed
- [ ] Issue filed:
-
Testing - New and feature
- [ ] N/A or can only be tested interactively
- OR
- [ ] Make sure you've added a new test if existing tests do not effectively test the code changed
-
Tooling
- [ ] I have considered the user experience from a tooling perspective and don't believe tooling will be impacted.
- OR
- [ ] I have considered the user experience from a tooling perspective and enumerated concerns in the summary.
@anamnavi, @alerickson Have you had any time to check out this idea? Any thoughts? 🤔
Edit: It's probably better to use powershell.settings.json for this, ref:
- 2021-08-12 https://github.com/PowerShell/PowerShell/issues/15552#issuecomment-897232938
- 2024-08-20 https://github.com/PowerShell/PSResourceGet/issues/1494#issuecomment-2297880850
- 2024-08-20 https://github.com/PowerShell/PowerShell/issues/15552#issuecomment-2297887053
- 2024-08-22 https://github.com/PowerShell/PSResourceGet/issues/1494#issuecomment-2303632544
Whichever solution you want for PSResourceGet, let's make it happen. I can try to do it, but I'd first want to hear what alternative you'd like. 🙂
Edit 2: Seems Windows PowerShell does not support powershell.config.json in my limited testing: