{"id":15046450,"url":"https://github.com/gin-admin/gin-admin-cli","last_synced_at":"2025-04-04T14:07:05.377Z","repository":{"id":37866989,"uuid":"199951347","full_name":"gin-admin/gin-admin-cli","owner":"gin-admin","description":"A gin-admin efficiency assistant that provides project initialization, code generation, greatly improves work efficiency, and quickly completes the development of business logic.","archived":false,"fork":false,"pushed_at":"2024-10-18T08:29:19.000Z","size":411,"stargazers_count":131,"open_issues_count":5,"forks_count":58,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-28T13:08:05.506Z","etag":null,"topics":["gin","gin-admin","go-admin"],"latest_commit_sha":null,"homepage":"https://github.com/LyricTian/gin-admin","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/gin-admin.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-01T01:06:32.000Z","updated_at":"2025-02-04T04:23:06.000Z","dependencies_parsed_at":"2023-07-13T13:54:51.362Z","dependency_job_id":"2e5deef9-c9bc-4600-9d0c-dbb7479ca261","html_url":"https://github.com/gin-admin/gin-admin-cli","commit_stats":null,"previous_names":["lyrictian/gin-admin-cli"],"tags_count":26,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gin-admin%2Fgin-admin-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gin-admin%2Fgin-admin-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gin-admin%2Fgin-admin-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gin-admin%2Fgin-admin-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gin-admin","download_url":"https://codeload.github.com/gin-admin/gin-admin-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247190250,"owners_count":20898702,"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":["gin","gin-admin","go-admin"],"created_at":"2024-09-24T20:53:07.357Z","updated_at":"2025-04-04T14:07:05.360Z","avatar_url":"https://github.com/gin-admin.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [GIN-Admin](https://github.com/LyricTian/gin-admin) efficiency assistant\n\n\u003e A gin-admin efficiency assistant that provides project initialization, code generation, greatly improves work efficiency, and quickly completes the development of business logic.\n\n## Dependencies\n\n- [Go](https://golang.org/) 1.19+\n- [Wire](github.com/google/wire) `go install github.com/google/wire/cmd/wire@latest`\n- [Swag](github.com/swaggo/swag) `go install github.com/swaggo/swag/cmd/swag@latest`\n\n## Quick start\n\n### Get and install\n\n```bash\ngo install github.com/gin-admin/gin-admin-cli/v10@latest\n```\n\n### Create a new project\n\n```bash\ngin-admin-cli new -d ~/go/src --name testapp --desc 'A test API service based on golang.' --pkg 'github.com/xxx/testapp'\n```\n\n### Quick generate a struct\n\n```bash\ngin-admin-cli gen -d ~/go/src/testapp -m SYS --structs Dictionary --structs-comment \"Dictionaries management\" --structs-router-prefix\n```\n\n### Use config file to generate struct\n\n\u003e More examples can be found in the [examples directory](https://github.com/gin-admin/gin-admin-cli/tree/master/examples)\n\nUsing `Dictionary` as an example, the configuration file is as follows `dictionary.yaml`:\n\n```yaml\n- name: Dictionary\n  comment: Dictionaries management\n  disable_pagination: true\n  fill_gorm_commit: true\n  fill_router_prefix: true\n  tpl_type: \"tree\"\n  fields:\n    - name: Code\n      type: string\n      comment: Code of dictionary (unique for same parent)\n      gorm_tag: \"size:32;\"\n      form:\n        binding_tag: \"required,max=32\"\n    - name: Name\n      type: string\n      comment: Display name of dictionary\n      gorm_tag: \"size:128;index\"\n      query:\n        name: LikeName\n        in_query: true\n        form_tag: name\n        op: LIKE\n      form:\n        binding_tag: \"required,max=128\"\n    - name: Description\n      type: string\n      comment: Details about dictionary\n      gorm_tag: \"size:1024\"\n      form: {}\n    - name: Sequence\n      type: int\n      comment: Sequence for sorting\n      gorm_tag: \"index;\"\n      order: DESC\n      form: {}\n    - name: Status\n      type: string\n      comment: Status of dictionary (disabled, enabled)\n      gorm_tag: \"size:20;index\"\n      query: {}\n      form:\n        binding_tag: \"required,oneof=disabled enabled\"\n```\n\n```bash\n./gin-admin-cli gen -d ~/go/src/testapp -m SYS -c dictionary.yaml\n```\n\n### Use `ant-design-pro-v5` template to generate struct and UI\n\n```yaml\n- name: Parameter\n  comment: System parameter management\n  generate_fe: true\n  fe_tpl: \"ant-design-pro-v5\"\n  extra:\n    ParentName: system\n    IndexAntdImport: \"Tag\"\n    IndexProComponentsImport: \"\"\n    FormAntdImport: \"\"\n    FormProComponentsImport: \"ProFormText, ProFormTextArea, ProFormSwitch\"\n    IncludeCreatedAt: true\n    IncludeUpdatedAt: true\n  fe_mapping:\n    services.typings.d.ts.tpl: \"src/services/system/parameter/typings.d.ts\"\n    services.index.ts.tpl: \"src/services/system/parameter/index.ts\"\n    pages.components.form.tsx.tpl: \"src/pages/system/Parameter/components/SaveForm.tsx\"\n    pages.index.tsx.tpl: \"src/pages/system/Parameter/index.tsx\"\n    locales.en.page.ts.tpl: \"src/locales/en-US/pages/system.parameter.ts\"\n  fields:\n    - name: Name\n      type: string\n      comment: Name of parameter\n      gorm_tag: \"size:128;index\"\n      unique: true\n      query:\n        name: LikeName\n        in_query: true\n        form_tag: name\n        op: LIKE\n      form:\n        binding_tag: \"required,max=128\"\n      extra:\n        ColumnComponent: \u003e\n          {\n            title: intl.formatMessage({ id: 'pages.system.parameter.form.name' }),\n            dataIndex: 'name',\n            width: 160,\n            key: 'name', // Query field name\n          }\n        FormComponent: \u003e\n          \u003cProFormText\n           name=\"name\"\n           label={intl.formatMessage({ id: 'pages.system.parameter.form.name' })}\n           placeholder={intl.formatMessage({ id: 'pages.system.parameter.form.name.placeholder' })}\n           rules={[\n             {\n               required: true,\n               message: intl.formatMessage({ id: 'pages.system.parameter.form.name.required' }),\n             },\n           ]}\n           colProps={{ span: 24 }}\n           labelCol={{ span: 2 }}\n          /\u003e\n    - name: Value\n      type: string\n      comment: Value of parameter\n      gorm_tag: \"size:1024;\"\n      form:\n        binding_tag: \"max=1024\"\n      extra:\n        ColumnComponent: \u003e\n          {\n            title: intl.formatMessage({ id: 'pages.system.parameter.form.value' }),\n            dataIndex: 'value',\n            width: 200,\n          }\n        FormComponent: \u003e\n          \u003cProFormTextArea\n            name=\"value\"\n            label={intl.formatMessage({ id: 'pages.system.parameter.form.value' })}\n            fieldProps={{ rows: 3 }}\n            colProps={{ span: 24 }}\n            labelCol={{ span: 2 }}\n          /\u003e\n    - name: Remark\n      type: string\n      comment: Remark of parameter\n      gorm_tag: \"size:255;\"\n      form: {}\n      extra:\n        ColumnComponent: \u003e\n          {\n            title: intl.formatMessage({ id: 'pages.system.parameter.form.remark' }),\n            dataIndex: 'remark',\n            width: 180,\n          }\n        FormComponent: \u003e\n          \u003cProFormText\n            name=\"remark\"\n            label={intl.formatMessage({ id: 'pages.system.parameter.form.remark' })}\n            colProps={{ span: 24 }}\n            labelCol={{ span: 2 }}\n          /\u003e\n    - name: Status\n      type: string\n      comment: Status of parameter (enabled, disabled)\n      gorm_tag: \"size:20;index\"\n      query:\n        in_query: true\n      form:\n        binding_tag: \"required,oneof=enabled disabled\"\n      extra:\n        ColumnComponent: \u003e\n          {\n            title: intl.formatMessage({ id: 'pages.system.parameter.form.status' }),\n            dataIndex: 'status',\n            width: 130,\n            search: false,\n            render: (status) =\u003e {\n              return (\n                \u003cTag color={status === 'enabled' ? 'success' : 'error'}\u003e\n                  {status === 'enabled'\n                    ? intl.formatMessage({ id: 'pages.system.parameter.form.status.enabled', defaultMessage: 'Enabled' })\n                    : intl.formatMessage({ id: 'pages.system.parameter.form.status.disabled', defaultMessage: 'Disabled' })}\n                \u003c/Tag\u003e\n              );\n            },\n          }\n        FormComponent: \u003e\n          \u003cProFormSwitch\n            name=\"statusChecked\"\n            label={intl.formatMessage({ id: 'pages.system.parameter.form.status' })}\n            fieldProps={{\n              checkedChildren: intl.formatMessage({ id: 'pages.system.parameter.form.status.enabled', defaultMessage: 'Enabled' }),\n              unCheckedChildren: intl.formatMessage({ id: 'pages.system.parameter.form.status.disabled', defaultMessage: 'Disabled' }),\n            }}\n            colProps={{ span: 24 }}\n            labelCol={{ span: 2 }}\n          /\u003e\n```\n\n```bash\n./gin-admin-cli gen -d ~/go/src/testapp -m SYS -c parameter.yaml\n```\n\n### Remove a struct from the module\n\n```bash\ngin-admin-cli rm -d ~/go/src/testapp -m SYS -s Dictionary\n```\n\n## Command help\n\n### New command\n\n```text\nNAME:\n   gin-admin-cli new - Create a new project\n\nUSAGE:\n   gin-admin-cli new [command options] [arguments...]\n\nOPTIONS:\n   --dir value, -d value  The directory to generate the project (default: current directory)\n   --name value           The project name\n   --app-name value       The application name (default: project name)\n   --desc value           The project description\n   --version value        The project version (default: 1.0.0)\n   --pkg value            The project package name (default: project name)\n   --git-url value        Use git repository to initialize the project (default: https://github.com/LyricTian/gin-admin.git)\n   --git-branch value     Use git branch to initialize the project (default: main)\n   --fe-dir value         The frontend directory to generate the project (if empty, the frontend project will not be generated)\n   --fe-name value        The frontend project name (default: frontend)\n   --fe-git-url value     Use git repository to initialize the frontend project (default: https://github.com/gin-admin/gin-admin-frontend.git)\n   --fe-git-branch value  Use git branch to initialize the frontend project (default: main)\n   --help, -h             show help\n```\n\n### Generate command\n\n```text\nNAME:\n   gin-admin-cli generate - Generate structs to the specified module, support config file\n\nUSAGE:\n   gin-admin-cli generate [command options] [arguments...]\n\nOPTIONS:\n   --dir value, -d value     The project directory to generate the struct\n   --module value, -m value  The module to generate the struct from (like: RBAC)\n   --module-path value       The module path to generate the struct from (default: internal/mods)\n   --wire-path value         The wire generate path to generate the struct from (default: internal/wirex)\n   --swag-path value         The swagger generate path to generate the struct from (default: internal/swagger)\n   --config value, -c value  The config file or directory to generate the struct from (JSON/YAML)\n   --structs value           The struct name to generate\n   --structs-comment value   Specify the struct comment\n   --structs-router-prefix   Use module name as router prefix (default: false)\n   --structs-output value    Specify the packages to generate the struct (default: schema,dal,biz,api)\n   --tpl-path value          The template path to generate the struct from (default use tpls)\n   --tpl-type value          The template type to generate the struct from (default: default)\n   --fe-dir value            The frontend project directory to generate the UI\n   --help, -h                show help\n```\n\n### Remove command\n\n```text\nNAME:\n   gin-admin-cli remove - Remove structs from the module\n\nUSAGE:\n   gin-admin-cli remove [command options] [arguments...]\n\nOPTIONS:\n   --dir value, -d value      The directory to remove the struct from\n   --module value, -m value   The module to remove the struct from\n   --module-path value        The module path to remove the struct from (default: internal/mods)\n   --structs value, -s value  The struct to remove (multiple structs can be separated by a comma)\n   --config value, -c value   The config file to generate the struct from (JSON/YAML)\n   --wire-path value          The wire generate path to remove the struct from (default: internal/library/wirex)\n   --swag-path value          The swagger generate path to remove the struct from (default: internal/swagger)\n   --help, -h                 show help\n```\n\n## MIT License\n\n```text\nCopyright (c) 2023 Lyric\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgin-admin%2Fgin-admin-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgin-admin%2Fgin-admin-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgin-admin%2Fgin-admin-cli/lists"}