From 0cd92ae347b4dec4898755e6e3bb3a5678c53818 Mon Sep 17 00:00:00 2001 From: harveyshao Date: Tue, 17 Jan 2023 23:28:31 +0800 Subject: [PATCH] opt onappend --- base/ctx/command.go | 6 ++---- conf.go | 14 +++++++------- core/chat/cmd.go | 2 +- core/chat/website.go | 2 +- core/code/css.go | 2 +- core/code/js.go | 2 +- 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/base/ctx/command.go b/base/ctx/command.go index 1fe119e7..e50ed396 100644 --- a/base/ctx/command.go +++ b/base/ctx/command.go @@ -27,7 +27,7 @@ func _command_list(m *ice.Message, name string) *ice.Message { name = GetFileCmd(name) case nfs.JS: m.Push(DISPLAY, FileURI(name)) - name = kit.Select(CAN_PLUGIN, GetFileCmd(name)) + name = kit.Select(ice.CAN_PLUGIN, GetFileCmd(name)) default: if msg := m.Cmd(mdb.RENDER, kit.Ext(name)); msg.Length() > 0 { m.Push(ARGS, kit.Format(kit.List(name))) @@ -36,7 +36,7 @@ func _command_list(m *ice.Message, name string) *ice.Message { } } if strings.HasPrefix(name, "can.") { - return m.Push(mdb.INDEX, name) + return m.Push(mdb.INDEX, name).Push(mdb.NAME, name).Push(mdb.HELP, "").Push(mdb.META, "").Push(mdb.LIST, "") } m.Spawn(m.Source()).Search(name, func(p *ice.Context, s *ice.Context, key string, cmd *ice.Command) { m.Push(mdb.INDEX, kit.Keys(s.Cap(ice.CTX_FOLLOW), key)) @@ -70,8 +70,6 @@ const ( DISPLAY = "display" ACTION = "action" TRANS = "trans" - - CAN_PLUGIN = "can.plugin" ) const COMMAND = "command" diff --git a/conf.go b/conf.go index e75b5fdf..08ec450f 100644 --- a/conf.go +++ b/conf.go @@ -85,19 +85,19 @@ const ( // DIR PLUGIN = "plugin" STORY = "story" - PAGE_FAVICON_ICO = "page/favicon.ico" - INDEX_CSS = "index.css" PROTO_JS = "proto.js" FRAME_JS = "frame.js" INDEX_JS = "index.js" INDEX_SH = "index.sh" - PLUGIN_INPUT = "/plugin/input/" - PLUGIN_STORY = "/plugin/story/" - PLUGIN_LOCAL = "/plugin/local/" - NODE_MODULES = "node_modules/" - ISH_PLUGED = ".ish/pluged/" + PAGE_FAVICON_ICO = "page/favicon.ico" + PLUGIN_INPUT = "/plugin/input/" + PLUGIN_STORY = "/plugin/story/" + PLUGIN_LOCAL = "/plugin/local/" + NODE_MODULES = "node_modules/" + ISH_PLUGED = ".ish/pluged/" + CAN_PLUGIN = "can._plugin" USR_VOLCANOS = "usr/volcanos/" USR_LEARNING = "usr/learning/" diff --git a/core/chat/cmd.go b/core/chat/cmd.go index 54933f99..4bb72e4e 100644 --- a/core/chat/cmd.go +++ b/core/chat/cmd.go @@ -25,7 +25,7 @@ func _cmd_file(m *ice.Message, arg ...string) bool { web.RenderCmd(m, ctx.GetFileCmd(p)) case nfs.JS: ctx.DisplayBase(m, ctx.FileURI(p)) - web.RenderCmd(m, kit.Select(ctx.CAN_PLUGIN, ctx.GetFileCmd(p))) + web.RenderCmd(m, kit.Select(ice.CAN_PLUGIN, ctx.GetFileCmd(p))) default: if p = strings.TrimPrefix(p, ice.SRC+ice.PS); nfs.ExistsFile(m, path.Join(ice.SRC, p)) { if msg := m.Cmd(mdb.ENGINE, kit.Ext(p)); msg.Length() > 0 { diff --git a/core/chat/website.go b/core/chat/website.go index 09934799..e0350a7f 100644 --- a/core/chat/website.go +++ b/core/chat/website.go @@ -55,7 +55,7 @@ func _website_parse(m *ice.Message, text string, args ...string) (ice.Map, bool) data := kit.Dict() switch kit.Ext(ls[0]) { case nfs.JS: - ls[0], data[ctx.DISPLAY] = kit.Select(ctx.CAN_PLUGIN, ctx.GetFileCmd(ls[0])), ctx.FileURI(ls[0]) + ls[0], data[ctx.DISPLAY] = kit.Select(ice.CAN_PLUGIN, ctx.GetFileCmd(ls[0])), ctx.FileURI(ls[0]) case nfs.GO: ls[0] = ctx.GetFileCmd(ls[0]) case nfs.SHY: diff --git a/core/code/css.go b/core/code/css.go index f631b929..7c063f06 100644 --- a/core/code/css.go +++ b/core/code/css.go @@ -59,7 +59,7 @@ func _css_show(m *ice.Message, arg ...string) { func _css_exec(m *ice.Message, arg ...string) { if arg[2] == ice.USR_VOLCANOS && strings.HasPrefix(arg[1], ice.PLUGIN_LOCAL) { key := ctx.GetFileCmd("/require/shylinux.com/x/icebergs/core/" + strings.TrimPrefix(arg[1], ice.PLUGIN_LOCAL)) - ctx.ProcessCommand(m, kit.Select("can.plugin", key), kit.Simple()) + ctx.ProcessCommand(m, kit.Select(ice.CAN_PLUGIN, key), kit.Simple()) return } } diff --git a/core/code/js.go b/core/code/js.go index 457449a8..415ba510 100644 --- a/core/code/js.go +++ b/core/code/js.go @@ -76,7 +76,7 @@ func _js_show(m *ice.Message, arg ...string) { func _js_exec(m *ice.Message, arg ...string) { if arg[2] == "usr/volcanos/" && strings.HasPrefix(arg[1], "plugin/local/") { key := "web." + strings.Replace(strings.TrimSuffix(strings.TrimPrefix(arg[1], "plugin/local/"), ".js"), ice.PS, ice.PT, -1) - ctx.ProcessCommand(m, kit.Select("can.plugin", key), kit.Simple()) + ctx.ProcessCommand(m, kit.Select(ice.CAN_PLUGIN, key), kit.Simple()) return } ctx.DisplayBase(m, path.Join("/require", path.Join(arg[2], arg[1])))