PSResourceGet
PSResourceGet copied to clipboard
Add ShouldProcess/ConfirmImpact to Uninstall-PSResource
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.
Uninstall-PSResource MyModule #No confirmation prompt
Uninstall-PSResource * #Prompt for confirmation before uninstalling all modules.
Uninstall-PSResource * -Force #No confirmation
Uninstall-PSResource * -Confirm:$false ??
Should this always prompt you?
@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 -Force
or -Confirm:$false
to $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 -WhatIf
and -Confirm
if 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