{"id":13413856,"url":"https://github.com/lucasepe/tbd","last_synced_at":"2025-08-16T05:36:44.207Z","repository":{"id":144270484,"uuid":"369539668","full_name":"lucasepe/tbd","owner":"lucasepe","description":"\"to be defined\" - a really simple way to create text templates with placeholders","archived":false,"fork":false,"pushed_at":"2021-08-29T07:51:06.000Z","size":46,"stargazers_count":27,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-15T15:42:49.745Z","etag":null,"topics":["commandline-tool","dotenv-files","golang","placeholder","text-template"],"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/lucasepe.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}},"created_at":"2021-05-21T13:11:33.000Z","updated_at":"2025-06-16T18:23:47.000Z","dependencies_parsed_at":"2024-01-07T21:54:06.812Z","dependency_job_id":null,"html_url":"https://github.com/lucasepe/tbd","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/lucasepe/tbd","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasepe%2Ftbd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasepe%2Ftbd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasepe%2Ftbd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasepe%2Ftbd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucasepe","download_url":"https://codeload.github.com/lucasepe/tbd/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucasepe%2Ftbd/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270672158,"owners_count":24625908,"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","status":"online","status_checked_at":"2025-08-16T02:00:11.002Z","response_time":91,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["commandline-tool","dotenv-files","golang","placeholder","text-template"],"created_at":"2024-07-30T20:01:51.293Z","updated_at":"2025-08-16T05:36:44.186Z","avatar_url":"https://github.com/lucasepe.png","language":"Go","readme":"# `tbd`\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/lucasepe/tbd?style=flat-square)](https://goreportcard.com/report/github.com/lucasepe/tbd) \u0026nbsp;\u0026nbsp;\u0026nbsp;\n[![Release](https://img.shields.io/github/release/lucasepe/tbd.svg?style=flat-square)](https://github.com/lucasepe/tbd/releases/latest) \u0026nbsp;\u0026nbsp;\u0026nbsp;\n[![codecov](https://codecov.io/gh/lucasepe/tbd/branch/main/graph/badge.svg?style=flat-square)](https://codecov.io/gh/lucasepe/tbd)\n\n_\"to be defined\"_\n\n## A really simple way to create text templates with placeholders.\n\nThis tool is deliberately simple and trivial, no advanced features. \n\n\u003e If you need advanced templates rendering which supports complex syntax and a huge list of datasources (JSON, YAML,  AWS EC2 metadata, BoltDB, Hashicorp \u003e Consul and Hashicorp Vault secrets), I recommend you use one of these:\n\u003e\n\u003e - [gotemplate](https://github.com/hairyhenderson/gomplate)\n\u003e - [pongo2](https://github.com/flosch/pongo2)\n\u003e - [quicktemplate](https://github.com/valyala/quicktemplate)\n\n## Built-in Variables\n\nWhen executed inside a Git repository, `tbd` automatically exports some variables related to the Git repository which may be useful in the build phase.\n\nThese variables are: `ARCH`, `OS`, `REPO_COMMIT`, `REPO_HOST`, `REPO_NAME`, `REPO_ROOT`, `REPO_TAG`, `REPO_TAG_CLEAN`, `REPO_URL`, `TIMESTAMP`.\n\nTry it! With `tbd` in your `PATH`, go in a Git folder and type:\n\n```sh\n$ tbd vars\n+----------------+------------------------------------------+\n| ARCH           | amd64                                    |\n| OS             | linux                                    |\n| REPO_COMMIT    | a3193274112d3a6f5c2a0277e2ca07ec238d622f |\n| REPO_HOST      | github.com                               |\n| REPO_NAME      | tbd                                      |\n| REPO_ROOT      | lucasepe                                 |\n| REPO_TAG       | v0.1.1                                   |\n| REPO_TAG_CLEAN | 0.1.1                                    |\n| REPO_URL       | https://github.com/lucasepe/tbd          |\n| TIMESTAMP      | 2021-07-26T14:22:36Z                     |\n+----------------+------------------------------------------+\n```\n\n\u003e Obviously in your case the values ​​will be different.\n\n## How does a template looks like ?\n\nA template is a text document in which you can insert placeholders for the text you want to make dynamic.\n\n- a placeholder is delimited by `{{` and `}}` - (i.e. `{{ FULL_NAME }}`)\n- all text outside placeholders is copied to the output unchanged\n\nExample:\n\n```yaml\napiVersion: v1\nkind: Pod\nmetadata:\n  name: {{ metadata.name }}\n  labels:\n    app: {{ metadata.labels.app }}\n spec:\n  containers:\n    - name: {{ container.1.name }}\n      image: {{ container.1.image }}\n      ports:\n        - containerPort: {{ container.1.port }}\n    - name: {{ container.2.name }}\n      image: {{ container.2.image }}\n      ports:\n        - containerPort: {{ container.2.port }}\n```\n\nAnother example:\n\n```txt\n{{ greeting }}\n\nI will be out of the office from {{ start.date }} until {{ return.date }}. \nIf you need immediate assistance while I’m away, please email {{ contact.email }}.\n\nBest,\n{{ name }}\n```\n\n## How can I define placeholders values?\n\nCreate a text file in which you enter the values for the placeholders.\n\n- define a placeholder value using `KEY = value` (or `KEY: value`)\n- empty lines are skipped\n- lines beginning with `#` are treated as comments\n\nExample:\n\n```sh\n# metadata values\nmetadata.name = rss-site\nmetadata.labels.app = web\n\n# containers values\ncontainer.1.name = front-end\ncontainer.1.image = nginx\ncontainer.1.port = 80\n\ncontainer.2.name = rss-reader\ncontainer.2.image: nickchase/rss-php-nginx:v1\ncontainer.2.port: 88\n```\n\nAnother example...\n\n```sh\ngreeting: Greetings\nstart.date: August, 9 \nreturn.date: August 23\ncontact.email: pinco.pallo@gmail.com\nname: Pinco Pallo \n```\n\n## How fill in the template?\n\n\u003e Use the `merge` command\n\n```sh\n$ tbd merge /path/to/your/template /path/to/your/envfile\n```\n\nExample:\n\n```sh\n$ tbd merge testdata/sample.tbd testdata/sample.vars\n```\n\n👉 you can also specify an HTTP url to fetch your template and/or placeholders values.\n\nExample:\n\n```sh\n$ tbd merge https://raw.githubusercontent.com/lucasepe/tbd/main/testdata/sample.tbd \\\n    https://raw.githubusercontent.com/lucasepe/tbd/main/testdata/sample.vars\n```\n\nand the output is...\n\n```txt\nGreetings\n\nI will be out of the office from August, 9 until August 23. \nIf you need immediate assistance while I’m away, please email pinco.pallo@gmail.com.\n\nBest,\nPinco Pallo\n```\n\n## How to list all template placeholders?\n\n\u003e Use the `marks` command.\n\n```sh\n$ tbd marks /path/to/your/template\n```\n\nExample:\n\n```sh\n$ tbd marks testdata/sample.tbd\ngreeting\nstart.date\nreturn.date\ncontact.email\nname\n```\n\n## How to list all variables?\n\n\u003e Use the `vars` command.\n\n```sh\n$ tbd vars /path/to/your/envfile\n```\n\nExample:\n\n```sh\n$ tbd vars testdata/sample.vars\n+----------------+------------------------------------------+\n| Label          | Value                                    |\n+----------------+------------------------------------------+\n| ARCH           | amd64                                    |\n| OS             | linux                                    |\n| REPO_COMMIT    | a3193274112d3a6f5c2a0277e2ca07ec238d622f |\n| REPO_HOST      | github.com                               |\n| REPO_NAME      | tbd                                      |\n| REPO_ROOT      | lucasepe                                 |\n| REPO_TAG       | v0.1.1                                   |\n| REPO_TAG_CLEAN | 0.1.1                                    |\n| REPO_URL       | https://github.com/lucasepe/tbd          |\n| TIMESTAMP      | 2021-07-26T14:17:49Z                     |\n| contact.email  | pinco.pallo@gmail.com                    |\n| greeting       | Greetings                                |\n| name           | Pinco Pallo                              |\n| return.date    | August 23                                |\n| start.date     | August, 9                                |\n+----------------+------------------------------------------+\n```\n\n\u003e As you can see, since I ran the command in a Git repository, there are also relative variables.\n\n# How to install?\n\nIf you have [golang](https://golang.org/dl/) installed:\n\n```sh\n$ go install github.com/lucasepe/tbd@latest\n```\n\nThis will create the executable under your `$GOPATH/bin` directory.\n\n## Ready-To-Use Releases \n\nIf you don't want to compile the sourcecode yourself, [here you can find the tool already compiled](https://github.com/lucasepe/tbd/releases/latest) for:\n\n- MacOS\n- Linux\n- Windows\n\n\u003cbr/\u003e\n\n#### Credits\n\nThanks to [@valyala](https://github.com/valyala/) for the [fasttemplate](https://github.com/valyala/fasttemplate) library - which I have modified by adding and removing some functions for the `tbd` purpose.\n","funding_links":[],"categories":["Template Engines","模板引擎","Relational Databases"],"sub_categories":["HTTP Clients","HTTP客户端"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucasepe%2Ftbd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucasepe%2Ftbd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucasepe%2Ftbd/lists"}