1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 01:24:05 +08:00

opt golang

This commit is contained in:
shaoying 2021-08-12 08:47:05 +08:00
parent f18691ea29
commit cd3d57a6f7
4 changed files with 10 additions and 2 deletions

View File

@ -19,7 +19,7 @@ func _cache_save(m *ice.Message, kind, name, text string, arg ...string) { // fi
if name == "" {
return
}
if len(text) > 512 { // 存入文件
if len(text) > 512 || kind == "go" { // 存入文件
p := m.Cmdx(nfs.SAVE, _cache_name(m, kit.Hashs(text)), text)
text, arg = p, kit.Simple(p, len(text))
}

View File

@ -200,7 +200,7 @@ func init() {
"string", "byte", "bool", "error", "chan", "map",
),
FUNCTION, kit.Simple(
"len", "cap", "copy", "append", "msg", "m",
"new", "make", "len", "cap", "copy", "append", "delete", "msg", "m",
),
CONSTANT, kit.Simple(
"false", "true", "nil", "-1", "0", "1", "2",

View File

@ -316,6 +316,13 @@ func (c *Context) cmd(m *Message, cmd *Command, key string, arg ...string) *Mess
return m
}
func (c *Context) _cmd(m *Message, cmd *Command, key string, k string, h *Action, arg ...string) *Message {
if k == "command" && h.Hand == nil {
for _, cmd := range arg {
m.Cmdy("command", cmd)
}
return m
}
if k == "run" && m.Warn(!m.Right(arg), ErrNotRight, arg) {
return m
}

View File

@ -50,6 +50,7 @@ func init() {
},
Commands: map[string]*ice.Command{
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
m.Conf(REPOS, kit.MDB_HASH, "")
_repos_insert(m, path.Base(kit.Pwd()), kit.Pwd())
m.Cmd(nfs.DIR, kit.SSH_USR, "name,path").Table(func(index int, value map[string]string, head []string) {
_repos_insert(m, value[kit.MDB_NAME], value[kit.MDB_PATH])