PSResourceGet icon indicating copy to clipboard operation
PSResourceGet copied to clipboard

If no package is uninstalled the cmdlet should emit an error

Open SydneyhSmith opened this issue 3 years ago • 1 comments

Summary of the new feature / enhancement

If no package is uninstalled during a run of Uninstall-PSResource the cmdlet should emit a warning so that the user knows no action was completed. The warning can suggest users run Get-PSResource.

Alternatively this message could only be included in runs with -Verbose parameter

Proposed technical implementation details (optional)

No response

SydneyhSmith avatar Jan 24 '22 20:01 SydneyhSmith

I just ran into this and it should really return a non-terminating error for the caller to know something didn't work as expected.

Here is my example, by trying to uninstall a specific version of PSReadLine it gave me every indication that it worked as expected.

PS C:\> Get-PSResource -Name PSReadLine

Name                                  Version  Prerelease Repository Description
----                                  -------  ---------- ---------- -----------
PSReadLine                            2.2.5.0             PSGallery  Great command line editing in the PowerShell console host
PSReadLine                            2.2.0    beta5      PSGallery  Great command line editing in the PowerShell console host

PS C:\> Uninstall-PSResource -Name PSReadLine -Version 2.2.0
PS C:\> Get-PSResource -Name PSReadLine

Name                                  Version  Prerelease Repository Description
----                                  -------  ---------- ---------- -----------
PSReadLine                            2.2.5.0             PSGallery  Great command line editing in the PowerShell console host
PSReadLine                            2.2.0    beta5      PSGallery  Great command line editing in the PowerShell console host

PS C:\> Uninstall-PSResource -Name PSReadLine -Version 2.2.0-beta5
PS C:\> Get-PSResource -Name PSReadLine

Name                                  Version  Prerelease Repository Description
----                                  -------  ---------- ---------- -----------
PSReadLine                            2.2.5.0             PSGallery  Great command line editing in the PowerShell console host

ThomasNieto avatar Jun 09 '22 15:06 ThomasNieto