{"id":14155387,"url":"https://github.com/heaths/gh-template","last_synced_at":"2025-04-19T16:09:27.092Z","repository":{"id":63782725,"uuid":"568310673","full_name":"heaths/gh-template","owner":"heaths","description":"GitHub CLI extension to clone and format a template repository. Create new repos from templates to get up and running quickly e.g., `gh template clone my-crate --template heaths/template-rustlang`.","archived":false,"fork":false,"pushed_at":"2024-02-29T07:17:36.000Z","size":191,"stargazers_count":12,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T09:51:15.959Z","etag":null,"topics":["gh-extension","template","template-repository"],"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/heaths.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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}},"created_at":"2022-11-20T05:28:57.000Z","updated_at":"2025-02-01T18:59:33.000Z","dependencies_parsed_at":"2024-01-16T18:59:11.544Z","dependency_job_id":"985d4ea8-b7c9-46c9-8404-620a10ca2db4","html_url":"https://github.com/heaths/gh-template","commit_stats":{"total_commits":20,"total_committers":1,"mean_commits":20.0,"dds":0.0,"last_synced_commit":"1757bf79aa5aa0701e963b7e7a05129125bc7e32"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":"heaths/template-golang","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heaths%2Fgh-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heaths%2Fgh-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heaths%2Fgh-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heaths%2Fgh-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heaths","download_url":"https://codeload.github.com/heaths/gh-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249220841,"owners_count":21232421,"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":["gh-extension","template","template-repository"],"created_at":"2024-08-17T08:03:00.677Z","updated_at":"2025-04-16T08:33:40.754Z","avatar_url":"https://github.com/heaths.png","language":"Go","funding_links":[],"categories":["gh-extension"],"sub_categories":[],"readme":"# Project Template Extension\n\n[![releases](https://img.shields.io/github/v/release/heaths/gh-template?logo=github)](https://github.com/heaths/gh-template/releases/latest)\n[![ci](https://github.com/heaths/gh-template/actions/workflows/ci.yml/badge.svg?event=push)](https://github.com/heaths/gh-template/actions/workflows/ci.yml)\n\nA [GitHub CLI] extension to format a project template.\n\n## Install\n\nMake sure you have version 2.0 or [newer] of the [GitHub CLI] installed.\n\n```bash\ngh extension install heaths/gh-template\n```\n\n## Usage\n\nTo create a new repository from a template and format it:\n\n```bash\ngh template clone \u003cname\u003e --template \u003ctemplate\u003e --public\n```\n\n![screenshot](assets/gh-template.gif)\n\n## Templates\n\nYou can format files in a template repository as template files.\nTemplate files contain a mix of text and actions surrounded by `{{` and `}}` e.g.,\n\n```markdown\n# {{param \"name\" \"\" \"What is the project name?\" | titlecase}}\n\nThis is an example repository {{param \"github.owner\"}}/{{param \"github.repo\"}}.\n```\n\nYou'll be prompted for any parameters not specified on the command line\nor already defined by the `apply` command.\n\nDirectories and files are processed alphabetically, so you only need to\nprovide a default value and optional prompt for the first instance a parameter occurs\nalphabetically in the repository.\n\nBecause the _.github/workflows_ directory may contain workflows with `${{ }}` expressions,\nit is excluded automatically unless `--delims` is specified and not `{{` or `}}`.\nIf you need to format workflows as a template, consider using alternate delimiters\nthroughout your template repository e.g, `\u003c%` and `%\u003e`.\n\n### Built-in parameters\n\nWithin a GitHub repository, the following parameters are already defined.\n\n* `git.name`\\\n  The configured `user.name` for a Git repository.\n* `git.email`\\\n  The configured `user.email` for a Git repository.\n* `github.host`\\\n  The GitHub host e.g., \"github.com\" for \"github.com/heaths/gh-template\".\n* `github.owner`\\\n  The GitHub owner e.g., \"heaths\" for \"github.com/heaths/gh-template\".\n* `github.repo`\\\n  The GitHub repository name e.g., \"gh-template\" for \"github.com/heaths/gh-template\".\n\n### Functions\n\nIn addition to [built-in](https://pkg.go.dev/text/template#hdr-Functions) functions,\nthe following functions are also available:\n\n* `param \u003cname\u003e [\u003cdefault\u003e [\u003cprompt\u003e]]`\\\n  Replace with a parameter named `\u003cname\u003e`, or prompt using an optional `\u003cdefault\u003e`\n  with an optional `\u003cprompt\u003e`. If a `\u003cprompt\u003e` is not specified, the required\n  `\u003cname\u003e` is used. The type of `\u003cdefault\u003e` dictates valid input. Only `string`\n  and `int` are supported at this time.\n* `pluralize \u003ccount\u003e \u003cthing\u003e`\\\n  Append an \"s\" to `\u003cthing\u003e` if `\u003ccount\u003e` is not equal to 1. `\u003ccount\u003e` can be\n  either an `int` or a `string` representing an `int` e.g., \"1\".\n* `lowercase \u003cstring\u003e`\\\n  Change the case of `\u003cstring\u003e` to all lowercase characters.\n* `titlecase \u003cstring\u003e`\\\n  Change the case of `\u003cstring\u003e` to Title Case characters.\n* `uppercase \u003cstring\u003e`\\\n  Change the case of `\u003cstring\u003e` to UPPERCASE characters.\n* `replace \u003cfrom\u003e \u003cto\u003e \u003csource\u003e`\\\n  Replaces all occurrences of `\u003cfrom\u003e` to `\u003cto\u003e` in the `\u003csource\u003e` string.\n* `date`\\\n  Returns the current UTC date-time.\n* `date.Format \u003clayout\u003e`\\\n  Formats the date-time according to [`time.Format`](https://pkg.go.dev/time#Time.Format).\n* `date.Local`\\\n  Returns the current local date-time. You can call other `date` functions\n  on the returned value e.g., `date.Local.Year`.\n* `date.Year`\\\n  Returns the current UTC year.\n* `true`\\\n  Returns `true`. Useful as a default value to accept y\\[es\\] or n\\[o\\] answers.\n* `false`\\\n  Returns `false`. Useful as a default value to accept y\\[es\\] or n\\[o\\] answers.\n* `deleteFile`\\\n  Deletes the current file, or a list of file names relative to the repo root.\n\nYou can also nest function calls. To default a project name to the GitHub repo name, for example:\n\n```text\n{{param \"name\" (param \"github.repo\") \"What is the project name?\"}}\n```\n\n### Examples\n\nSee the following template repositories for examples:\n\n* [heaths/template-golang](https://github.com/heaths/template-golang)\n* [heaths/template-rustlang](https://github.com/heaths/template-rustlang)\n\n## License\n\nLicensed under the [MIT](LICENSE.txt) license.\n\n[GitHub CLI]: https://github.com/cli/cli\n[newer]: https://github.com/cli/cli/releases/latest\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheaths%2Fgh-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheaths%2Fgh-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheaths%2Fgh-template/lists"}