Skip to content

Add uninstall pipeline support for ValueFromPipelineByPropertyName #692

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed

Add uninstall pipeline support for ValueFromPipelineByPropertyName #692

wants to merge 2 commits into from

Conversation

alerickson
Copy link
Member

@alerickson alerickson commented Jul 7, 2022

PR Summary

Add pipeline support in Uninstall-PSResource for ValueFromPipelineByPropertyName for -Name and -Version so that only specified versions are uninstalled. Currently all versions get uninstalled since the version property isn't passed through the pipeline to Uninstall-PSResource.

PR Context

Resolves #626

PR Checklist

@alerickson alerickson changed the title Add uninstall pipeline support for ValueFromPipelineByPropertyName [WIP] Add uninstall pipeline support for ValueFromPipelineByPropertyName Jul 13, 2022
@alerickson alerickson changed the title [WIP] Add uninstall pipeline support for ValueFromPipelineByPropertyName Add uninstall pipeline support for ValueFromPipelineByPropertyName Aug 26, 2022
[ValidateNotNullOrEmpty]
public string[] Name { get; set; }

/// <summary>
/// Specifies the version or version range of the package to be uninstalled.
/// </summary>
[Parameter(ParameterSetName = NameParameterSet)]
[Parameter(ValueFromPipelineByPropertyName = true, ParameterSetName = NameParameterSet)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested Uninstall-PSResource on the current master branch and it actually works with pipeline input without your change, so I'm curious if the issue for the user might not come from not setting ValueFromPipelineByPropertyName to true.


Get-PSResource -Name $testModuleName -Version "3.0.0" | Uninstall-PSResource
$res = Get-PSResource -Name $testModuleName -Version "3.0.0"
$res | Should -BeNullOrEmpty
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better if you also test that versions 1.0.0 and 5.0.0 exist to ensure that Uninstall-PSResource only uninstall 1 version.

@alerickson
Copy link
Member Author

I opened this PR almost 2 months ago and it looks like this is no longer an issue. I'm searching for the PR where this issue was fixed, but I'm going to close this PR since it's no longer needed 😃

@alerickson alerickson closed this Aug 30, 2022
@alerickson
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Uninstall-PSResource should take Version from ValueFromPipelineByPropertyName
2 participants