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
choco list / search - Search by tags only #1033
Comments
Hi Rob, I've gotten around to implementing this and am just now reviewing your mailing list reply, which was cryptically "By default one of the fields searched is tags, but it doesn't limit itself to that.". Obviously you'd like to add searching for more than just the tags. What did you have in mind? Were you thinking of a generic search operator, e.g. (if I could dream I'd do it with regexs) --search Tags~/aboutgolf/ (which incidentally would like you do limited and/or logic via multiple Tags~// clauses and (x|y) in the regex), or just add multiple search operators, e.g. --tags and --authors and --dependencies, etc. What I'm implemented so far is a very simple --with-tag operator. Another question - I looked for unit tests to emulate but couldn't really find any - can you recommend any? |
Initial pass at implementing a tag based search. The current implementation requires an exact (case-insensitive) match which suits my needs. Will ask Rob if he wants anything else.
Something like |
Changed from 'with-tags' to 'by-tags-only' to be consistent with existing 'by-id-only' option.
Fair enough - how about that? Should I go ahead and create a pull request? Or can you point me towards a unit test that would be good source to create test from? |
Tag based search via a new 'by-tags-only' arg. The current implementation requires an exact (case-insensitive) match which suits my needs. Will ask Rob if he wants anything else.
Tag based search via a new 'by-tags-only' arg. The current implementation requires an exact (case-insensitive) match which suits my needs. Will ask Rob if he wants anything else.
Previously, a search filter would take many parts of the package information into account. When wanting to perform a search based on tags only, this proved to be a bit more difficult. Implement a tag-based search vew a new `--by-tags-only` argument to limit results based on the tags.
* pr1051: (GH-1033) List/Search on Tags Only
* stable: (GH-1033) List/Search on Tags Only
Going into 0.10.6 |
As per https://groups.google.com/forum/#!topic/chocolatey/HYrC9dUhdZ4, the idea here is to enhance the search/list functionality to be able to search on package tags.
Currently search/list is implemented in the execute_package_search method in file src\chocolatey\infrastructure.app\nuget\NugetList.cs - it calls packageRepository.Search() and gets back a list of packages and then filters that list based on things like Id, pre-release, etc. The list of packages returned is a list of IPackage interfaces, which are here: https://github.com/grendello/nuget/blob/master/src/Core/Packages/IPackage.cs
The actual class is (I think) https://github.com/grendello/nuget/blob/master/src/Core/Packages/DataServicePackage.cs and as you can see along with Id and prerelease it exposes a "tags" property. Thus it should be fairly simple to add a filter for tags.
My end use case is that I want to search for all packages that are installed that I have published - I've published them all with a tag 'aboutgolf' so I would like to do this:
#> choco list -l --tags aboutgolf
I had also prefixed all my package names with 'ag', however, using the IdStartsWith option is not reliable (there already exists a package called simply 'ag').
The text was updated successfully, but these errors were encountered: