Repository navigation
Add ShouldProcess/ConfirmImpact to Uninstall-PSResource #433
Description
Activity
Should this always prompt you?
ThomasNieto commented
on Jul 4, 2022 ContributorMore actionsSteven Bucher (@StevenBucher98) No, it should not.
Please do not add additional hurdles when using wildcards. These kinds of extra barriers is what made PowerShellGet v2 so difficult to use since it basically forces people to add
-Forceor-Confirm:$falseto$PSDefaultParameterValues. PowerShell should just do whats its told. Its the user responsibility to make sure they're not doing something dumb. The level of destructiveness is fairly small in the grand scheme of things. In worst case if I uninstall all my modules I can just as easily reinstall. PowerShell has sufficient safeguards with-WhatIfand-Confirmif the user is concerned what the command will do when ran and can compare to the expected result.If you need further convincing lets take a look at
Remove-Item. I can pass it wildcards or at worst delete all files and folders without any additional prompts and that can be way more destructive than removing a module.rm * -Recurse
Reacted by Paul Higinbotham"If you need further convincing lets take a look at
Remove-Item. I can pass it wildcards or at worst delete all files and folders without any additional prompts and that can be way more destructive than removing a module."That seems like a terrible argument entirely ignorant of the deep history behind
--no-preserve-rooton *IX/Linux systems. If anything, Remove-Item should receive augmentation(s) in that regard…Also for
-WhatIfand-Confirmto actually work, one has to implement aShouldProcesscode block ANYWAY.Maybe you meant to voice a preference for the (future) value(s) of
ConfirmImpact(i.e. High/Medium/Low) here?Also while I totally get your anger, it seems a bit… ignorant of the many things which can drive people to add those to
$PSDefaultParameterValues(also, let's not forget about$ConfirmPreference)
Look into adding a confirmation requirement when uninstalling a PSResource. Uninstall-Module does not do it, and maybe we should not do it for Uninstall-PSResource when a single specific module is uninstalled. But since Uninstall-PSResource handles Name wild card characters, we may want to prompt for confirmation in that case.