Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rishang/tmpl
A CLI tool for replacing content in file or directory based on Jinja2 templates.
https://github.com/rishang/tmpl
ci cicd go jinja2 pipeline template
Last synced: about 2 months ago
JSON representation
A CLI tool for replacing content in file or directory based on Jinja2 templates.
- Host: GitHub
- URL: https://github.com/rishang/tmpl
- Owner: Rishang
- Created: 2024-04-19T18:43:11.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-04-20T05:46:32.000Z (9 months ago)
- Last Synced: 2024-04-24T11:10:30.663Z (8 months ago)
- Topics: ci, cicd, go, jinja2, pipeline, template
- Language: Go
- Homepage:
- Size: 18.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# tmpl
A CLI tool for replacing content in file or directory based on Jinja2 templates.## Table of Contents
- [tmpl](#tmpl)
- [Table of Contents](#table-of-contents)
- [Installation](#installation)
- [Usage](#usage)
- [How to use the CLI tool](#how-to-use-the-cli-tool)## Installation
Download the latest release from the [releases page](https://github.com/Rishang/tmpl/releases) and extract the binary to a directory in your Linux PATH.
## Usage
This tool can be used to replace content in files based on Jinja2 templates. So it can be helpful in replacing placeholders in configuration files, etc.
- In CI/CD pipelines to replace placeholders in configuration files.
### How to use the CLI tool
Here is the help message for the CLI tool:
```shell
tmpl --helptmpl is a CLI tool for replacing content in files based on Jinja2 templates.
Options:
-c string
Specify the path to the JSON configuration file. Default is 'tmpl.json'. (default "tmpl.json")
-f string
Specify the path to a single file to update.
-p string
Specify the path to the directory where files will be updated.Examples:
tmpl -p /path/to/directory -c /path/to/config.json
tmpl -f /path/to/file.txt -c /path/to/config.jsonThe config file should contain JSON formatted like below example:
[
{
"type": "string",
"key": "appName",
"value": "Gjinja"
},
{
"type": "base64",
"key": "secret",
"value": "bXlzZWNyZXQ="
},
{
"type": "command",
"key": "cwd",
"value": "pwd"
}
]
----
Example:
tmpl -f /path/to/file.txt -c /path/to/config.json
file.txt:Hello {{ appName }}! Your secret is {{ secret }} at {{ cwd }}.
----
Output saved to file.txt:
Hello Gjinja! Your secret is mysecret as /home/user.
```