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

Delete Pattern based on names should be regex based #102

Open
jyejare opened this issue Aug 2, 2023 · 0 comments
Open

Delete Pattern based on names should be regex based #102

jyejare opened this issue Aug 2, 2023 · 0 comments

Comments

@jyejare
Copy link
Collaborator

jyejare commented Aug 2, 2023

          Maybe this comes from an intent to have the default behavior pick all images for removal if the `delete_pattern` is empty?

Either way, it needs to be adjusted so delete_pattern is applied correctly when present - I would recommend actually using re here and actually accept a pattern string. Using just startswith will immediately limit the use and dictate that any teams wanting to use this tool have to prefix image names.

re.compile can be used to create the regex pattern object (and to parse the pattern from config), and then you can use Pattern.search function in the list comprehension to indicate whether the given pattern is anywhere in the string. match can be used too, but will be more explicit and will require the caller to specify .* in their pattern to match anywhere in the string. I think either function is fine here, but the docblock/readme/config comment should explain which is in use.

Originally posted by @mshriver in #101 (comment)

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

No branches or pull requests

1 participant