1
0
forked from x/icebergs

opt onappend

This commit is contained in:
harveyshao 2023-01-17 23:28:31 +08:00
parent 805fe37ec8
commit 0cd92ae347
6 changed files with 13 additions and 15 deletions

View File

@ -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"

14
conf.go
View File

@ -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/"

View File

@ -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 {

View File

@ -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:

View File

@ -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
}
}

View File

@ -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])))