feat:goctl model mongo add easy flag for easy declare. (#2073)

* fix:typo in readme.md

* feat:`goctl model mongo ` add `easy` flag to generate code with Auto generated CollectionName for easy declare.

* fix:`goctl api doc ` when referenced api file contains no route,will generate an empty markdown file.

* code: adjust code.

Co-authored-by: 虫子樱桃 <czyt@w.cn>
This commit is contained in:
虫子樱桃
2022-07-09 15:34:01 +08:00
committed by GitHub
parent 1410f7dc20
commit 725e6056e1
5 changed files with 28 additions and 6 deletions

View File

@@ -19,6 +19,8 @@ var (
VarStringDir string
// VarBoolCache describes whether cache is enabled.
VarBoolCache bool
// VarBoolEasy describes whether to generate Collection Name in the code for easy declare.
VarBoolEasy bool
// VarStringStyle describes the style.
VarStringStyle string
// VarStringHome describes the goctl home.
@@ -33,19 +35,20 @@ var (
func Action(_ *cobra.Command, _ []string) error {
tp := VarStringSliceType
c := VarBoolCache
easy := VarBoolEasy
o := strings.TrimSpace(VarStringDir)
s := VarStringStyle
home := VarStringHome
remote := VarStringRemote
branch := VarStringBranch
if len(remote) > 0 {
repo, _ := file.CloneIntoGitHome(remote, branch)
if len(repo) > 0 {
home = repo
}
}
if len(home) > 0 {
pathx.RegisterGoctlHome(home)
}
@@ -71,6 +74,7 @@ func Action(_ *cobra.Command, _ []string) error {
return generate.Do(&generate.Context{
Types: tp,
Cache: c,
Easy: easy,
Output: a,
Cfg: cfg,
})