JustinGrote / ModuleFast

A "fast and loose" way to install modules from Powershell Gallery quickly. Meant for CICD, not production
Other
77 stars 5 forks source link

`Get-ModuleFastPlan`: Discuss keep as public command #27

Closed johlju closed 8 months ago

johlju commented 8 months ago

Note that install-modulefast -whatif will be replacing get-modulefastplan unless I can find a good way to keep the parameter logic all up to date between them, but get-modulefastplan will be preserved with a warning.

I am using Get-ModuleFastPlan to get a result to programmatically see what is needed to be updated. WhatIf wouldn't help with that, so sorry to see it go. I rather see it still being a supported public command if it is possible.

Originally posted by @johlju in https://github.com/JustinGrote/ModuleFast/issues/20#issuecomment-1865872876

JustinGrote commented 8 months ago

@johlju have you tried -whatif? It generates and outputs the same plan as objects, literally the same as Get-ModuleFastPlan. There's nothing about -whatif that says it has to only output console stuff.

image

The reason I was planning to retire it is that the command surface for Install-ModuleFast is starting to get pretty broad, and in order for Get-ModuleFastPlan to support all the same functionality it all has to be duplicated (and subsequently tested). If this was a binary module that would be easy because I can put all that duplication into a parent class, but with script modules there's no way to define common parameters for a function that I'm aware of.

JustinGrote commented 8 months ago

I think to clarify, Get-ModuleFastPlan won't explicitly go away, it just won't get any new parameters/etc. unless it becomes necessary due to Install-ModuleFast parameter additions.

johlju commented 8 months ago

I tested -WhatIf now, it was not very intuitive having WhatIf-output in the build output - see below. It looks like something were not installed. Also, for some reason it returns two WhatIf-strings but looks like by design.

[pre-build] Starting Build Init
[pre-build] Creating required modules directory /Users/johlju/source/Sampler/output/RequiredModules.
[pre-build] Pre-pending '/Users/johlju/source/Sampler/output/RequiredModules' folder to PSModulePath
[pre-build] Resolving dependencies using preferred method.
[pre-build] Starting bootstrap process.
...
ModuleFast is configured to use Bleeding Edge (directly from ModuleFast's main branch).
What if: Performing the operation "Install 1 Modules" on target "/Users/johlju/source/Sampler/output/RequiredModules".  
What if: Performing the operation "Install 18 Modules" on target "/Users/johlju/source/Sampler/output/RequiredModules". 
...
[build] Starting build with InvokeBuild.
johlju commented 8 months ago

Maybe move the output to a PassThru parameter instead? That would be more intuitive that something is returned. 🤔

johlju commented 8 months ago

I think to clarify, Get-ModuleFastPlan won't explicitly go away, it just won't get any new parameters/etc. unless it becomes necessary due to Install-ModuleFast parameter additions.

That's good. Let's close this. Just wanted the dialog. 🙂

JustinGrote commented 8 months ago

@johlju What I can do is add a -Plan parameter that will basically be -WhatIf without the whatif output (it is extremely annoying there is no way to suppress whatif output without overriding the host).

johlju commented 8 months ago

Yes a -Plan parameter would be much better I think. Happy to see that.

JustinGrote commented 8 months ago

Yes a -Plan parameter would be much better I think. Happy to see that.

It's a tricky position because if it was any other module, it would mean get-modulefastplan would have all this functionality and UI surfaced. I think I need to consider this a bit, I could have a switch on the bootstrap for the default entrypoint to be plan vs install.

johlju commented 8 months ago

Thought about it a bit more and since Get-ModuleFastPlan exist, a Plan parameter could be seen as passing in a plan to Install-ModuleFast. So maybe OnlyPlan or something like that would be better. But I wait for what you come up with, what path you take. 😊