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

The --filter flag improvments #1361

Merged
merged 1 commit into from
Feb 26, 2024
Merged

The --filter flag improvments #1361

merged 1 commit into from
Feb 26, 2024

Conversation

roman-kiselenko
Copy link
Contributor

@roman-kiselenko roman-kiselenko commented Feb 23, 2024

A bunch of changes from PR #1359

Follows @kwilczynski comments.

Better usage:

 --filter value, -f value [ --filter value, -f value ]  Filter output based on provided conditions.
      Each filter has an AND style relationship with the other others.
      Available filters: 
      * dangling=BOOL
      * reference=/Regular Expression/
      * before=<image-name>[:<tag>]|<image id>|<image@digest>
      * since=<image-name>[:<tag>]|<image id>|<image@digest>

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

A bunch of changes from previous PR review.

None

Does this PR introduce a user-facing change?

None

A bunch of changes : 
* handle regexp error
* better usage info
* better documentatio

@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Feb 23, 2024
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 23, 2024
@roman-kiselenko roman-kiselenko changed the title Implement The --filter flag improvments Feb 23, 2024
@roman-kiselenko
Copy link
Contributor Author

/c @saschagrunert @kwilczynski 🙏

docs/crictl.md Outdated Show resolved Hide resolved
@@ -147,7 +147,7 @@ var listImageCommand = &cli.Command{
&cli.StringSliceFlag{
Name: "filter",
Aliases: []string{"f"},
Usage: "The filtering flag format is of 'dangling=(true/false)', 'reference=regex', '(before|since)=<image-name>[:<tag>]|<image id>|<image@digest>'",
Usage: "Filter output based on provided conditions.\nEach filter has an AND style relationship with the other others.\nAvailable filters: \n* dangling=BOOL\n* reference=/Regular Expression/\n* before=<image-name>[:<tag>]|<image id>|<image@digest>\n* since=<image-name>[:<tag>]|<image id>|<image@digest>",
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps?

Suggested change
Usage: "Filter output based on provided conditions.\nEach filter has an AND style relationship with the other others.\nAvailable filters: \n* dangling=BOOL\n* reference=/Regular Expression/\n* before=<image-name>[:<tag>]|<image id>|<image@digest>\n* since=<image-name>[:<tag>]|<image id>|<image@digest>",
Usage: "Filter output based on provided conditions.\nAvailable filters: \n* dangling=(boolean - true or false)\n* reference=/regular expression/\n* before=<image-name>[:<tag>]|<image id>|<image@digest>\n* since=<image-name>[:<tag>]|<image id>|<image@digest>\nMultiple filters can be combined together.",

Produces:

   --filter value, -f value [ --filter value, -f value ]  Filter output based on provided conditions.
      Available filters: 
      * dangling=(boolean - true or false)
      * reference=/regular expression/
      * before=<image-name>[:<tag>]|<image id>|<image@digest>
      * since=<image-name>[:<tag>]|<image id>|<image@digest>
      Multiple filters can be combined together.

I wish the CLI package aligned usage to the right nicely.

docs/crictl.1 Outdated
@@ -461,7 +461,7 @@ k8s.gcr.io/pause 3.1 da86e6ba6ca19 742kB

.SS Filter images
.PP
The following filters are available \fB\fC\-\-filter\fR, \fB\fC\-f\fR, filters are chainable and processed in the declared order:
The following filters are available \fB\fC\-\-filter\fR, \fB\fC\-f\fR\&.
Copy link
Member

Choose a reason for hiding this comment

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

This file might need to get regenerated.

* handle regexp error
* better usage info
* better documentation

Signed-off-by: roman-kiselenko <roman.kiselenko.dev@gmail.com>
@kwilczynski
Copy link
Member

/approve
/lgtm

@k8s-ci-robot
Copy link
Contributor

@kwilczynski: changing LGTM is restricted to collaborators

In response to this:

/approve
/lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@kwilczynski
Copy link
Member

@roman-kiselenko, thank you! Looks good!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 26, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kwilczynski, roman-kiselenko, saschagrunert

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 26, 2024
@k8s-ci-robot k8s-ci-robot merged commit 9f41cd6 into kubernetes-sigs:master Feb 26, 2024
23 checks passed
@roman-kiselenko roman-kiselenko deleted the feature/image-filter-changes branch February 26, 2024 08:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants