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

(#508) Fix --page and --page-size arguments #2949

Merged
merged 3 commits into from
Jan 6, 2023

Conversation

TheCakeIsNaOH
Copy link
Member

@TheCakeIsNaOH TheCakeIsNaOH commented Dec 22, 2022

Description Of Changes

This fixes --page and --page-size. These arguments are inefficient because they require querying for all packages, and throw away everything but the page requested.

Motivation and Context

When the list command was switched to use NuGet.Client libraries, support for --page and --page-size was removed

Testing

  • Run .\choco.exe search google --source=https://community.chocolatey.org/api/v2, validate that about 248 packages are returned
  • Run .\choco.exe search google --source=https://community.chocolatey.org/api/v2 --page=0, validate that 25 packages are returned
  • Run .\choco.exe search google --source=https://community.chocolatey.org/api/v2 --page=2, validate that 25 packages are returned and that they are the different from --page=0
  • Run .\choco.exe search google --source=https://community.chocolatey.org/api/v2 --page=0 --page-size=100, validate that 100 packages are returned.

Operating Systems Testing

  • Windows 10 22H2

Change Types Made

  • Bug fix (non-breaking change).
  • Feature / Enhancement (non-breaking change).
  • Breaking change (fix or feature that could cause existing functionality to change).
  • Documentation changes.
  • PowerShell code changes.

Change Checklist

  • Requires a change to the documentation.
  • Documentation has been updated.
  • Tests to cover my changes, have been added.
  • All new and existing tests passed?
  • PowerShell code changes: PowerShell v2 compatibility checked?

Related Issue

Part of #508
https://app.clickup.com/t/20540031/PROJ-449

@choco-bot
Copy link

@TheCakeIsNaOH TheCakeIsNaOH marked this pull request as ready for review December 22, 2022 17:10
@TheCakeIsNaOH TheCakeIsNaOH mentioned this pull request Jan 4, 2023
46 tasks
This fixes --page and --page-size. Extra code is added
to reduce the number of packages requested when the
page argument is added.
This is code that no longer applicable for listing with NuGet.Client
Copy link
Member

@gep13 gep13 left a comment

Choose a reason for hiding this comment

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

LGTM!

@gep13 gep13 merged commit b7964c1 into chocolatey:develop Jan 6, 2023
@gep13
Copy link
Member

gep13 commented Jan 6, 2023

@TheCakeIsNaOH thanks for getting this fixed up! I left one comment (which didn't prevent the merge, just something that needs to be actioned).

@TheCakeIsNaOH TheCakeIsNaOH deleted the paging branch January 6, 2023 14:32
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.

3 participants