mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 01:24:05 +08:00
33 lines
1.1 KiB
Go
33 lines
1.1 KiB
Go
package mdb
|
|
|
|
import (
|
|
ice "shylinux.com/x/icebergs"
|
|
kit "shylinux.com/x/toolkits"
|
|
)
|
|
|
|
const ENGINE = "engine"
|
|
|
|
func init() {
|
|
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
|
ENGINE: {Name: ENGINE, Help: "引擎", Value: kit.Data(SHORT, TYPE, FIELD, "time,type,name,text")},
|
|
}, Commands: map[string]*ice.Command{
|
|
ENGINE: {Name: "engine type name text auto", Help: "引擎", Action: ice.MergeAction(map[string]*ice.Action{
|
|
CREATE: {Name: "create type name text", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
|
m.Option(NAME, kit.Select(m.Option(TYPE), m.Option(NAME)))
|
|
m.Option(TYPE, kit.Ext(m.Option(TYPE)))
|
|
m.Cmdy(INSERT, m.PrefixKey(), "", HASH, m.OptionSimple("type,name,text"))
|
|
}},
|
|
}, HashAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
|
if len(arg) > 1 {
|
|
m.Cmdy(SELECT, m.PrefixKey(), "", HASH, m.Config(SHORT), arg, func(value map[string]interface{}) {
|
|
m.Cmdy(kit.Keys(value[TEXT], value[NAME]), m.CommandKey(), arg[0], arg[1], kit.Select("", arg, 2), kit.Slice(arg, 3))
|
|
})
|
|
return
|
|
}
|
|
if HashSelect(m, arg...); len(arg) == 0 {
|
|
m.Sort(TYPE)
|
|
}
|
|
}},
|
|
}})
|
|
}
|