-
Notifications
You must be signed in to change notification settings - Fork 25
CENG-355: Add --show-all
flag to display all results from repo/package list
#172
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
base: master
Are you sure you want to change the base?
CENG-355: Add --show-all
flag to display all results from repo/package list
#172
Conversation
…71' of github.com:cloudsmith-io/cloudsmith-cli into ceng-355-httpsgithubcomcloudsmith-iocloudsmith-clipull171
@@ -110,6 +112,17 @@ def ls(ctx, opts, owner, page, page_size): | |||
|
|||
print_vulnerability_policies(policies) | |||
|
|||
click.echo() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does the newline break JSON parsing if you use JSON output?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unresolved this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
☝️ Still need an answer here
cf3ca3b
to
c79c929
Compare
cloudsmith_cli/cli/utils.py
Outdated
current_page = page | ||
while True: | ||
page_results, page_info = api_function( | ||
page=current_page, page_size=page_size, **kwargs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're in the "show all" block, we should probably disregard the page_size
that was passed into the function and hard code {{whatever the maximum page_size is}} to minimise chattiness.
Do we have a MAX_PAGE_SIZE constant or equivalent in this project already that we might reuse? 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
☝️ We should do this - reach out if you need more 👀
@@ -110,6 +112,17 @@ def ls(ctx, opts, owner, page, page_size): | |||
|
|||
print_vulnerability_policies(policies) | |||
|
|||
click.echo() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unresolved this one.
Code Climate has analyzed commit ce41ea2 and detected 10 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 87.5% (50% is the threshold). This pull request will bring the total coverage in the repository to 73.4% (1.1% change). View more on Code Climate. |
cloudsmith_cli/cli/validators.py
Outdated
def validate_show_all(ctx, param, value): | ||
"""Ensure that --show-all is not used with --page (-p) or --page-size (-l).""" | ||
if value: | ||
# Check if either page or page_size parameters were provided, regardless of value | ||
if any(param in ctx.params for param in ["page", "page_size"]): | ||
raise click.UsageError( | ||
"The --show-all option cannot be used with --page (-p) or --page-size (-l) options." | ||
) | ||
return value | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test for this please?
Does the order in which the parameters are passed affect the validation?
cloudsmith_cli/cli/utils.py
Outdated
current_page = page | ||
while True: | ||
page_results, page_info = api_function( | ||
page=current_page, page_size=page_size, **kwargs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
☝️ We should do this - reach out if you need more 👀
@@ -110,6 +112,17 @@ def ls(ctx, opts, owner, page, page_size): | |||
|
|||
print_vulnerability_policies(policies) | |||
|
|||
click.echo() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
☝️ Still need an answer here
…71' of github.com:cloudsmith-io/cloudsmith-cli into ceng-355-httpsgithubcomcloudsmith-iocloudsmith-clipull171
This PR includes the suggestion/contribution from PR 171 (Issue 170)
--show-all
flag to all supported pagination elements (Repo, Package, Upstream, Policy)slug_perm
to documentation for dependency command for clarity