Skip to content

Commit

Permalink
Merge branch 'stable'
Browse files Browse the repository at this point in the history
* stable:
  (GH-1033) List/Search on Tags Only
  • Loading branch information
ferventcoder committed May 18, 2017
2 parents fe152d5 + 52e7394 commit 00ea70e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ public virtual void configure_argument_parser(OptionSet optionSet, ChocolateyCon
.Add("by-id-only",
"ByIdOnly - Only return packages where the id contains the search filter. Available in 0.9.10+.",
option => configuration.ListCommand.ByIdOnly = option != null)
.Add("by-tag-only|by-tags-only",
"ByTagOnly - Only return packages where the search filter matches on the tags. Available in 0.10.6+.",
option => configuration.ListCommand.ByTagOnly = option != null)
.Add("id-starts-with",
"IdStartsWith - Only return packages where the id starts with the search filter. Available in 0.9.10+.",
option => configuration.ListCommand.IdStartsWith = option != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ public ListCommandConfiguration()
public int PageSize { get; set; }
public bool Exact { get; set; }
public bool ByIdOnly { get; set; }
public bool ByTagOnly { get; set; }
public bool IdStartsWith { get; set; }
public bool OrderByPopularity { get; set; }
public bool ApprovedOnly { get; set; }
Expand Down
7 changes: 7 additions & 0 deletions src/chocolatey/infrastructure.app/nuget/NugetList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ private static IQueryable<IPackage> execute_package_search(ChocolateyConfigurati
: results.Where(p => p.Id.contains(searchTermLower, StringComparison.OrdinalIgnoreCase));
}

if (configuration.ListCommand.ByTagOnly)
{
results = isRemote
? results.Where(p => p.Tags.Contains(searchTermLower))
: results.Where(p => p.Tags.contains(searchTermLower, StringComparison.InvariantCultureIgnoreCase));
}

if (configuration.ListCommand.IdStartsWith)
{
results = isRemote ?
Expand Down

0 comments on commit 00ea70e

Please sign in to comment.