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

Change show and install to use a narrower search #492

Merged
merged 7 commits into from
Jul 14, 2020

Conversation

JohnMcPMS
Copy link
Member

@JohnMcPMS JohnMcPMS commented Jul 10, 2020

For #292

Change

This changes show and install to use case insensitive equality on id, name or moniker as the default query behavior. So winget show git now returns Git.Git as it matches on both name and moniker. The filters can still be used to target specific fields, but they too will require case insensitive equality rather than substring. The best way to target a specific package will be to use --id, as the command winget install --id foo.bar should now always find the package foo.bar, or nothing. (For reference, show and install use the same algorithm to find the package to operate on.)

PS C:\git\pkgs\Tools> wingetdev search git
Name                                    Id                                       Version      Match
----------------------------------------------------------------------------------------------------------
Git                                     Git.Git                                  2.27.0       Moniker: git
TortoiseSVN                             TortoiseSVN.TortoiseSVN                  1.14.0       Tag: git
TortoiseGit                             TortoiseGit.TortoiseGit                  2.10.0.2     Tag: git
Sublime Merge                           SublimeHQ.SublimeMerge                   1119         Tag: git
Fork                                    Fork.Fork                                1.51.2       Tag: git
Snagit                                  TechSmith.Snagit                         6.10.34
GitHubReleaseNotes                      StefHeyenrath.GitHubReleaseNotes         1.0.5.3
MicrosoftGitCredentialManagerforWindows Microsoft.GitCredentialManagerforWindows 1.20.0
Logitech Gaming Software                Logitech.LGS                             9.02.65
Logitech Harmony Remote                 Logitech.Harmony                         1.0.1.308
Gitter IM                               Gitlab.Gitter.IM                         4.1.0
Git Large File Storage                  GitHub.GitLFS                            2.11.0
GitHub Desktop                          GitHub.GitHubDesktop                     2.5.3
GitHub CLI                              GitHub.cli                               0.10.1
Atom                                    GitHub.Atom                              1.48.0
Git Extensions                          GitExtensionsTeam.GitExtensions          3.4.1
MaxTo                                   DigitalCreations.MaxTo                   2.0.1
AdobeDigitalEditions                    Adobe.AdobeDigitalEditions               4.5.11
GitKraken                               Axosoft.GitKraken                        7.0.1
Logitech Gaming Hub                     Logitech.LGH                             latest
Camtasia                                TechSmith.Camtasia                       2020.0.2     Tag: snagit
Cacher                                  PenguinLabs.Cacher                       202.30.4     Tag: github
AppInstallerFileBuilder                 Microsoft.AppInstallerFileBuilder        1.2020.211.0 Tag: GitHub
PS C:\git\pkgs\Tools> wingetdev show git
Found Git [Git.Git]
Version: 2.27.0
Publisher: Git
Description: Git version control system.
Homepage: https://git-scm.com/
License: GNU General Public License, version 2
License Url: https://github.com/git-for-windows/git/blob/master/COPYING
Installer:
  SHA256: 5974db8c52b32f5e575ee021e8b47948892ce0e760095eef98c31e3bbd5167b6
  Download Url: https://github.com/git-for-windows/git/releases/download/v2.27.0.windows.1/Git-2.27.0-64-bit.exe
  Type: Inno

As part of implementing this change, a case insensitive match level was added to the search functionality. This will sort case insensitive matches higher than substring matches in search results. So in the above example, winget search git puts Git.Git at the top of the search results now. This also means that if the search query is usable as an install query, the packages that would be found will also be at the top.

Finally, a few more strings were moved to localized resources and many instances of application were changed to package for consistency with the overall name and future considerations regarding non-application packages (such as fonts).
Thanks to @thlac for his proposal in #283 that spurred the discussion to change these. If someone knows how to give him co-author credit I would be happy to.

Validation

Added tests for case insensitive match level, as well as for the new search for single package functionality.

Microsoft Reviewers: Open in CodeFlow

}

if (args.Contains(Execution::Args::Type::Name))
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we move the same logic to a common method? Or you expect them to divert in the future?

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:

@JohnMcPMS JohnMcPMS merged commit b7dc50e into microsoft:master Jul 14, 2020
@JohnMcPMS JohnMcPMS deleted the installsearch branch July 14, 2020 20:45
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