PSResourceGet icon indicating copy to clipboard operation
PSResourceGet copied to clipboard

Idea for ability to optionally override default modules and scripts install path - Duscussion and contribution is welcome!

Open o-l-a-v opened this issue 1 year ago • 1 comments

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! 🥳

image

Todo

  • [ ] Maintainers confirm this is something they want, else more work is for nothing.
  • [x] Get env variable PSResourceGetInstallPathOverride if present and use it instead of default paths.
  • [ ] Create cmdlet Set-PSResourceInstallPathOverride -Path <path> -Scope <CurrentUser|AllUsers>.
    • [x] Barebone functionality, as in set PSResourceGetInstallPathOverride and add it to PSModulePath if not already there.
    • [x] -WhatIf
    • [ ] Check if running as admin and scope is current user?
    • [ ] ^ Add "-Force" or "-IgnorePermissionsCheck" switch?
  • [ ] ? Create cmdlet Get-PSResourceGetInstallPathOverride ?
  • [ ] ? Create cmdlet Remove-PSResourceGetInstallPathOverride ?
  • [ ] Make sure Get-PSResource searches for all paths in PSModulePath
    • Ref. #889
  • [ ] Document changes.
  • [ ] Create tests.

Related issues / feature requests

PR Context

PR Checklist

o-l-a-v avatar Jul 13 '24 12:07 o-l-a-v

@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:

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:

o-l-a-v avatar Aug 21 '24 20:08 o-l-a-v