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 a team as a code owner April 26, 2022 20:06
@ghost ghost added Area-Output Issue related to CLI output Issue-Feature This is a feature request for the Windows Package Manager client. labels Apr 26, 2022
{
if (args.Contains(type))
{
return;
Copy link
Contributor

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

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

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

Choose a reason for hiding this comment

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

:shipit:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Output Issue related to CLI output Issue-Feature This is a feature request for the Windows Package Manager client.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Winget install/show without arguments should not produce a list of all packages
3 participants