1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-29 02:29:22 +08:00

opt chrome

This commit is contained in:
IT 老营长 @云轩领航-创始人 2021-11-08 08:29:46 +08:00
parent 9022f20d5d
commit 272255aecc
12 changed files with 136 additions and 152 deletions

View File

@ -169,7 +169,11 @@ func ListAction(fields ...string) map[string]*ice.Action {
}, fields...) }, fields...)
} }
func ListSelect(m *ice.Message, arg ...string) *ice.Message { func ListSelect(m *ice.Message, arg ...string) *ice.Message {
m.Fields(len(arg), m.Config(kit.MDB_FIELD)) m.OptionPage(kit.Slice(arg, 1)...)
m.Fields(len(kit.Slice(arg, 0, 1)), m.Config(kit.MDB_FIELD))
m.Cmdy(SELECT, m.PrefixKey(), "", LIST, kit.MDB_ID, arg) m.Cmdy(SELECT, m.PrefixKey(), "", LIST, kit.MDB_ID, arg)
if !m.FieldsIsDetail() {
m.StatusTimeCountTotal(m.Config(kit.MDB_COUNT))
}
return m return m
} }

View File

@ -186,8 +186,8 @@ func ZoneAction(fields ...string) map[string]*ice.Action {
} }
func ZoneSelect(m *ice.Message, arg ...string) *ice.Message { func ZoneSelect(m *ice.Message, arg ...string) *ice.Message {
m.Fields(len(arg), kit.Fields(kit.MDB_TIME, m.Config(kit.MDB_SHORT), kit.MDB_COUNT), m.Config(kit.MDB_FIELD)) m.Fields(len(arg), kit.Fields(kit.MDB_TIME, m.Config(kit.MDB_SHORT), kit.MDB_COUNT), m.Config(kit.MDB_FIELD))
m.Debug(m.Config(kit.MDB_FIELD)) if m.Cmdy(SELECT, m.PrefixKey(), "", ZONE, arg); kit.Select("", arg, 0) == "" {
m.Cmdy(SELECT, m.PrefixKey(), "", ZONE, arg) m.Sort(m.Config(kit.MDB_SHORT))
m.Sort(m.Config(kit.MDB_SHORT)) }
return m return m
} }

View File

@ -175,9 +175,9 @@ func (m *Message) cmd(arg ...interface{}) *Message {
} }
// 查找命令 // 查找命令
if cmd, ok := m.target.Commands[list[0]]; ok { if cmd, ok := m.target.Commands[strings.TrimPrefix(list[0], m.target.Cap(CTX_FOLLOW)+PT)]; ok {
run(m.Spawn(), m.target, cmd, list[0], list[1:]...) run(m.Spawn(), m.target, cmd, list[0], list[1:]...)
} else if cmd, ok := m.source.Commands[list[0]]; ok { } else if cmd, ok := m.source.Commands[strings.TrimPrefix(list[0], m.source.Cap(CTX_FOLLOW)+PT)]; ok {
run(m.Spawn(m.source), m.source, cmd, list[0], list[1:]...) run(m.Spawn(m.source), m.source, cmd, list[0], list[1:]...)
} else { } else {
m.Search(list[0], func(p *Context, s *Context, key string, cmd *Command) { m.Search(list[0], func(p *Context, s *Context, key string, cmd *Command) {

View File

@ -3,6 +3,7 @@ package chrome
import ( import (
ice "shylinux.com/x/icebergs" ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/cli" "shylinux.com/x/icebergs/base/cli"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/web" "shylinux.com/x/icebergs/base/web"
"shylinux.com/x/icebergs/core/code" "shylinux.com/x/icebergs/core/code"
kit "shylinux.com/x/toolkits" kit "shylinux.com/x/toolkits"
@ -10,25 +11,23 @@ import (
const CHROME = "chrome" const CHROME = "chrome"
var Index = &ice.Context{Name: CHROME, Help: "浏览器", var Index = &ice.Context{Name: CHROME, Help: "浏览器", Configs: map[string]*ice.Config{
Configs: map[string]*ice.Config{ CHROME: {Name: CHROME, Help: "浏览器", Value: kit.Data()},
CHROME: {Name: CHROME, Help: "浏览器", Value: kit.Data()}, }, Commands: map[string]*ice.Command{
}, CHROME: {Name: "chrome wid tid url auto start build download", Help: "浏览器", Action: ice.MergeAction(map[string]*ice.Action{
Commands: map[string]*ice.Command{ mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Load() }}, m.Cmd(CHROME).Table(func(index int, value map[string]string, head []string) {
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Save() }}, m.Cmd(CHROME, value["wid"]).Table(func(index int, value map[string]string, head []string) {
m.Push(kit.MDB_ZONE, kit.ParseURL(value["url"]).Host)
CHROME: {Name: "chrome wid tid url auto start build download", Help: "浏览器", Action: map[string]*ice.Action{ })
web.DOWNLOAD: {Name: "download", Help: "下载", Hand: func(m *ice.Message, arg ...string) { })
}},
cli.BUILD: {Name: "build", Help: "构建", Hand: func(m *ice.Message, arg ...string) {
}},
cli.START: {Name: "start", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
m.Cmdy(web.SPACE, CHROME, CHROME, arg)
}}, }},
}, cli.ORDER: {Name: "order", Help: "加载", Hand: func(m *ice.Message, arg ...string) {
} m.Cmdy(code.INSTALL, cli.ORDER, m.Config(cli.SOURCE), "_install/bin")
}},
}, code.InstallAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
m.Cmdy(web.SPACE, CHROME, CHROME, arg)
}},
}}
func init() { code.Index.Register(Index, &web.Frame{}) } func init() { code.Index.Register(Index, &web.Frame{}) }

View File

@ -1,17 +1,19 @@
title "HTML5" title "HTML5"
refer "官网" ` refer `
官网 https://www.w3.org/ 官网 https://www.w3.org/
文档 https://developer.mozilla.org/ 文档 https://developer.mozilla.org/
官网 https://www.google.com/chrome/
源码 https://github.com/chromium/chromium/ 源码 https://github.com/chromium/chromium/
扩展 https://chrome.google.com/webstore/category/extensions
` `
chapter "安装" chapter "安装"
field chrome web.code.chrome.chrome field "浏览器" web.code.chrome.chrome
chapter "应用" chapter "应用"
field "同步流" web.code.chrome.sync field "同步流" web.code.chrome.sync
field "收藏夹" web.code.chrome.favor field "收藏夹" web.code.chrome.favor
field "工具箱" web.code.chrome.field
field "样式表" web.code.chrome.style field "样式表" web.code.chrome.style
field "工具箱" web.code.chrome.field
field "蜘蛛侠" web.code.chrome.spide field "蜘蛛侠" web.code.chrome.spide
field "缓存池" web.code.chrome.cache field "缓存池" web.code.chrome.cache
field "相册簿" web.wiki.feel field "相册簿" web.wiki.feel

View File

@ -10,52 +10,20 @@ import (
const FAVOR = "favor" const FAVOR = "favor"
func init() { func init() {
Index.Merge(&ice.Context{ Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
Configs: map[string]*ice.Config{ FAVOR: {Name: FAVOR, Help: "收藏夹", Value: kit.Data(
FAVOR: {Name: FAVOR, Help: "收藏夹", Value: kit.Data( kit.MDB_SHORT, kit.MDB_ZONE, kit.MDB_FIELD, "time,id,type,name,text",
kit.MDB_SHORT, kit.MDB_ZONE, kit.MDB_FIELD, "time,id,type,name,text", )},
)}, }, Commands: map[string]*ice.Command{
}, FAVOR: {Name: "favor zone id auto", Help: "收藏夹", Action: ice.MergeAction(map[string]*ice.Action{
Commands: map[string]*ice.Command{ mdb.INSERT: {Name: "insert zone=官网文档 type name=hi text=hello", Help: "添加"},
FAVOR: {Name: "favor zone id auto export import", Help: "收藏夹", Action: map[string]*ice.Action{ }, mdb.ZoneAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
mdb.CREATE: {Name: "create zone", Help: "创建", Hand: func(m *ice.Message, arg ...string) { if mdb.ZoneSelect(m, arg...); len(arg) == 0 {
m.Cmdy(mdb.INSERT, m.Prefix(FAVOR), "", mdb.HASH, arg) m.Action(mdb.CREATE, mdb.EXPORT, mdb.IMPORT)
}}, m.PushAction(mdb.REMOVE)
mdb.INSERT: {Name: "insert zone=数据结构 type name=hi text=hello", Help: "添加", Hand: func(m *ice.Message, arg ...string) { } else {
m.Cmdy(mdb.INSERT, m.Prefix(FAVOR), "", mdb.HASH, m.OptionSimple(kit.MDB_ZONE)) m.PushAction(code.INNER)
m.Cmdy(mdb.INSERT, m.Prefix(FAVOR), kit.KeyHash(m.Option(kit.MDB_ZONE)), mdb.LIST, arg) }
}}, }},
mdb.MODIFY: {Name: "modify", Help: "编辑", Hand: func(m *ice.Message, arg ...string) { }})
m.Cmdy(mdb.MODIFY, m.Prefix(FAVOR), "", mdb.ZONE, m.Option(kit.MDB_ZONE), m.Option(kit.MDB_ID), arg)
}},
mdb.REMOVE: {Name: "remove", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(mdb.DELETE, m.Prefix(FAVOR), "", mdb.ZONE, m.OptionSimple(kit.MDB_ZONE))
}},
mdb.EXPORT: {Name: "export", Help: "导出", Hand: func(m *ice.Message, arg ...string) {
m.OptionFields(kit.MDB_ZONE, m.Conf(FAVOR, kit.META_FIELD))
m.Cmdy(mdb.EXPORT, m.Prefix(FAVOR), "", mdb.ZONE)
m.Conf(FAVOR, kit.MDB_HASH, "")
}},
mdb.IMPORT: {Name: "import", Help: "导入", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(mdb.IMPORT, m.Prefix(FAVOR), "", mdb.ZONE)
}},
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
switch arg[0] {
case kit.MDB_ZONE:
m.Cmdy(mdb.INPUTS, m.Prefix(FAVOR), "", mdb.HASH, arg)
default:
m.Cmdy(mdb.INPUTS, m.Prefix(FAVOR), kit.KeyHash(m.Option(kit.MDB_ZONE)), mdb.LIST, arg)
}
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
m.Fields(len(arg), "time,zone,count", m.Conf(FAVOR, kit.META_FIELD))
if m.Cmdy(mdb.SELECT, m.Prefix(FAVOR), "", mdb.ZONE, arg); len(arg) == 0 {
m.Action(mdb.CREATE)
m.PushAction(mdb.REMOVE)
} else {
m.PushAction(code.INNER)
}
}},
},
})
} }

View File

@ -2,7 +2,9 @@ package chrome
import ( import (
ice "shylinux.com/x/icebergs" ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/mdb" "shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/tcp"
"shylinux.com/x/icebergs/base/web" "shylinux.com/x/icebergs/base/web"
kit "shylinux.com/x/toolkits" kit "shylinux.com/x/toolkits"
) )
@ -12,18 +14,35 @@ const FIELD = "field"
func init() { func init() {
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{ Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
FIELD: {Name: "field", Help: "工具", Value: kit.Data( FIELD: {Name: "field", Help: "工具", Value: kit.Data(
kit.MDB_SHORT, "zone", kit.MDB_FIELD, "time,id,index,args,style,left,top,selection", kit.MDB_SHORT, kit.MDB_ZONE, kit.MDB_FIELD, "time,id,index,args,style,left,top,right,bottom,selection",
)}, )},
}, Commands: map[string]*ice.Command{ }, Commands: map[string]*ice.Command{
FIELD: {Name: "field zone id auto insert", Help: "工具", Action: ice.MergeAction(map[string]*ice.Action{ FIELD: {Name: "field zone id auto insert", Help: "工具", Action: ice.MergeAction(map[string]*ice.Action{
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
switch arg[0] {
case kit.MDB_ZONE:
m.Cmdy(CHROME, mdb.INPUTS)
case kit.MDB_INDEX:
m.Cmdy(ctx.COMMAND)
}
}},
mdb.INSERT: {Name: "insert zone=golang.google.cn index=cli.system args=pwd", Help: "添加"}, mdb.INSERT: {Name: "insert zone=golang.google.cn index=cli.system args=pwd", Help: "添加"},
SYNC: {Name: "sync hostname", Help: "同步", Hand: func(m *ice.Message, arg ...string) { ctx.COMMAND: {Name: "command", Help: "命令", Hand: func(m *ice.Message, arg ...string) {
m.Cmd(FIELD, m.Option("hostname")).Table(func(index int, value map[string]string, head []string) { m.Cmd(FIELD, m.Option(tcp.HOST), arg).Table(func(index int, value map[string]string, head []string) {
m.Option(ice.MSG_OPTS, head) if len(arg) == 0 { // 命令列表
for k, v := range value { m.Option(ice.MSG_OPTS, head)
m.Option(k, v) for k, v := range value {
m.Option(k, v)
}
m.Cmdy(web.SPACE, CHROME, CHROME, "1", m.Option("tid"), FIELD, value[kit.MDB_ID], value[kit.MDB_ARGS])
} else { // 命令详情
m.Cmdy(ctx.COMMAND, value[kit.MDB_INDEX])
} }
m.Cmd(web.SPACE, CHROME, CHROME, "1", m.Option("tid"), FIELD, value["index"], value["args"], value["top"]) })
}},
ice.RUN: {Name: "run", Help: "执行", Hand: func(m *ice.Message, arg ...string) {
m.Cmd(FIELD, m.Option(tcp.HOST), arg[0]).Table(func(index int, value map[string]string, head []string) {
m.Cmdy(value[kit.MDB_INDEX], arg[1:])
}) })
}}, }},
}, mdb.ZoneAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { }, mdb.ZoneAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {

View File

@ -14,21 +14,12 @@ func init() {
}, Commands: map[string]*ice.Command{ }, Commands: map[string]*ice.Command{
"/page": {Name: "/page", Help: "网页", Action: map[string]*ice.Action{ "/page": {Name: "/page", Help: "网页", Action: map[string]*ice.Action{
ctx.COMMAND: {Name: "command", Help: "命令", Hand: func(m *ice.Message, arg ...string) { ctx.COMMAND: {Name: "command", Help: "命令", Hand: func(m *ice.Message, arg ...string) {
if len(arg) == 0 { m.Cmdy(STYLE, ctx.ACTION, ctx.COMMAND, arg)
m.Cmdy(STYLE, SYNC, m.OptionSimple("hostname"), ice.OptionFields("")) m.Cmdy(FIELD, ctx.ACTION, ctx.COMMAND, arg)
m.Cmdy(FIELD, SYNC, m.OptionSimple("hostname"), ice.OptionFields(""))
return
}
m.Cmdy(ctx.COMMAND, arg)
}},
FIELD: {Name: "field", Help: "执行", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(FIELD, arg)
}}, }},
ice.RUN: {Name: "run", Help: "执行", Hand: func(m *ice.Message, arg ...string) { ice.RUN: {Name: "run", Help: "执行", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(arg) m.Cmdy(FIELD, ice.RUN, arg)
}}, }},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
}}, }},
}}) }})
} }

View File

@ -10,39 +10,37 @@ import (
const SPIDE = "spide" const SPIDE = "spide"
func init() { func init() {
Index.Merge(&ice.Context{ Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
Commands: map[string]*ice.Command{ SPIDE: {Name: "spide wid tid cmd auto", Help: "网页爬虫", Action: map[string]*ice.Action{
SPIDE: {Name: "spide wid tid cmd auto", Help: "网页爬虫", Action: map[string]*ice.Action{ web.DOWNLOAD: {Name: "download", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
web.DOWNLOAD: {Name: "download", Help: "下载", Hand: func(m *ice.Message, arg ...string) { m.Cmd(CACHE, mdb.CREATE, arg)
m.Cmd(CACHE, mdb.CREATE, arg)
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
switch msg := m.Cmd(web.SPACE, CHROME, CHROME, arg); kit.Select(SPIDE, arg, 2) {
case SPIDE:
if len(arg) > 1 {
msg.Table(func(index int, value map[string]string, head []string) {
m.Push(kit.MDB_TIME, value[kit.MDB_TIME])
m.Push(kit.MDB_TYPE, value[kit.MDB_TYPE])
m.Push(kit.MDB_NAME, value[kit.MDB_NAME])
switch m.PushButton(web.DOWNLOAD); value[kit.MDB_TYPE] {
case "img":
m.PushImages(kit.MDB_TEXT, value[kit.MDB_LINK])
case "video":
m.PushVideos(kit.MDB_TEXT, value[kit.MDB_LINK])
default:
m.Push(kit.MDB_TEXT, "")
}
m.Push(kit.MDB_LINK, value[kit.MDB_LINK])
})
m.StatusTimeCount()
break
}
fallthrough
default:
m.Copy(msg)
}
}}, }},
}, }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
}) switch msg := m.Cmd(web.SPACE, CHROME, CHROME, arg); kit.Select(SPIDE, arg, 2) {
case SPIDE:
if len(arg) > 1 {
msg.Table(func(index int, value map[string]string, head []string) {
m.Push(kit.MDB_TIME, value[kit.MDB_TIME])
m.Push(kit.MDB_TYPE, value[kit.MDB_TYPE])
m.Push(kit.MDB_NAME, value[kit.MDB_NAME])
switch m.PushButton(web.DOWNLOAD); value[kit.MDB_TYPE] {
case "img":
m.PushImages(kit.MDB_TEXT, value[kit.MDB_LINK])
case "video":
m.PushVideos(kit.MDB_TEXT, value[kit.MDB_LINK])
default:
m.Push(kit.MDB_TEXT, "")
}
m.Push(kit.MDB_LINK, value[kit.MDB_LINK])
})
m.StatusTimeCount()
break
}
fallthrough
default:
m.Copy(msg)
}
}},
}})
} }

View File

@ -2,7 +2,9 @@ package chrome
import ( import (
ice "shylinux.com/x/icebergs" ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/mdb" "shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/tcp"
"shylinux.com/x/icebergs/base/web" "shylinux.com/x/icebergs/base/web"
kit "shylinux.com/x/toolkits" kit "shylinux.com/x/toolkits"
) )
@ -12,15 +14,20 @@ const STYLE = "style"
func init() { func init() {
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{ Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
STYLE: {Name: "style", Help: "样式", Value: kit.Data( STYLE: {Name: "style", Help: "样式", Value: kit.Data(
kit.MDB_SHORT, "zone", kit.MDB_FIELD, "time,id,target,style", kit.MDB_SHORT, kit.MDB_ZONE, kit.MDB_FIELD, "time,id,target,style",
)}, )},
}, Commands: map[string]*ice.Command{ }, Commands: map[string]*ice.Command{
STYLE: {Name: "style zone id auto insert", Help: "样式", Action: ice.MergeAction(map[string]*ice.Action{ STYLE: {Name: "style zone id auto insert", Help: "样式", Action: ice.MergeAction(map[string]*ice.Action{
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
switch arg[0] {
case kit.MDB_ZONE:
m.Cmdy(CHROME, mdb.INPUTS)
}
}},
mdb.INSERT: {Name: "insert zone=golang.google.cn target=. style:textarea", Help: "添加"}, mdb.INSERT: {Name: "insert zone=golang.google.cn target=. style:textarea", Help: "添加"},
SYNC: {Name: "sync hostname", Help: "同步", Hand: func(m *ice.Message, arg ...string) { ctx.COMMAND: {Name: "command", Help: "命令", Hand: func(m *ice.Message, arg ...string) {
m.Fields(0, m.Conf(STYLE, kit.META_FIELD)) m.Cmd(STYLE, m.Option(tcp.HOST)).Table(func(index int, value map[string]string, head []string) {
m.Cmd(mdb.SELECT, m.PrefixKey(), "", mdb.ZONE, m.Option("hostname")).Table(func(index int, value map[string]string, head []string) { m.Cmdy(web.SPACE, CHROME, CHROME, "1", m.Option("tid"), STYLE, value["target"], value["style"])
m.Cmd(web.SPACE, CHROME, CHROME, "1", m.Option("tid"), STYLE, value["target"], value["style"])
}) })
}}, }},
}, mdb.ZoneAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { }, mdb.ZoneAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {

View File

@ -6,10 +6,6 @@ import (
kit "shylinux.com/x/toolkits" kit "shylinux.com/x/toolkits"
) )
const _sync_index = 1
func _sync_count(m *ice.Message) string { return m.Conf(SYNC, kit.Keym(kit.MDB_COUNT)) }
const SYNC = "sync" const SYNC = "sync"
func init() { func init() {
@ -20,20 +16,11 @@ func init() {
m.Cmdy(SYNC, mdb.INSERT, arg) m.Cmdy(SYNC, mdb.INSERT, arg)
}}, }},
SYNC: {Name: "sync id auto page export import", Help: "同步流", Action: ice.MergeAction(map[string]*ice.Action{ SYNC: {Name: "sync id auto page export import", Help: "同步流", Action: ice.MergeAction(map[string]*ice.Action{
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) { FAVOR: {Name: "favor zone=hi name", Help: "收藏", Hand: func(m *ice.Message, arg ...string) {
switch arg[0] { m.Cmdy(FAVOR, mdb.INSERT)
case kit.MDB_ZONE:
m.Cmdy(FAVOR, ice.OptionFields("zone,count,time"))
}
}},
FAVOR: {Name: "favor zone=some name", Help: "收藏", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(FAVOR, mdb.INSERT, m.OptionSimple("zone,type,name,text"))
}}, }},
}, mdb.ListAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { }, mdb.ListAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
m.OptionPage(kit.Slice(arg, _sync_index)...) mdb.ListSelect(m, arg...)
m.Fields(len(kit.Slice(arg, 0, 1)), m.Conf(SYNC, kit.META_FIELD))
m.Cmdy(mdb.SELECT, m.PrefixKey(), "", mdb.LIST, kit.MDB_ID, arg)
m.StatusTimeCountTotal(_sync_count(m))
m.PushAction(FAVOR) m.PushAction(FAVOR)
}}, }},
}}) }})

13
type.go
View File

@ -470,7 +470,7 @@ func (m *Message) Confi(key string, sub string) int {
return kit.Int(m.Conf(key, sub)) return kit.Int(m.Conf(key, sub))
} }
func (m *Message) Confv(arg ...interface{}) (val interface{}) { func (m *Message) Confv(arg ...interface{}) (val interface{}) {
m.Search(kit.Format(arg[0]), func(p *Context, s *Context, key string, conf *Config) { run := func(conf *Config) {
if len(arg) == 1 { if len(arg) == 1 {
val = conf.Value val = conf.Value
return // 读配置 return // 读配置
@ -484,7 +484,16 @@ func (m *Message) Confv(arg ...interface{}) (val interface{}) {
} }
} }
val = kit.Value(conf.Value, arg[1]) // 读配置项 val = kit.Value(conf.Value, arg[1]) // 读配置项
}) }
key := kit.Format(arg[0])
if conf, ok := m.target.Configs[strings.TrimPrefix(key, m.target.Cap(CTX_FOLLOW)+PT)]; ok {
run(conf)
} else if conf, ok := m.source.Configs[strings.TrimPrefix(key, m.source.Cap(CTX_FOLLOW)+PT)]; ok {
run(conf)
} else {
m.Search(key, func(p *Context, s *Context, key string, conf *Config) { run(conf) })
}
return return
} }
func (m *Message) Confm(key string, chain interface{}, cbs ...interface{}) map[string]interface{} { func (m *Message) Confm(key string, chain interface{}, cbs ...interface{}) map[string]interface{} {