{"id":22654237,"url":"https://github.com/stevencyb/gotmpl","last_synced_at":"2025-08-06T08:32:10.335Z","repository":{"id":207069761,"uuid":"717055345","full_name":"StevenCyb/gotmpl","owner":"StevenCyb","description":"gotmpl is a versatile CLI tool designed for rendering templates using various data sources such as stdin, files, or web resources. With support for multiple data inputs and flexible output options, gotmpl empowers you to effortlessly generate templated content, whether for display on stdout or saving to a file.","archived":false,"fork":false,"pushed_at":"2023-11-13T22:01:18.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-11-14T00:25:26.185Z","etag":null,"topics":[],"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/StevenCyb.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}},"created_at":"2023-11-10T13:05:38.000Z","updated_at":"2023-11-14T00:25:29.378Z","dependencies_parsed_at":"2023-11-14T00:25:28.809Z","dependency_job_id":"bafaa409-3b41-4fd5-b7fd-71999d5f4fa2","html_url":"https://github.com/StevenCyb/gotmpl","commit_stats":null,"previous_names":["stevencyb/gotmpl"],"tags_count":1,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenCyb%2Fgotmpl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenCyb%2Fgotmpl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenCyb%2Fgotmpl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StevenCyb%2Fgotmpl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StevenCyb","download_url":"https://codeload.github.com/StevenCyb/gotmpl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228867116,"owners_count":17983879,"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":[],"created_at":"2024-12-09T09:36:00.145Z","updated_at":"2024-12-09T09:36:00.817Z","avatar_url":"https://github.com/StevenCyb.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gotmpl\n\n`gotmpl` is a command-line interface (CLI) tool for template rendering. Whether you're working with templates from stdin, files, or web resources, `gotmpl` simplifies the process by allowing you to provide multiple data inputs through arguments, files, or URLs. The rendered output can be directed to stdout or saved into a specified file.\n\n## Example\n```bash\n$ echo \"Hello, {{.Name}}\" | go run main.go -data '{\"Name\": \"John\"}'\nHello, John%     \n```\n\n## Usage\nCurrently supported arguments can be listed as follow.\n```bash\n$ ./gotmpl --help\nUsage: gotmpl [options] -tmpl {URL,Path} -out {Path}\nOptions:\n  -data value\n        Data to use {URL,Path,JSON}. Multiple allowed.\n  -help\n        Show this help message.\n  -out string\n        Render output {Path} or stdout.\n  -tmpl string\n        Template to use {URL,Path} or stdin.\n```\n\nThis cli tool uses the go text template engine. A documentation for that is available [here](https://pkg.go.dev/text/template).\nIn general, the tool can be used as follow:\n1. provide a template\n   * from a file like `-tmpl /some/path/mail_template.txt`\n   * from a web resource like `-tmpl https://some.url/mail_template` (requires `http` or `https` prefix)\n   * from std like `echo \"template\" | ...` (without `-tmpl` argument)\n2. provide data *(for multiple data source see note below)*\n   * from a JSON formatted file like `-tmpl /some/path/user_a.json`\n   * from a JSON formatted web resource like `-tmpl https://some.url/user_a` (requires `http` or `https` prefix)\n   * directly as JSON formatted string `-tmpl '{...}'` or `-tmpl '[...]'`\n3. define the output\n   * into a file like `-out result.txt`\n   * stdout is used by default if `-out` not defined\n\n**NOTE:** When using multiple data sources, they are placed in an array (keeping the order). \nFor example the templates will look as follow multiple data sources:\n```bash\necho \"Name: {{(index . 0).Name}}, Age: {{(index . 1).Age}}\" | ./gotmpl -data '{\"Name\": \"Nina\"}' -data '{\"Age\": 33}'\n# OR\necho \"Name: {{index . 0 \\\"Name\\\"}}, Age: {{index . 1 \\\"Age\\\"}}\" | ./gotmpl -data '{\"Name\": \"Nina\"}' -data '{\"Age\": 33}'\n```\nWith single data source:\n```bash\necho \"Name: {{.Name}}, Age: {{.Age}}\" | ./gotmpl -data '{\"Name\": \"Nina\", \"Age\": 33}'\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevencyb%2Fgotmpl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstevencyb%2Fgotmpl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstevencyb%2Fgotmpl/lists"}