Skip to content

Delete Pattern based on names should be regex based #102

@jyejare

Description

@jyejare
          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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFENew Feature Request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions