Skip to content
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

Fix Reset-WinGetSource behavior #4732

Merged
merged 4 commits into from
Aug 21, 2024
Merged

Conversation

ryfu-msft
Copy link
Contributor

@ryfu-msft ryfu-msft commented Aug 13, 2024

Issue:

Reset-WinGetSource required a name which does not match the current behavior of winget source reset.

Changes:

  • Added '-All' parameter so that Reset-WinGetsource will reset all sources. I also created two separate parameter sets so that they can only be used separately.
  • Made the '-Name' parameter also positional=0 for Reset-WinGetsource and Remove-WinGetsource (recommended by PowerShell docs team)
  • Fixed the naming of PreRelease -> Prerelease as recommended by PowerShell docs team
Microsoft Reviewers: Open in CodeFlow

@ryfu-msft ryfu-msft requested a review from a team as a code owner August 13, 2024 21:54
@@ -15,17 +15,25 @@ Resets default WinGet sources.
## SYNTAX

```
Reset-WinGetSource -Name <String> [<CommonParameters>]
Reset-WinGetSource [-Name <String>] [<CommonParameters>]
Copy link
Member

Choose a reason for hiding this comment

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

I worry somewhat about this being too easy to destroy state; the reason one needs to specify --force to winget.exe.

Maybe it should be two parameter sets, a default set with -Name and another one with -All. That way just running > Reset-WinGetSource doesn't immediately try to reset everything, but instead asks for a name.

Copy link
Contributor Author

@ryfu-msft ryfu-msft Aug 19, 2024

Choose a reason for hiding this comment

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

I created two parameters sets (DefaultSet and OptionalSet) so that we keep the default behavior of requiring the Name parameter. I also added an optional -All switch parameter that resets all sources.

Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't Name and All be required within their respective parameter set?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed brackets so they show up as being required.

JohnMcPMS
JohnMcPMS previously approved these changes Aug 20, 2024
@@ -15,17 +15,25 @@ Resets default WinGet sources.
## SYNTAX

```
Reset-WinGetSource -Name <String> [<CommonParameters>]
Reset-WinGetSource [-Name <String>] [<CommonParameters>]
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't Name and All be required within their respective parameter set?

@ryfu-msft ryfu-msft merged commit 83b2db4 into microsoft:master Aug 21, 2024
9 checks passed
@ryfu-msft ryfu-msft deleted the fixSource branch August 21, 2024 16:01
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.

2 participants