-
Notifications
You must be signed in to change notification settings - Fork 34
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?
Changes from 13 commits
b1cbbcb
f846fb2
14c7778
cb080c4
2872493
2eb9c38
f36ae0a
dd75831
b596d7e
9d8b666
ed7b665
c79c929
73a53c8
ce41ea2
981a8f7
526162d
46278f0
aef30f5
544a1ef
df673ac
fbb1130
de5ab4d
ab63085
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,4 +42,4 @@ reports/ | |
.env | ||
|
||
# Zipapp | ||
*.pyz | ||
*.pyz |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,13 @@ | |
from ....core.api import orgs as api | ||
from ... import command, decorators, utils, validators | ||
from ...exceptions import handle_api_exceptions | ||
from ...utils import fmt_bool, fmt_datetime, maybe_spinner, maybe_truncate_string | ||
from ...utils import ( | ||
fmt_bool, | ||
fmt_datetime, | ||
maybe_spinner, | ||
maybe_truncate_string, | ||
paginate_results, | ||
) | ||
from .command import policy | ||
|
||
|
||
|
@@ -45,10 +51,6 @@ def print_vulnerability_policies(policies): | |
utils.pretty_print_table(headers, rows, title="Vulnerability Policies") | ||
click.echo() | ||
|
||
num_results = len(rows) | ||
list_suffix = "vulnerability polic%s" % ("y" if num_results == 1 else "ies") | ||
utils.pretty_print_list_info(num_results=num_results, suffix=list_suffix) | ||
|
||
|
||
@policy.group(cls=command.AliasGroup, name="vulnerability", aliases=[]) | ||
@decorators.common_cli_config_options | ||
|
@@ -74,7 +76,7 @@ def vulnerability(*args, **kwargs): | |
"owner", metavar="OWNER", callback=validators.validate_owner, required=True | ||
) | ||
@click.pass_context | ||
def ls(ctx, opts, owner, page, page_size): | ||
def ls(ctx, opts, owner, page, page_size, show_all): | ||
""" | ||
List vulnerability policies. | ||
|
||
|
@@ -99,8 +101,8 @@ def ls(ctx, opts, owner, page, page_size): | |
context_msg = "Failed to get package vulnerability policies!" | ||
with handle_api_exceptions(ctx, opts=opts, context_msg=context_msg): | ||
with maybe_spinner(opts): | ||
policies, page_info = api.list_vulnerability_policies( | ||
owner=owner, page=page, page_size=page_size | ||
policies, page_info = paginate_results( | ||
api.list_vulnerability_policies, show_all, page, page_size, owner=owner | ||
) | ||
|
||
click.secho("OK", fg="green", err=use_stderr) | ||
|
@@ -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 commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. ☝️ Still need an answer here |
||
|
||
num_results = len(policies) | ||
list_suffix = "vulnerability polic%s" % ("y" if num_results == 1 else "ies") | ||
utils.pretty_print_list_info( | ||
num_results=num_results, | ||
page_info=None if show_all else page_info, | ||
suffix=list_suffix, | ||
show_all=show_all, | ||
) | ||
|
||
|
||
@vulnerability.command(aliases=["new"]) | ||
@decorators.common_cli_config_options | ||
|
Uh oh!
There was an error while loading. Please reload this page.