Skip to content

feat: Features - filesystem, hash functions - #9

Merged
bordeux merged 8 commits into
masterfrom
feature/improvements
Dec 30, 2025
Merged

feat: Features - filesystem, hash functions#9
bordeux merged 8 commits into
masterfrom
feature/improvements

Conversation

@bordeux

@bordeux bordeux commented Dec 30, 2025

Copy link
Copy Markdown
Owner

No description provided.

…ttern

- Add new filter_env() custom function for glob-pattern matching of environment variables
- Supports wildcards: * (any characters) and ? (single character)
- Returns sorted array of {key, value} objects
- Add regex dependency for pattern matching
- Add comprehensive unit tests for filter_env function
- Add integration test with fixtures
- Add example template (examples/server-config.tmpl)
- Update README with filter_env documentation and examples
- Update features list to mention filter_env

The filter_env() function allows users to filter environment variables by pattern
(e.g., filter_env(pattern="SERVER_*")) and iterate over matching variables in templates.
This is useful for generating configuration files, export scripts, and environment-specific
settings without hardcoding variable names.

Example usage:
{% for var in filter_env(pattern="SERVER_*") %}
  {{ var.key }}={{ var.value }}
{% endfor %}
- Add format_tera_error() function to format errors with detailed context
- Show line numbers, column positions, and expected tokens for parse errors
- Display variable names and context for runtime errors
- Show function call failures with argument details
- Include full error chain (error causes) in output

Before:
  Error: Failed to parse template: Failed to parse 'template'

After:
  Failed to parse template

  Error: Failed to parse 'template'

  Caused by:
     --> 4:1
    |
  4 |
    | ^---
    |
    = expected `%}` or `-%}`

This makes debugging templates much easier by providing actionable error messages
with precise locations and clear explanations of what went wrong.
@bordeux
bordeux merged commit 26a50b5 into master Dec 30, 2025
7 checks passed
@bordeux
bordeux deleted the feature/improvements branch December 30, 2025 21:51
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

Successfully merging this pull request may close these issues.

1 participant