forked from x/icebergs
add some
This commit is contained in:
parent
ed39ff23e7
commit
2deff32468
@ -1,6 +1,7 @@
|
|||||||
package log
|
package log
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"unicode"
|
"unicode"
|
||||||
@ -32,6 +33,7 @@ func init() {
|
|||||||
cli.OpenCmds(m, kit.Format("cd %s", kit.Path("")), "tail -f var/log/bench.log")
|
cli.OpenCmds(m, kit.Format("cd %s", kit.Path("")), "tail -f var/log/bench.log")
|
||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, arg ...string) {
|
}, 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))
|
offset, limit := kit.Int(kit.Select("0", arg, 1)), kit.Int(kit.Select("100", arg, 2))
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case BENCH, ERROR, DEBUG:
|
case BENCH, ERROR, DEBUG:
|
||||||
@ -66,6 +68,10 @@ func init() {
|
|||||||
ls[6], ls[7] = ls[6]+lex.SP+_ls[0], _ls[1]
|
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])
|
m.Push(ctx.SHIP, ls[5]).Push(LEVEL, ls[6]).Push(nfs.CONTENT, ls[7])
|
||||||
})
|
})
|
||||||
case WATCH:
|
case WATCH:
|
||||||
|
@ -147,6 +147,8 @@ const (
|
|||||||
SCAN = "scan"
|
SCAN = "scan"
|
||||||
GOWORK = "gowork"
|
GOWORK = "gowork"
|
||||||
|
|
||||||
|
PORTAL_GO = "portal.go"
|
||||||
|
PORTAL_JSON = "portal.json"
|
||||||
ETC_LOCAL_SH = "etc/local.sh"
|
ETC_LOCAL_SH = "etc/local.sh"
|
||||||
ETC_CERT_KEY = "etc/cert/cert.key"
|
ETC_CERT_KEY = "etc/cert/cert.key"
|
||||||
ETC_CERT_PEM = "etc/cert/cert.pem"
|
ETC_CERT_PEM = "etc/cert/cert.pem"
|
||||||
@ -196,8 +198,8 @@ const (
|
|||||||
TYPE_BOTH = "both"
|
TYPE_BOTH = "both"
|
||||||
|
|
||||||
DIR_ROOT = "dir_root"
|
DIR_ROOT = "dir_root"
|
||||||
DIR_TYPE = "dir_type"
|
|
||||||
DIR_DEEP = "dir_deep"
|
DIR_DEEP = "dir_deep"
|
||||||
|
DIR_TYPE = "dir_type"
|
||||||
DIR_REG = "dir_reg"
|
DIR_REG = "dir_reg"
|
||||||
|
|
||||||
DIR_DEF_FIELDS = "time,path,size,action"
|
DIR_DEF_FIELDS = "time,path,size,action"
|
||||||
|
@ -121,7 +121,7 @@ func _dream_start(m *ice.Message, name string) {
|
|||||||
if !m.IsCliUA() {
|
if !m.IsCliUA() {
|
||||||
// defer m.ProcessOpenAndRefresh(m.MergePod(name))
|
// defer m.ProcessOpenAndRefresh(m.MergePod(name))
|
||||||
defer m.ProcessRefresh()
|
defer m.ProcessRefresh()
|
||||||
defer ToastProcess(m, mdb.CREATE, name)()
|
// defer ToastProcess(m, mdb.CREATE, name)()
|
||||||
}
|
}
|
||||||
defer mdb.Lock(m, m.PrefixKey(), cli.START, name)()
|
defer mdb.Lock(m, m.PrefixKey(), cli.START, name)()
|
||||||
p := _dream_check(m, name)
|
p := _dream_check(m, name)
|
||||||
|
@ -208,6 +208,7 @@ const (
|
|||||||
INSTALL = "install"
|
INSTALL = "install"
|
||||||
|
|
||||||
CODE_MYSQL_CLIENT = "web.code.mysql.client"
|
CODE_MYSQL_CLIENT = "web.code.mysql.client"
|
||||||
|
CODE_MYSQL_QUERY = "web.code.mysql.query"
|
||||||
CODE_GIT_SERVICE = "web.code.git.service"
|
CODE_GIT_SERVICE = "web.code.git.service"
|
||||||
CODE_GIT_SEARCH = "web.code.git.search"
|
CODE_GIT_SEARCH = "web.code.git.search"
|
||||||
CODE_GIT_STATUS = "web.code.git.status"
|
CODE_GIT_STATUS = "web.code.git.status"
|
||||||
|
@ -42,7 +42,7 @@ func _autogen_module(m *ice.Message, file string) {
|
|||||||
func _autogen_defs(m *ice.Message, arg ...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) })
|
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"))
|
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.README_MD, ice.MAKEFILE, ice.LICENSE)
|
||||||
_autogen_defs(m, ice.SRC_MAIN_GO, ice.ETC_MISS_SH, 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))
|
m.Cmd(nfs.SAVE, main, kit.Join(list, lex.NL))
|
||||||
GoImports(m, main)
|
GoImports(m, main)
|
||||||
ReposAddFile(m, "", main)
|
ReposAddFile(m, "", main)
|
||||||
|
return path.Join(mod, "src", ctx)
|
||||||
}
|
}
|
||||||
func _autogen_version(m *ice.Message) string {
|
func _autogen_version(m *ice.Message) string {
|
||||||
if mod := _autogen_mod(m, ice.GO_MOD); !nfs.Exists(m, ".git") {
|
if mod := _autogen_mod(m, ice.GO_MOD); !nfs.Exists(m, ".git") {
|
||||||
@ -191,6 +192,9 @@ func init() {
|
|||||||
nfs.Trash(m, ice.GO_WORK)
|
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) {
|
BINPACK: {Help: "打包", Hand: func(m *ice.Message, arg ...string) {
|
||||||
const (
|
const (
|
||||||
USR_RELEASE_CONF_GO = "usr/release/conf.go"
|
USR_RELEASE_CONF_GO = "usr/release/conf.go"
|
||||||
@ -217,6 +221,6 @@ func isReleaseContexts(m *ice.Message) bool {
|
|||||||
func AutogenMod(m *ice.Message) string {
|
func AutogenMod(m *ice.Message) string {
|
||||||
return _autogen_mod(m, ice.GO_MOD)
|
return _autogen_mod(m, ice.GO_MOD)
|
||||||
}
|
}
|
||||||
func AutogenImport(m *ice.Message, zone string) {
|
func AutogenImport(m *ice.Message, zone string) string {
|
||||||
_autogen_import(m, ice.SRC_MAIN_GO, zone, _autogen_mod(m, ice.GO_MOD))
|
return _autogen_import(m, ice.SRC_MAIN_GO, zone, _autogen_mod(m, ice.GO_MOD))
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,18 @@ func _go_show(m *ice.Message, arg ...string) {
|
|||||||
ctx.ProcessField(m, cli.RUNTIME, kit.Simple())
|
ctx.ProcessField(m, cli.RUNTIME, kit.Simple())
|
||||||
} else if arg[1] == "binpack.go" {
|
} else if arg[1] == "binpack.go" {
|
||||||
ctx.ProcessField(m, nfs.PACK, kit.Simple())
|
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 != "" {
|
} 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())
|
ctx.ProcessField(m, cmd, kit.Simple())
|
||||||
} else if msg := m.Cmd(yac.STACK, path.Join(arg[2], arg[1])); msg.Option("__index") != "" {
|
} else if msg := m.Cmd(yac.STACK, path.Join(arg[2], arg[1])); msg.Option("__index") != "" {
|
||||||
ctx.ProcessField(m, msg.Option("__index"), kit.Simple())
|
ctx.ProcessField(m, msg.Option("__index"), kit.Simple())
|
||||||
|
@ -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)
|
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 {
|
} 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.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())
|
ctx.ProcessField(m, kit.Select(ice.CAN_PLUGIN, ctx.GetFileCmd(kit.ExtChange(path.Join(arg[2], arg[1]), GO))), kit.Simple())
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,12 @@ func init() {
|
|||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
JSON: {Actions: ice.MergeActions(ice.Actions{
|
JSON: {Actions: ice.MergeActions(ice.Actions{
|
||||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
|
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()
|
m.FieldsSetDetail()
|
||||||
kit.For(kit.KeyValue(nil, "", kit.UnMarshal(m.Cmdx(nfs.CAT, path.Join(arg[2], arg[1])))), func(key, value string) {
|
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)
|
m.Push(key, value)
|
||||||
|
@ -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.Cmd(nfs.DIR, nfs.USR_LOCAL_WORK, func(value ice.Maps) { _repos_insert(m, value[nfs.PATH]) })
|
||||||
m.ProcessRefresh().ToastSuccess()
|
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) {
|
INIT: {Name: "init remote*", Help: "初始化", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.OptionDefault(nfs.PATH, kit.Path(""))
|
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)))
|
m.Cmd(nfs.DEFS, path.Join(m.Option(nfs.PATH), ".git/config"), kit.Format(nfs.Template(m, CONFIG), m.Option(REMOTE)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user