{"id":24280663,"url":"https://github.com/dmullis/gemp","last_synced_at":"2026-04-21T04:04:31.471Z","repository":{"id":57566221,"uuid":"290680987","full_name":"dmullis/gemp","owner":"dmullis","description":"Recursively expand Go text/template files, from the Linux command line.","archived":false,"fork":false,"pushed_at":"2021-03-26T03:41:15.000Z","size":44,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-17T15:00:46.824Z","etag":null,"topics":["cli","code-generation","compatibility-layer","golang-tools","template-engine"],"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/dmullis.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}},"created_at":"2020-08-27T05:07:26.000Z","updated_at":"2023-02-13T21:09:52.000Z","dependencies_parsed_at":"2022-08-27T19:01:24.978Z","dependency_job_id":null,"html_url":"https://github.com/dmullis/gemp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dmullis/gemp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmullis%2Fgemp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmullis%2Fgemp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmullis%2Fgemp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmullis%2Fgemp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmullis","download_url":"https://codeload.github.com/dmullis/gemp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmullis%2Fgemp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32076295,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T02:38:07.213Z","status":"ssl_error","status_checked_at":"2026-04-21T02:38:06.559Z","response_time":128,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["cli","code-generation","compatibility-layer","golang-tools","template-engine"],"created_at":"2025-01-16T02:25:19.464Z","updated_at":"2026-04-21T04:04:31.457Z","avatar_url":"https://github.com/dmullis.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- Copyright 2020 Donald Mullis. All rights reserved.\n     https://github.github.com/gfm/\n  --\u003e\n\n\n\u003c!-- [Donald Mullis](https://github.com/dmullis)\n --\u003e\n\n# gemp: A Recursive CLI Expander of Go Template Files\n\nGemp reads pairs specifying Key-to-list-of-Value mappings ```K=V1,V2...Vn```,\nand stores them for use according to the purpose of a specific subcommand\n```gen``` or ```dump```.\n\nTypical use cases are generation of source code variants differing only by simple substitution,\nbut possibly many combinations of values.\nSubstitutions are performed by Go's ```text/template``` or ```fmt``` standard library packages.\n\nFor trivial examples, read on.\n## gen\n### Push Key-Value Pair Combinations through Source Code Template\n\nExpand some template file according to all possible combinations of K=V1,V2... pairs,\nwrite into multiple output files, naming each according to its\nspecific combination of values.\nFormat of the template file is as\nspecified in a Go standard library [template file](https://golang.org/pkg/text/template).\nUsable functionality from\n```template```\nis constrained by gemp's limitation that the data structure\npresented to the\n```template.Execute()```\nis simply a list of Key=Value\npairs, both Key and Value of string type.\n\n```\n     # Write out a file containing valid ```template``` syntax\n     $ echo '! Generated for {{.Color}} at {{.TimeHMS}}' \u003estamp+Color+.sh\n     # Expand into two output files containing substitutions.\n     $ gemp -format '-%.0s%s' Color=\"Blue,Red\" TimeHMS=\"$(date +%H:%M:%S),\" \\\n           gen -inkeyseparator '+' -outtopdir . stamp+Color+.sh\n     $ more stamp-*.sh\n     ::::::::::::::\n     stamp-Blue.sh\n     ::::::::::::::\n     ! Generated for Blue at 21:04:42\n     ::::::::::::::\n     stamp-Red.sh\n     ::::::::::::::\n     ! Generated for Red at 21:04:42\n```\n\nIn the example above, a call is made to ```Execute()``` for each\nof ```Blue``` and ```Red``` from the comma-separated list ```Color```.\n\n## dump\n### Matching Constant Definitions Across Languages\n\nFormat all ```Key=Value``` pairs as specified on command line and write to standard output.\nA pattern in the format of Go's [```fmt```](https://golang.org/pkg/fmt) package\ntakes the place of the template file.\n\n```sh\n     # Store Key=Value pairs, separated by a newline character, into a shell variable\n     $ KV=User=$USER\\ TimeHMS=\"$(date +%H:%M:%S)\"\n     # Expand a JavaScript-specific format arg\n     $ gemp -format 'export const %s = \"%s\";'$'' $KV dump\n     export const User = \"dmullis\";\n     export const TimeHMS = \"20:41:06\";\n     # Expand a Go-specific format arg\n     $ gemp -format 'const %s = \"%s\"'$'' $KV dump\n     const User = \"dmullis\"\n     const TimeHMS = \"20:41:06\"\n```\n### Usage\n\n[Generic](./doc/usage.md) to both *gen* and *dump* commands.\n\n[Specific to *gen*](./doc/gen-usage.md).\n\nIf generating program source code, two difficulties may appear:\n 1. For a satisfactory experience when debugging stack traces,\ntemplate expansions must match the number of lines in the template source code.\nWorkaround examples may be found in [```_test_src/```](./_test_src/).\n 2. [gofmt](https://golang.org/cmd/gofmt/) is confused by template syntax e.g. \"{{...}}\".\n\n\"gemp\" is a portmanteau of \"Go-tEMPlate\".\n\n### See also\n\nOther Go-based templating utilities, targeting somewhat different use cases:\n - [stringer](https://pkg.go.dev/golang.org/x/tools@v0.1.0/cmd/stringer)\n - [Kubernetes templates](https://pkg.go.dev/k8s.io/kubernetes/pkg/kubectl/util/templates)\n - [gotpl](https://github.com/tsg/gotpl)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmullis%2Fgemp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmullis%2Fgemp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmullis%2Fgemp/lists"}