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

Require selection argument on install/show/search/uninstall #2125

Merged
merged 2 commits into from Apr 27, 2022

Conversation

JohnMcPMS
Copy link
Member

@JohnMcPMS JohnMcPMS commented Apr 26, 2022

Fixes #1131

Change

For install, show, search, and uninstall commands, require that one of the selection arguments be provided. These are (where appropriate per command):

-q, --query [default positional argument]
-m, --manifest
--id
--name
--moniker
--tag
--command

I intentionally did not provide a way to override this behavior (like an --all for search), because I don't see a good use case for it. If there is one, please explain it below.

Microsoft Reviewers: Open in CodeFlow

@JohnMcPMS JohnMcPMS requested a review from as a code owner Apr 26, 2022
@msftbot msftbot bot added Area-Output Issue-Feature labels Apr 26, 2022
{
if (args.Contains(type))
{
return;
Copy link
Contributor

@Trenly Trenly Apr 26, 2022

Choose a reason for hiding this comment

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

Would it be possible to ensure the query is also not an empty string?
#1249

Copy link
Member Author

@JohnMcPMS JohnMcPMS Apr 26, 2022

Choose a reason for hiding this comment

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

It would be possible, but allowing an empty string does allow for an effective --all being "". The current change prevents accidental "everything" searches, which I feel was the primary value. Preventing intentional searching for everything seems like it would be due to the current performance limitations rather than due to protecting users.

If the user types in winget search "", it could be an accident, but it is more likely that it is intentional than winget search. I could see scripts constructing the command line resulting in more frequent empty strings as well, but if the script author wants to block that, they can.

Without any other reasons, I'm not inclined to block the empty strings.

Copy link
Contributor

@Trenly Trenly Apr 26, 2022

Choose a reason for hiding this comment

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

I think those are fair points, and are things I hadn't considered. After thinking more, I do agree that simply requiring an argument solves the potential issues here

Copy link
Contributor

@yao-msft yao-msft left a comment

:shipit:

@JohnMcPMS JohnMcPMS merged commit 0e97113 into microsoft:master Apr 27, 2022
6 checks passed
@JohnMcPMS JohnMcPMS deleted the nosearchall branch Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Output Issue-Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants