forked from x/icebergs
28 lines
994 B
Go
28 lines
994 B
Go
package code
|
|
|
|
import (
|
|
ice "shylinux.com/x/icebergs"
|
|
"shylinux.com/x/icebergs/base/mdb"
|
|
kit "shylinux.com/x/toolkits"
|
|
)
|
|
|
|
const FAVOR = "favor"
|
|
|
|
func init() {
|
|
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
|
FAVOR: {Name: FAVOR, Help: "收藏夹", Value: kit.Data(
|
|
kit.MDB_SHORT, kit.MDB_ZONE, kit.MDB_FIELD, "time,id,type,name,text,path,file,line",
|
|
)},
|
|
}, Commands: map[string]*ice.Command{
|
|
FAVOR: {Name: "favor zone id auto insert", Help: "收藏夹", Action: ice.MergeAction(map[string]*ice.Action{
|
|
mdb.INSERT: {Name: "insert zone=数据结构 type=go name=hi text=hello path file line", Help: "添加"},
|
|
INNER: {Name: "inner", Help: "源码", Hand: func(m *ice.Message, arg ...string) {
|
|
m.ProcessCommand(INNER, m.OptionSplit("path,file,line"), arg...)
|
|
}},
|
|
}, mdb.ZoneAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
|
mdb.ZoneSelect(m, arg...)
|
|
m.PushAction(kit.Select(mdb.REMOVE, INNER, len(arg) > 0))
|
|
}},
|
|
}})
|
|
}
|