{"id":17765464,"url":"https://github.com/patrickdappollonio/tgen","last_synced_at":"2025-03-15T12:30:22.926Z","repository":{"id":37027539,"uuid":"168384254","full_name":"patrickdappollonio/tgen","owner":"patrickdappollonio","description":"A template tool with no dependencies that works like Helm templates or Consul templates.","archived":false,"fork":false,"pushed_at":"2025-03-06T05:07:39.000Z","size":1550,"stargazers_count":15,"open_issues_count":2,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-06T06:19:19.882Z","etag":null,"topics":["go","golang","hacktoberfest","template-engine","templates","yaml","yaml-templates"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/patrickdappollonio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-30T17:24:25.000Z","updated_at":"2025-03-06T05:07:36.000Z","dependencies_parsed_at":"2023-02-02T19:32:14.967Z","dependency_job_id":"f0db10b6-c06e-4002-9cf7-87f83ba8f3f4","html_url":"https://github.com/patrickdappollonio/tgen","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickdappollonio%2Ftgen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickdappollonio%2Ftgen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickdappollonio%2Ftgen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/patrickdappollonio%2Ftgen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/patrickdappollonio","download_url":"https://codeload.github.com/patrickdappollonio/tgen/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243730788,"owners_count":20338717,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","golang","hacktoberfest","template-engine","templates","yaml","yaml-templates"],"created_at":"2024-10-26T20:13:12.770Z","updated_at":"2025-03-15T12:30:21.896Z","avatar_url":"https://github.com/patrickdappollonio.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `tgen`: a tiny template tool\n\n[![Downloads](https://img.shields.io/github/downloads/patrickdappollonio/tgen/total?color=blue\u0026logo=github\u0026style=flat-square)](https://github.com/patrickdappollonio/tgen/releases)\n\n`tgen` is a simple CLI application that allows you to write a template file and then use the power of Go Templates to generate an output (which is) outputted to `stdout`. Besides the Go Template engine itself, `tgen` contains a few extra utility functions to assist you when writing templates. See below for a description of each.\n\nYou can also use the `--help` (or `-h`) to see the available set of options. The only flag required is the file to process, and everything else is optional.\n\n```\ntgen is a template generator with the power of Go Templates\n\nUsage:\n  tgen [flags]\n\nFlags:\n  -e, --environment string   an optional environment file to use (key=value formatted) to perform replacements\n  -f, --file string          the template file to process, or \"-\" to read from stdin\n  -d, --delimiter string     template delimiter (default \"{{}}\")\n  -x, --execute string       a raw template to execute directly, without providing --file\n  -v, --values string        a file containing values to use for the template, a la Helm\n      --with-values          automatically include a values.yaml file from the current working directory\n  -s, --strict               strict mode: if an environment variable or value is used in the template but not set, it fails rendering\n  -h, --help                 help for tgen\n      --version              version for tgen\n```\n\n## Usage\n\nYou can use `tgen`:\n\n* By reading environment variables from the environment or a key-value file\n* By reading variables from a YAML values file\n\nWhile working with it, `tgen` supports a \"strict\" mode, where if a variable (either environment or from a values file) is used in the template but not set, it will fail the template generation.\n\n## Examples\n\n### Simple template\n\nUsing a template file and an environment file, you can generate a template as follows:\n\n```bash\n$ cat template.txt\nThe dog licked the {{ env \"element\" }} and everyone laughed.\n\n$ cat contents.env\nelement=Oil\n\n$ tgen -e contents.env -f template.txt\nThe dog licked the Oil and everyone laughed.\n```\n\n### Inline mode\n\nYou can skip the template file altogether and use the inline mode to execute a template directly:\n\n```bash\n$ cat contents.env\nelement=Oil\n\n$ tgen -e contents.env -x 'The dog licked the {{ env \"element\" }} and everyone laughed.'\nThe dog licked the Oil and everyone laughed.\n```\n\n### Helm-style values\n\nWhile `tgen` Helm-like support is currently limited to values, it allows for a powerful way to generate templates. Consider the following example:\n\n```bash\n$ cat template.txt\nThe dog licked the {{ .element }} and everyone laughed.\n\n$ cat values.yaml\nelement: Oil\n\n$ tgen -v values.yaml -f template.txt\nThe dog licked the Oil and everyone laughed.\n```\n\nIn the last function call, if your file is named `values.yaml`, you can omit it calling it directly and instead use:\n\n```bash\n$ tgen --with-values -f template.txt\nThe dog licked the Oil and everyone laughed.\n```\n\nFor more details, see the [\"Kubernetes and Helm-style values\" documentation page](docs/helm-style-values.md).\n\n## Template functions\n\nSee [template functions](docs/functions.md) for a list of all the functions available.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickdappollonio%2Ftgen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatrickdappollonio%2Ftgen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatrickdappollonio%2Ftgen/lists"}