diff --git a/base/mdb/mdb.go b/base/mdb/mdb.go index 5a184772..7408764f 100644 --- a/base/mdb/mdb.go +++ b/base/mdb/mdb.go @@ -147,27 +147,13 @@ var Index = &ice.Context{Name: MDB, Help: "数据模块", Commands: ice.Commands ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {}}, ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {}}, INPUTS: {Name: "inputs key sub type field value", Hand: func(m *ice.Message, arg ...string) { - switch arg[3] { - case "space": - m.Cmd("space", func(value ice.Maps) { - kit.If(kit.IsIn(value[TYPE], "worker", "server"), func() { m.Push(arg[3], value[NAME]) }) - }) - case "index": - if space := m.Option("space"); space != "" { - m.Options("space", []string{}).Cmdy("space", space, INPUTS, arg) - } else { - m.Cmdy("command") - } - case "args": - m.Cmdy("command", INPUTS, m.Option("index")) - case ICON: - m.Cmdy("nfs.dir", "usr/icons/", "path") - default: - kit.Switch(arg[2], - HASH, func() { _hash_inputs(m, arg[0], arg[1], kit.Select(NAME, arg, 3), kit.Select("", arg, 4)) }, - ZONE, func() { _zone_inputs(m, arg[0], arg[1], arg[3], kit.Select(NAME, arg, 4), kit.Select("", arg, 5)) }, - LIST, func() { _list_inputs(m, arg[0], arg[1], kit.Select(NAME, arg, 3), kit.Select("", arg, 4)) }, - ) + kit.Switch(arg[2], + HASH, func() { _hash_inputs(m, arg[0], arg[1], kit.Select(NAME, arg, 3), kit.Select("", arg, 4)) }, + ZONE, func() { _zone_inputs(m, arg[0], arg[1], arg[3], kit.Select(NAME, arg, 4), kit.Select("", arg, 5)) }, + LIST, func() { _list_inputs(m, arg[0], arg[1], kit.Select(NAME, arg, 3), kit.Select("", arg, 4)) }, + ) + for _, inputs := range ice.Info.Inputs { + inputs(m, arg[3]) } }}, INSERT: {Name: "insert key sub type arg...", Hand: func(m *ice.Message, arg ...string) { diff --git a/base/web/space.go b/base/web/space.go index ddf20bd2..bc87c6d9 100644 --- a/base/web/space.go +++ b/base/web/space.go @@ -175,6 +175,28 @@ const ( const SPACE = "space" func init() { + ice.Info.Inputs = append(ice.Info.Inputs, func(m *ice.Message, arg ...string) { + switch arg[0] { + case SPACE: + m.Cmd(SPACE, func(value ice.Maps) { + kit.If(kit.IsIn(value[mdb.TYPE], WORKER, SERVER), func() { m.Push(arg[0], value[mdb.NAME]) }) + }) + case mdb.ICON: + m.Cmdy(nfs.DIR, "usr/icons/", nfs.PATH) + case ctx.INDEX: + if space := m.Option(SPACE); space != "" { + m.Options(SPACE, []string{}).Cmdy(SPACE, space, mdb.INPUTS, arg) + } else { + m.Cmdy(ctx.COMMAND) + } + case ctx.ARGS: + if space := m.Option(SPACE); space != "" { + m.Options(SPACE, []string{}).Cmdy(SPACE, space, ctx.COMMAND, mdb.INPUTS, m.Option(ctx.INDEX)) + } else { + m.Cmdy(ctx.COMMAND, mdb.INPUTS, m.Option(ctx.INDEX)) + } + } + }) Index.MergeCommands(ice.Commands{ SPACE: {Name: "space name cmds auto", Help: "空间站", Actions: ice.MergeActions(ice.Actions{ ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { aaa.White(m, SPACE, ice.MAIN) }}, diff --git a/core/chat/icons.go b/core/chat/icons.go new file mode 100644 index 00000000..73f6b242 --- /dev/null +++ b/core/chat/icons.go @@ -0,0 +1,26 @@ +package chat + +import ( + "strings" + + ice "shylinux.com/x/icebergs" + "shylinux.com/x/icebergs/base/lex" + kit "shylinux.com/x/toolkits" +) + +func init() { + const ICONS = "icons" + Index.MergeCommands(ice.Commands{ + ICONS: {Hand: func(m *ice.Message, arg ...string) { + m.Option(lex.SPLIT_SPACE, " {:;}") + m.Cmd(lex.SPLIT, "usr/node_modules/bootstrap-icons/font/bootstrap-icons.css", func(text string, ls []string) { + if len(ls) > 2 && ls[2] == "content" { + name := "bi " + strings.TrimPrefix(ls[0], ".") + m.Push("name", name) + m.Push("icon", kit.Format(``, name)) + } + }) + m.StatusTimeCount() + }}, + }) +} diff --git a/core/chat/macos/desktop.go b/core/chat/macos/desktop.go index 3a6d79e0..f80b0274 100644 --- a/core/chat/macos/desktop.go +++ b/core/chat/macos/desktop.go @@ -20,7 +20,6 @@ func init() { DeskAppend(m, "usr/icons/Photos.png", web.WIKI_FEEL) DeskAppend(m, "usr/icons/Grapher.png", web.WIKI_DRAW) DeskAppend(m, "usr/icons/Calendar.png", web.TEAM_PLAN) - DeskAppend(m, "usr/icons/flows.png", web.CHAT_FLOWS) } }}, ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { mdb.HashExport(m) }}, diff --git a/core/chat/river.go b/core/chat/river.go index e6080a73..186d09f8 100644 --- a/core/chat/river.go +++ b/core/chat/river.go @@ -3,7 +3,6 @@ package chat import ( ice "shylinux.com/x/icebergs" "shylinux.com/x/icebergs/base/aaa" - "shylinux.com/x/icebergs/base/ctx" "shylinux.com/x/icebergs/base/gdb" "shylinux.com/x/icebergs/base/mdb" "shylinux.com/x/icebergs/base/nfs" @@ -48,12 +47,6 @@ func init() { switch arg[0] { case nfs.TEMPLATE: m.Cmdy(TEMPLATE).CutTo(RIVER, arg[0]) - case web.SPACE: - m.Cmdy(web.SPACE).CutTo(mdb.NAME, arg[0]) - case ctx.INDEX: - m.Cmdy(web.Space(m, m.Option(web.SPACE)), ctx.COMMAND) - case ctx.ARGS: - m.Cmdy(web.Space(m, m.Option(web.SPACE)), ctx.COMMAND, mdb.INPUTS, m.Option(ctx.INDEX)) default: mdb.HashInputs(m, arg) } diff --git a/info.go b/info.go index 70e1316e..af2065a5 100644 --- a/info.go +++ b/info.go @@ -74,6 +74,7 @@ var Info = struct { OpenFile func(m *Message, p string) (io.ReadCloser, error) PushStream func(m *Message) PushNotice func(m *Message, arg ...Any) + Inputs []func(m *Message, arg ...string) Load func(m *Message, key ...string) *Message Save func(m *Message, key ...string) *Message Log func(m *Message, p, l, s string) diff --git a/type.go b/type.go index f7e5f18a..2d08f70d 100644 --- a/type.go +++ b/type.go @@ -174,6 +174,7 @@ func (c *Context) Merge(s *Context) *Context { kit.If(action.List == nil, func() { action.List = SplitCmd(action.Name, nil) }) kit.If(len(action.List) > 0, func() { cmd.Meta[sub] = action.List }) } + kit.If(cmd.Name == "", func() { cmd.Name = "list path auto" }) kit.If(strings.HasPrefix(cmd.Name, "list"), func() { cmd.Name = strings.Replace(cmd.Name, "list", key, 1) }) kit.If(cmd.List == nil, func() { cmd.List = SplitCmd(cmd.Name, cmd.Actions) }) }