Skip to content

Commit c98926e

Browse files
committed
fix: Update readme
1 parent 0d1dfda commit c98926e

File tree

2 files changed

+25
-17
lines changed

2 files changed

+25
-17
lines changed

README.md

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,24 @@ go install github.com/gin-admin/gin-admin-cli/v10@latest
2222
gin-admin-cli new -d ~/go/src --name testapp --desc 'A test API service based on golang.' --pkg 'github.com/xxx/testapp'
2323
```
2424

25-
### Generate a new struct
25+
### Quick generate a struct
26+
27+
```bash
28+
gin-admin-cli gen -d ~/go/src/testapp -m SYS --structs Dictionary --structs-comment "Dictionaries management" --structs-router-prefix
29+
```
30+
31+
### Use config file to generate struct
2632

2733
> More examples can be found in the [examples directory](https://github.com/gin-admin/gin-admin-cli/tree/master/examples)
2834
2935
Using `Dictionary` as an example, the configuration file is as follows `dictionary.yaml`:
3036

3137
```yaml
3238
- name: Dictionary
33-
comment: Dictionary management for system
39+
comment: Dictionaries management
3440
disable_pagination: true
41+
fill_gorm_commit: true
42+
fill_router_prefix: true
3543
tpl_type: "tree"
3644
fields:
3745
- name: Code
@@ -118,20 +126,20 @@ USAGE:
118126
gin-admin-cli generate [command options] [arguments...]
119127
120128
OPTIONS:
121-
--dir value, -d value The project directory to generate the struct
122-
--module value, -m value The module to generate the struct from (like: RBAC)
123-
--module-path value The module path to generate the struct from (default: internal/mods)
124-
--wire-path value The wire generate path to generate the struct from (default: internal/wirex)
125-
--swag-path value The swagger generate path to generate the struct from (default: internal/swagger)
126-
--config value, -c value The config file or directory to generate the struct from (JSON/YAML)
127-
--structs value, -s value The struct to generate (multiple structs can be separated by a comma)
128-
--structs-comment value Specify the struct comment
129-
--structs-output value Specify the packages to generate the struct (default: schema,dal,biz,api)
130-
--tpl-path value The template path to generate the struct from (default use tpls)
131-
--tpl-type value The template type to generate the struct from (default: default)
132-
--fe-dir value The frontend project directory to generate the UI
133-
--fe-tpl-type value The template type to generate the frontend from (default: react)
134-
--help, -h show help
129+
--dir value, -d value The project directory to generate the struct
130+
--module value, -m value The module to generate the struct from (like: RBAC)
131+
--module-path value The module path to generate the struct from (default: internal/mods)
132+
--wire-path value The wire generate path to generate the struct from (default: internal/wirex)
133+
--swag-path value The swagger generate path to generate the struct from (default: internal/swagger)
134+
--config value, -c value The config file or directory to generate the struct from (JSON/YAML)
135+
--structs value The struct name to generate
136+
--structs-comment value Specify the struct comment
137+
--structs-router-prefix Use module name as router prefix (default: false)
138+
--structs-output value Specify the packages to generate the struct (default: schema,dal,biz,api)
139+
--tpl-path value The template path to generate the struct from (default use tpls)
140+
--tpl-type value The template type to generate the struct from (default: default)
141+
--fe-dir value The frontend project directory to generate the UI
142+
--help, -h show help
135143
```
136144

137145
### Remove command

internal/schema/struct.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ type S struct {
2828
DisablePagination bool `yaml:"disable_pagination,omitempty" json:"disable_pagination,omitempty"`
2929
DisableDefaultFields bool `yaml:"disable_default_fields,omitempty" json:"disable_default_fields,omitempty"`
3030
FillGormCommit bool `yaml:"fill_gorm_commit,omitempty" json:"fill_gorm_commit,omitempty"`
31-
FillRouterPrefix bool `yaml:"fill_router_module_name,omitempty" json:"fill_router_module_name,omitempty"`
31+
FillRouterPrefix bool `yaml:"fill_router_prefix,omitempty" json:"fill_router_prefix,omitempty"`
3232
Fields []*Field `yaml:"fields,omitempty" json:"fields,omitempty"`
3333
GenerateFE bool `yaml:"generate_fe,omitempty" json:"generate_fe,omitempty"`
3434
FETpl string `yaml:"fe_tpl,omitempty" json:"fe_tpl,omitempty"` // react/react-v5-i18n

0 commit comments

Comments
 (0)