https://github.com/spacelift-io/celplate
Templating with Google CEL
https://github.com/spacelift-io/celplate
Last synced: about 2 months ago
JSON representation
Templating with Google CEL
- Host: GitHub
- URL: https://github.com/spacelift-io/celplate
- Owner: spacelift-io
- License: mit
- Created: 2022-10-31T10:09:58.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-13T01:08:10.000Z (3 months ago)
- Last Synced: 2025-04-05T22:11:32.730Z (about 2 months ago)
- Language: Go
- Size: 38.1 KB
- Stars: 0
- Watchers: 12
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# celplate
[](https://github.com/spacelift-io/celplate/actions/workflows/test.yml)
Celplate provides an elegant way to template files using the [Common Expression Language (CEL)](https://github.com/google/cel-spec).
The package comes with all the batteries included: a generic [scanner](scanner.go) and a single (CEL) [evaluator](evaluator/cel.go) for it.By default the scanner assumes that any block of text that start with `${{` is a special input block
which has to be evaluated and must end with `}}`, example:``` yaml
${{ inputs.serial }}
```Too see the library in action, checkout the [end to end test](e2e) for it.
**Note that the current implementation does not support escaping the special input block.**
## Extensions
We've added [ext/Strings](https://pkg.go.dev/github.com/google/cel-go/ext#Strings) extensions to the CEL evaluator. This includes a bunch of useful methods, such as `charAt`, `indexOf`, `join`, `split`, `replace`, `trim` etc.
## Releasing
To create a new release just create a new tag with a `v` prefix and push it to main. For more details checkout the go [docs on publishing modules](https://go.dev/blog/publishing-go-modules).