Skip to content

Add template method: fnmatch#520

Merged
frenck merged 1 commit into
mainfrom
frenck-2023-1563
Jan 2, 2024
Merged

Add template method: fnmatch#520
frenck merged 1 commit into
mainfrom
frenck-2023-1563

Conversation

@frenck

@frenck frenck commented Jan 2, 2024

Copy link
Copy Markdown
Owner

Description

Add the fnmatch template method, allowing to use Unix filename pattern matching on strings or lists of strings.

Motivation and Context

This provides an easier way/alternative to the regex versions that Home Assistant core has.

On could, for example:

{{ fnmatch("test", "t*") }}  # True
{{ fnmatch("notest", "t*") }}  # False
{{ fnmatch(["test", "test2"], "t*") }}  # True
{{ fnmatch(["test", "test2", "no-test"], "t*") }}  # False

How has this been tested?

With the examples above.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Other

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@sonarqubecloud

sonarqubecloud Bot commented Jan 2, 2024

Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Kudos, no new issues were introduced!

0 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@frenck frenck added the new-feature New features or options. label Jan 2, 2024
@frenck frenck mentioned this pull request Jan 2, 2024
17 tasks
@frenck frenck merged commit 6dd049b into main Jan 2, 2024
@frenck frenck deleted the frenck-2023-1563 branch January 2, 2024 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-feature New features or options.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant