diff --git a/base/log/debug.go b/base/log/debug.go index 03297ecd..b9a29e01 100644 --- a/base/log/debug.go +++ b/base/log/debug.go @@ -1,6 +1,7 @@ package log import ( + "regexp" "strings" "time" "unicode" @@ -32,6 +33,7 @@ func init() { cli.OpenCmds(m, kit.Format("cd %s", kit.Path("")), "tail -f var/log/bench.log") }}, }, Hand: func(m *ice.Message, arg ...string) { + r := regexp.MustCompile("{.*}") offset, limit := kit.Int(kit.Select("0", arg, 1)), kit.Int(kit.Select("100", arg, 2)) switch arg[0] { case BENCH, ERROR, DEBUG: @@ -66,6 +68,10 @@ func init() { ls[6], ls[7] = ls[6]+lex.SP+_ls[0], _ls[1] } } + switch ls[6] { + case "recv", "done", "send", "echo": + ls[7] += "\n" + kit.Formats(kit.UnMarshal(r.FindString(ls[7]))) + } m.Push(ctx.SHIP, ls[5]).Push(LEVEL, ls[6]).Push(nfs.CONTENT, ls[7]) }) case WATCH: diff --git a/base/nfs/dir.go b/base/nfs/dir.go index 8fadff27..64eeb0eb 100644 --- a/base/nfs/dir.go +++ b/base/nfs/dir.go @@ -147,6 +147,8 @@ const ( SCAN = "scan" GOWORK = "gowork" + PORTAL_GO = "portal.go" + PORTAL_JSON = "portal.json" ETC_LOCAL_SH = "etc/local.sh" ETC_CERT_KEY = "etc/cert/cert.key" ETC_CERT_PEM = "etc/cert/cert.pem" @@ -196,8 +198,8 @@ const ( TYPE_BOTH = "both" DIR_ROOT = "dir_root" - DIR_TYPE = "dir_type" DIR_DEEP = "dir_deep" + DIR_TYPE = "dir_type" DIR_REG = "dir_reg" DIR_DEF_FIELDS = "time,path,size,action" diff --git a/base/web/dream.go b/base/web/dream.go index 620739ef..b4188037 100644 --- a/base/web/dream.go +++ b/base/web/dream.go @@ -121,7 +121,7 @@ func _dream_start(m *ice.Message, name string) { if !m.IsCliUA() { // defer m.ProcessOpenAndRefresh(m.MergePod(name)) defer m.ProcessRefresh() - defer ToastProcess(m, mdb.CREATE, name)() + // defer ToastProcess(m, mdb.CREATE, name)() } defer mdb.Lock(m, m.PrefixKey(), cli.START, name)() p := _dream_check(m, name) diff --git a/base/web/render.go b/base/web/render.go index 9a5c5dfa..d89a1aba 100644 --- a/base/web/render.go +++ b/base/web/render.go @@ -208,6 +208,7 @@ const ( INSTALL = "install" CODE_MYSQL_CLIENT = "web.code.mysql.client" + CODE_MYSQL_QUERY = "web.code.mysql.query" CODE_GIT_SERVICE = "web.code.git.service" CODE_GIT_SEARCH = "web.code.git.search" CODE_GIT_STATUS = "web.code.git.status" diff --git a/core/code/autogen.go b/core/code/autogen.go index fbac4815..0fa6e896 100644 --- a/core/code/autogen.go +++ b/core/code/autogen.go @@ -42,7 +42,7 @@ func _autogen_module(m *ice.Message, file string) { func _autogen_defs(m *ice.Message, arg ...string) { kit.For(arg, func(p string) { m.Cmd(nfs.DEFS, p, m.Cmdx(nfs.CAT, p)); ReposAddFile(m, "", p) }) } -func _autogen_import(m *ice.Message, main string, ctx string, mod string) { +func _autogen_import(m *ice.Message, main string, ctx string, mod string) string { m.Cmd(nfs.DEFS, ice.ETC_MISS_SH, m.Template("miss.sh")) _autogen_defs(m, ice.README_MD, ice.MAKEFILE, ice.LICENSE) _autogen_defs(m, ice.SRC_MAIN_GO, ice.ETC_MISS_SH, ice.README_MD, ice.MAKEFILE, ice.LICENSE) @@ -66,6 +66,7 @@ func _autogen_import(m *ice.Message, main string, ctx string, mod string) { m.Cmd(nfs.SAVE, main, kit.Join(list, lex.NL)) GoImports(m, main) ReposAddFile(m, "", main) + return path.Join(mod, "src", ctx) } func _autogen_version(m *ice.Message) string { if mod := _autogen_mod(m, ice.GO_MOD); !nfs.Exists(m, ".git") { @@ -191,6 +192,9 @@ func init() { nfs.Trash(m, ice.GO_WORK) } }}, + IMPORT: {Hand: func(m *ice.Message, arg ...string) { + _autogen_import(m, ice.SRC_MAIN_GO, arg[0], kit.Select(_autogen_mod(m, ice.GO_MOD), arg, 1)) + }}, BINPACK: {Help: "打包", Hand: func(m *ice.Message, arg ...string) { const ( USR_RELEASE_CONF_GO = "usr/release/conf.go" @@ -217,6 +221,6 @@ func isReleaseContexts(m *ice.Message) bool { func AutogenMod(m *ice.Message) string { return _autogen_mod(m, ice.GO_MOD) } -func AutogenImport(m *ice.Message, zone string) { - _autogen_import(m, ice.SRC_MAIN_GO, zone, _autogen_mod(m, ice.GO_MOD)) +func AutogenImport(m *ice.Message, zone string) string { + return _autogen_import(m, ice.SRC_MAIN_GO, zone, _autogen_mod(m, ice.GO_MOD)) } diff --git a/core/code/go.go b/core/code/go.go index 7a7a62f1..a13d0823 100644 --- a/core/code/go.go +++ b/core/code/go.go @@ -68,7 +68,18 @@ func _go_show(m *ice.Message, arg ...string) { ctx.ProcessField(m, cli.RUNTIME, kit.Simple()) } else if arg[1] == "binpack.go" { ctx.ProcessField(m, nfs.PACK, kit.Simple()) + } else if path.Base(arg[1]) == "model.go" { + ctx.ProcessField(m, "web.code.mysql.query", kit.Simple("mysql", kit.Split(arg[1], "/", "/")[0])) + } else if path.Base(arg[1]) == "common.go" { + // ctx.ProcessField(m, "web.code.xterm", kit.Simple()) + ctx.ProcessField(m, "log.debug", kit.Simple("bench")) } else if cmd := ctx.GetFileCmd(path.Join(arg[2], arg[1])); cmd != "" { + if p := path.Join(path.Dir(path.Join(arg[2], arg[1])), "portal.go"); path.Base(arg[1]) != "portal.go" && nfs.Exists(m, p) { + if cmd := ctx.GetFileCmd(p); cmd != "" { + ctx.ProcessField(m, cmd, kit.Simple()) + return + } + } ctx.ProcessField(m, cmd, kit.Simple()) } else if msg := m.Cmd(yac.STACK, path.Join(arg[2], arg[1])); msg.Option("__index") != "" { ctx.ProcessField(m, msg.Option("__index"), kit.Simple()) diff --git a/core/code/js.go b/core/code/js.go index 2f90123a..829aeb7f 100644 --- a/core/code/js.go +++ b/core/code/js.go @@ -22,6 +22,12 @@ func _js_show(m *ice.Message, arg ...string) { ctx.ProcessField(m, kit.Select(ice.CAN_PLUGIN, "web."+strings.Replace(strings.TrimSuffix(strings.TrimPrefix(arg[1], "plugin/local/"), nfs.PT+JS), nfs.PS, nfs.PT, -1)), nil) } } else { + if p := path.Join(path.Dir(path.Join(arg[2], arg[1])), "portal.go"); nfs.Exists(m, p) { + if cmd := ctx.GetFileCmd(p); cmd != "" { + ctx.ProcessField(m, cmd, kit.Simple()) + return + } + } ctx.DisplayBase(m, require(arg[2], arg[1])) ctx.ProcessField(m, kit.Select(ice.CAN_PLUGIN, ctx.GetFileCmd(kit.ExtChange(path.Join(arg[2], arg[1]), GO))), kit.Simple()) } diff --git a/core/code/json.go b/core/code/json.go index 250d7c23..3fe078e4 100644 --- a/core/code/json.go +++ b/core/code/json.go @@ -20,6 +20,12 @@ func init() { Index.MergeCommands(ice.Commands{ JSON: {Actions: ice.MergeActions(ice.Actions{ mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) { + if path.Base(arg[1]) == "portal.json" { + if cmd := ctx.GetFileCmd(path.Join(arg[2], arg[1])); cmd != "" { + ctx.ProcessField(m, cmd, kit.Simple("table")) + return + } + } m.FieldsSetDetail() kit.For(kit.KeyValue(nil, "", kit.UnMarshal(m.Cmdx(nfs.CAT, path.Join(arg[2], arg[1])))), func(key, value string) { m.Push(key, value) diff --git a/misc/git/repos.go b/misc/git/repos.go index 2cd37d7d..4abd9263 100644 --- a/misc/git/repos.go +++ b/misc/git/repos.go @@ -439,6 +439,9 @@ func init() { m.Cmd(nfs.DIR, nfs.USR_LOCAL_WORK, func(value ice.Maps) { _repos_insert(m, value[nfs.PATH]) }) m.ProcessRefresh().ToastSuccess() }}, + mdb.CREATE: {Hand: func(m *ice.Message, arg ...string) { + _repos_insert(m, arg[0]) + }}, INIT: {Name: "init remote*", Help: "初始化", Hand: func(m *ice.Message, arg ...string) { m.OptionDefault(nfs.PATH, kit.Path("")) m.Cmd(nfs.DEFS, path.Join(m.Option(nfs.PATH), ".git/config"), kit.Format(nfs.Template(m, CONFIG), m.Option(REMOTE)))