{"id":26790300,"url":"https://github.com/qiaopengjun5162/gogen","last_synced_at":"2025-10-14T05:38:53.769Z","repository":{"id":279914431,"uuid":"939817437","full_name":"qiaopengjun5162/gogen","owner":"qiaopengjun5162","description":"A lightweight tool to generate projects from Git repositories or local templates with ease.","archived":false,"fork":false,"pushed_at":"2025-03-26T13:31:49.000Z","size":26,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-26T13:41:54.201Z","etag":null,"topics":["cli","code-generation","generator","go","template","template-engine","tool"],"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/qiaopengjun5162.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-27T06:44:54.000Z","updated_at":"2025-03-26T13:31:42.000Z","dependencies_parsed_at":"2025-02-28T13:47:24.218Z","dependency_job_id":"c587716c-0aab-45f0-83f9-ef469489238f","html_url":"https://github.com/qiaopengjun5162/gogen","commit_stats":null,"previous_names":["qiaopengjun5162/gogen"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qiaopengjun5162%2Fgogen","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qiaopengjun5162%2Fgogen/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qiaopengjun5162%2Fgogen/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qiaopengjun5162%2Fgogen/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qiaopengjun5162","download_url":"https://codeload.github.com/qiaopengjun5162/gogen/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250227243,"owners_count":21395728,"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":["cli","code-generation","generator","go","template","template-engine","tool"],"created_at":"2025-03-29T14:28:10.179Z","updated_at":"2025-10-14T05:38:48.737Z","avatar_url":"https://github.com/qiaopengjun5162.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gogen\n\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n[![All Contributors](https://img.shields.io/badge/all_contributors-1-orange.svg?style=flat-square)](#contributors-)\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\n\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/qiaopengjun5162/gogen)\n![GitHub license](https://img.shields.io/github/license/qiaopengjun5162/gogen)\n![Go Version](https://img.shields.io/badge/go-%3E%3D1.24-blue)\n\n## Chinese Documentation\n\n中文文档请参阅 [README.zh.md](README.zh.md)。\n\n## Overview\n\n`gogen` is a lightweight project generation tool designed to scaffold new projects from Git repositories or local\ntemplates. It streamlines the process by cloning from a Git URL (with optional branch specification) or copying from a\nlocal path, while supporting basic template variable substitution.\n\n### Features\n\n- Clone project templates from Git repositories (e.g., GitHub, GitLab).\n- Copy templates from local directories.\n- Specify a Git branch for cloning (optional).\n- Replace template variables (e.g., `{{project_name}}`) with user-provided values.\n- Interactive CLI with ANSI-colored output and progress tracking.\n- Embedded Git commit hash for version tracking.\n\n### Quick Start\n\nClone a template and generate a project in one command:\n\n```bash\ngogen --git=https://github.com/example/template\n```\n\n### Installation\n\n1. **Using Go**:\n\n   ```bash\n   go install github.com/yourusername/gogen@latest\n   ```\n\n2. **Manual Build**:\n\n   ```bash\n   git clone https://github.com/yourusername/gogen.git\n   cd gogen\n   go build -v -ldflags \"-X main.GitCommit=$(git rev-parse --short HEAD)\" -o gogen ./main.go\n   ```\n\n   This embeds the Git commit hash into the binary, visible when running the tool.\n\n### Usage\n\nGenerate a project from a Git repository:\n\n```bash\ngogen --git=https://github.com/example/template --branch=main\n```\n\nGenerate a project from a local template:\n\n```bash\ngogen --local=/path/to/template\n```\n\nFollow the interactive prompts to specify a project name (or accept the default derived from the template source).\n\n### Requirements\n\n- **Go**: 1.24 or later (for building from source).\n- **Git**: Required only for cloning remote templates.\n\n### Example Output\n\nBelow is an example of running `gogen` with a Git repository:\n\n```bash\n$ gogen --git=https://github.com/example/template\n[INFO] Built from Git commit: abc1234\n[INFO] Validating input...\n[INPUT] Enter project name (default: template): myproject\n[INPUT] Generate project 'myproject' from https://github.com/example/template? (Y/n): Y\n[PROGRESS] Cloning Git repository from 'https://github.com/example/template'...\n[SUCCESS] Project 'myproject' generated successfully!\n\n➜ gogen --git=https://github.com/qiaopengjun5162/gotcha\n[INFO] Validating input...\n[INPUT] Enter project name (default: gotcha):\n[INPUT] Generate project 'gotcha' from https://github.com/qiaopengjun5162/gotcha? (Y/n):\n[INFO] Generating project 'gotcha'...\n[PROGRESS] Cloning Git repository from 'https://github.com/qiaopengjun5162/gotcha'...\n正克隆到 'gotcha'...\nremote: Enumerating objects: 26, done.\nremote: Counting objects: 100% (26/26), done.\nremote: Compressing objects: 100% (22/22), done.\nremote: Total 26 (delta 1), reused 22 (delta 1), pack-reused 0 (from 0)\n接收对象中: 100% (26/26), 10.39 KiB | 5.20 MiB/s, 完成.\n处理 delta 中: 100% (1/1), 完成.\n[SUCCESS] Project 'gotcha' generated successfully!\n\n➜ gogen --git=https://github.com/qiaopengjun5162/gotcha\n[INFO] Validating input...\n[INPUT] Enter project name (default: gotcha): myproject\n[INPUT] Generate project 'myproject' from https://github.com/qiaopengjun5162/gotcha? (Y/n): y\n[INFO] Generating project 'myproject'...\n[PROGRESS] Cloning Git repository from 'https://github.com/qiaopengjun5162/gotcha'...\n正克隆到 'myproject'...\nremote: Enumerating objects: 26, done.\nremote: Counting objects: 100% (26/26), done.\nremote: Compressing objects: 100% (22/22), done.\nremote: Total 26 (delta 1), reused 22 (delta 1), pack-reused 0 (from 0)\n接收对象中: 100% (26/26), 10.39 KiB | 5.20 MiB/s, 完成.\n处理 delta 中: 100% (1/1), 完成.\n[SUCCESS] Project 'myproject' generated successfully!\n\n```\n\n### Project Structure\n\n```\ngogen/\n├── CHANGELOG.md    # Version history\n├── LICENSE         # Project license\n├── Makefile        # Build automation\n├── README.md       # This file\n├── README.zh.md    # Chinese documentation\n├── go.mod          # Go module file\n├── main.go         # Main source file\n```\n\n### Contributing\n\nWe welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on how to report issues, submit\npull requests, or improve the project.\n\n## Contributors\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctbody\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" valign=\"top\" width=\"14.28%\"\u003e\u003ca href=\"https://github.com/qiaopengjun5162\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/124650229?v=4?s=100\" width=\"100px;\" alt=\"Paxon Qiao 乔鹏军\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003ePaxon Qiao 乔鹏军\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#content-qiaopengjun5162\" title=\"Content\"\u003e🖋\u003c/a\u003e\u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tbody\u003e\n  \u003ctfoot\u003e\n    \u003ctr\u003e\n      \u003ctd align=\"center\" size=\"13px\" colspan=\"7\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/all-contributors/all-contributors-cli/1b8533af435da9854653492b1327a23a4dbd0a10/assets/logo-small.svg\"\u003e\n          \u003ca href=\"https://all-contributors.js.org/docs/en/bot/usage\"\u003eAdd your contributions\u003c/a\u003e\n        \u003c/img\u003e\n      \u003c/td\u003e\n    \u003c/tr\u003e\n  \u003c/tfoot\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\n### License\n\nThis project is licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqiaopengjun5162%2Fgogen","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqiaopengjun5162%2Fgogen","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqiaopengjun5162%2Fgogen/lists"}