mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 01:24:05 +08:00
opt spide.go
This commit is contained in:
parent
29539c492c
commit
eae1d2ac54
@ -1,6 +1,8 @@
|
||||
package ctx
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
@ -18,7 +20,23 @@ const CONTEXT = "context"
|
||||
|
||||
func init() {
|
||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
||||
CONTEXT: {Name: "context name=web.chat action=context,command,config key auto", Help: "模块", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
CONTEXT: {Name: "context name=web.chat action=context,command,config key auto spide", Help: "模块", Action: ice.MergeAction(map[string]*ice.Action{
|
||||
"spide": {Name: "spide", Help: "架构图", Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 || arg[1] == CONTEXT { // 模块列表
|
||||
m.Cmdy(CONTEXT, kit.Select("ice", arg, 0), CONTEXT)
|
||||
m.Display("/plugin/story/spide.js", "root", kit.Select("ice", arg, 0),
|
||||
"field", "name", "split", ".", "prefix", SPIDE)
|
||||
return
|
||||
}
|
||||
if index := kit.Keys(arg[1]); strings.HasSuffix(index, arg[2]) { // 命令列表
|
||||
m.Cmdy(CONTEXT, index, COMMAND).Table(func(i int, value map[string]string, head []string) {
|
||||
m.Push("file", index)
|
||||
})
|
||||
} else { // 命令详情
|
||||
m.Cmdy(COMMAND, kit.Keys(index, strings.Split(arg[2], " ")[0]))
|
||||
}
|
||||
}},
|
||||
}, CmdAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Search(kit.Select(ice.ICE, arg, 0)+ice.PT, func(p *ice.Context, s *ice.Context, key string) {
|
||||
msg := m.Spawn(s)
|
||||
defer m.Copy(msg)
|
||||
|
4
misc.go
4
misc.go
@ -78,8 +78,8 @@ func (m *Message) Split(str string, field string, sp string, nl string) *Message
|
||||
return m
|
||||
}
|
||||
|
||||
func (m *Message) Display(file string) *Message {
|
||||
m.Option(MSG_DISPLAY, Display0(2, file)["display"])
|
||||
func (m *Message) Display(file string, arg ...interface{}) *Message {
|
||||
m.Option(MSG_DISPLAY, kit.MergeURL(Display0(2, file)["display"], arg...))
|
||||
return m
|
||||
}
|
||||
func (m *Message) DisplayLocal(file string) *Message {
|
||||
|
@ -87,6 +87,9 @@ func init() {
|
||||
})
|
||||
return
|
||||
}
|
||||
if !strings.HasSuffix(arg[1], arg[2]) {
|
||||
return
|
||||
}
|
||||
|
||||
// 语法解析
|
||||
switch m.Option(cli.CMD_DIR, m.Option(nfs.DIR_ROOT)); kit.Ext(arg[1]) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user