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

choco list / search - Search by tags only #1033

Closed
Apteryx0 opened this issue Nov 1, 2016 · 4 comments
Closed

choco list / search - Search by tags only #1033

Apteryx0 opened this issue Nov 1, 2016 · 4 comments

Comments

@Apteryx0
Copy link

Apteryx0 commented Nov 1, 2016

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').

@Apteryx0
Copy link
Author

Apteryx0 commented Nov 7, 2016

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?

Apteryx0 pushed a commit to Apteryx0/choco that referenced this issue Nov 7, 2016
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.
@ferventcoder
Copy link
Member

Something like --by-tags-only would be consistent with --by-id-only - https://chocolatey.org/docs/commands-list

@ferventcoder ferventcoder changed the title Contribution suggestion: search on tags Search by tags only Nov 8, 2016
Apteryx0 pushed a commit to Apteryx0/choco that referenced this issue Nov 10, 2016
Changed from 'with-tags' to 'by-tags-only' to be consistent with existing
'by-id-only' option.
@Apteryx0
Copy link
Author

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?

Apteryx0 pushed a commit to Apteryx0/choco that referenced this issue May 1, 2017
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.
Apteryx0 pushed a commit to Apteryx0/choco that referenced this issue May 1, 2017
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.
ferventcoder pushed a commit that referenced this issue May 18, 2017
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.
ferventcoder added a commit that referenced this issue May 18, 2017
* pr1051:
  (GH-1033) List/Search on Tags Only
ferventcoder added a commit that referenced this issue May 18, 2017
* stable:
  (GH-1033) List/Search on Tags Only
@ferventcoder ferventcoder self-assigned this May 18, 2017
@ferventcoder ferventcoder added this to the 0.10.6 milestone May 18, 2017
@ferventcoder
Copy link
Member

Going into 0.10.6

@ferventcoder ferventcoder changed the title Search by tags only Choco list / search - Search by tags only May 24, 2017
@ferventcoder ferventcoder changed the title Choco list / search - Search by tags only choco list / search - Search by tags only May 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants