Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Module = &gcmd.Command{ Name: "module", Usage: "cool-tools module moduleName", Brief: "在modules目录下创建模块", Description: "在modules目录下创建模块, 并且创建相应的目录结构,注意: 如果模块已经存在, 则会覆盖原有的模块,本命令需在项目根目录下执行.", Arguments: []gcmd.Argument{ { Name: "moduleName", IsArg: true, Orphan: false, }, }, Func: func(ctx context.Context, parser *gcmd.Parser) (err error) { moduleName := parser.GetArg(2).String() if moduleName == "" { println("moduleName is empty") return nil } err = service.CreatModule(ctx, moduleName) return }, } M = &gcmd.Command{ Name: "m", Usage: "cool-tools module moduleName", Brief: "在modules目录下创建模块,为module的简写模式", Description: "在modules目录下创建模块, 并且创建相应的目录结构,注意: 如果模块已经存在, 则会覆盖原有的模块,本命令需在项目根目录下执行.", Arguments: []gcmd.Argument{ { Name: "moduleName", IsArg: true, Orphan: false, }, }, Func: func(ctx context.Context, parser *gcmd.Parser) (err error) { moduleName := parser.GetArg(2).String() if moduleName == "" { println("moduleName is empty") return nil } err = service.CreatModule(ctx, moduleName) return }, } )
View Source
var ( Build = cBuild{ // contains filtered or unexported fields } )
View Source
var ( Docs = gcmd.Command{ Name: "docs", Usage: "cool-tools docs", Brief: "查看帮助文档", Description: "查看帮助文档", Func: func(ctx context.Context, parser *gcmd.Parser) error { s := g.Server("docs") port, err := getfreeport() if err != nil { mlog.Fatal(err) return err } s.SetServerRoot("docs") s.BindHandler("/", func(r *ghttp.Request) { r.Response.RedirectTo("/cool-admin-go/") }) s.SetPort(gconv.Int(port)) mlog.Printf("CoolAdminGo docs server is running at %s", "http://"+"127.0.0.1"+":"+gconv.String(port)+"/cool-admin-go/") s.Run() return nil }, } )
View Source
var ( Dump = &gcmd.Command{ Name: "dump", Usage: "cool-tools dump", Brief: "查看打包的资源文件", Description: "查看打包的资源文件", Arguments: []gcmd.Argument{}, Func: func(ctx context.Context, parser *gcmd.Parser) (err error) { gres.Dump() return nil }, } )
View Source
var ( Init = gcmd.Command{ Name: "init", Usage: "cool-tools init [dst]", Brief: "创建一个新的cool-admin-go项目", Arguments: []gcmd.Argument{ { Name: "dst", Brief: "the destination path", IsArg: true, }, }, Func: func(ctx context.Context, parser *gcmd.Parser) (err error) { dst := parser.GetArg(2).String() if dst == "" { dst = "." } if gfile.IsEmpty(dst) { if err = gfile.Mkdir(dst); err != nil { return } } else { if !gfile.IsDir(dst) { g.Log().Panicf(ctx, "%s is not a directory", dst) } else { s := gcmd.Scanf(`the folder "%s" is not empty, files might be overwrote, continue? [y/n]: `, dst) if strings.EqualFold(s, "n") { return } } } err = gres.Export("cool-admin-go-simple", dst, gres.ExportOption{ RemovePrefix: "cool-admin-go-simple", }) if err != nil { return } err = gfile.ReplaceDir("cool-admin-go-simple", gfile.Basename(gfile.RealPath(dst)), dst, "*", true) if err != nil { return } g.Log().Infof(ctx, "init success") return nil }, } )
View Source
var ( Install = gcmd.Command{ Name: "install", Usage: "cool-tools install", Brief: "Install cool-tools to the system.", Func: func(ctx context.Context, parser *gcmd.Parser) (err error) { err = service.Install.Run(ctx) return }, } )
View Source
var (
Main = gcmd.Command{
Name: "cool-tools",
Usage: "cool-tools [command] [args...]",
Brief: "cool-tools is a collection of tools for cool people.",
Description: `cool-tools is a collection of tools for cool people.`,
}
)
View Source
var (
Pack = cPack{}
)
View Source
var (
Run = cRun{}
)
View Source
var ( SnippetsMaker = gcmd.Command{ Name: "snippetsmaker", Usage: "snippetsmaker", Brief: "代码片段生成器", Func: func(ctx context.Context, parser *gcmd.Parser) (err error) { g.Log().Debug(ctx, "snippetsmaker,生成工具^.^") files := garray.New(true) files.Append("modules/demo/model/demo_sample.go") files.Append("modules/demo/service/demo_sample.go") files.Append("modules/demo/controller/admin/demo_sample.go") for _, file := range files.Slice() { sArray := garray.NewStrArray() gfile.ReadLines(file.(string), func(line string) error { replaceArray := []string{"DemoSample", "${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/}", "demo_sample", "${TM_FILENAME_BASE/(.*)/${1:/downcase}/}"} result := gstr.ReplaceByArray(line, replaceArray) sArray.Append(gstr.AddSlashes(result)) return nil }) println(file.(string)) println("--------------------------------------code start------------------------------------------") println(`"body":[`) sArray.Iterator( func(index int, value string) bool { println("\"" + value + "\",") return true }, ) println("]") println("--------------------------------------code end------------------------------------------") } return nil }, } )
View Source
var ( Version = gcmd.Command{ Name: "version", Usage: "cool-tools version", Brief: "查看版本信息", Func: func(ctx context.Context, parser *gcmd.Parser) (err error) { info := gbuild.Info() binVersion := "v1.5.11" res := sVersion{ Name: "cool-tools", Homepage: "https://cool-js.com", Version: binVersion, GoFrame: info.GoFrame, Golang: info.Golang, Git: info.Git, Time: info.Time, InstallPath: gfile.SelfDir(), } gutil.Dump(res) return nil }, } )
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.