mirror of
https://shylinux.com/x/icebergs
synced 2025-05-01 19:19:24 +08:00
opt inner.go
This commit is contained in:
parent
73e92ec42a
commit
b23fe02af5
@ -124,7 +124,6 @@ const (
|
||||
REPOS = "repos"
|
||||
|
||||
LOAD = "load"
|
||||
FIND = "find"
|
||||
TAGS = "tags"
|
||||
)
|
||||
const (
|
||||
|
7
conf.go
7
conf.go
@ -18,14 +18,15 @@ const (
|
||||
OF = " of "
|
||||
|
||||
INIT = "init"
|
||||
EXIT = "exit"
|
||||
SAVE = "save"
|
||||
LOAD = "load"
|
||||
AUTO = "auto"
|
||||
SHOW = "show"
|
||||
EXEC = "exec"
|
||||
AUTO = "auto"
|
||||
PLAY = "play"
|
||||
HELP = "help"
|
||||
HTTP = "http"
|
||||
SAVE = "save"
|
||||
EXIT = "exit"
|
||||
|
||||
BASE = "base"
|
||||
CORE = "core"
|
||||
|
@ -13,8 +13,8 @@ import (
|
||||
)
|
||||
|
||||
func _c_tags(m *ice.Message, key string) {
|
||||
if _, e := os.Stat(path.Join(m.Option(cli.CMD_DIR), _TAGS)); e != nil {
|
||||
m.Cmd(cli.SYSTEM, "ctags", "-R", "-f", _TAGS, ice.PWD)
|
||||
if _, e := os.Stat(path.Join(m.Option(cli.CMD_DIR), TAGS)); e != nil {
|
||||
m.Cmd(cli.SYSTEM, "ctags", "-R", "-f", TAGS, ice.PWD)
|
||||
}
|
||||
_go_tags(m, key)
|
||||
}
|
||||
@ -82,8 +82,8 @@ func init() {
|
||||
m.Cmdy(mdb.SEARCH, MAN2, arg[1:])
|
||||
m.Cmdy(mdb.SEARCH, MAN3, arg[1:])
|
||||
_c_tags(m, kit.Select(MAIN, arg, 1))
|
||||
_go_find(m, kit.Select(MAIN, arg, 1))
|
||||
_go_grep(m, kit.Select(MAIN, arg, 1))
|
||||
_go_find(m, kit.Select(MAIN, arg, 1), arg[2])
|
||||
_go_grep(m, kit.Select(MAIN, arg, 1), arg[2])
|
||||
}},
|
||||
}, PlugAction())},
|
||||
MAN: {Name: MAN, Help: "手册", Action: ice.MergeAction(map[string]*ice.Action{
|
||||
|
@ -15,14 +15,14 @@ import (
|
||||
)
|
||||
|
||||
func _go_tags(m *ice.Message, key string) {
|
||||
if s, e := os.Stat(path.Join(m.Option(cli.CMD_DIR), _TAGS)); os.IsNotExist(e) || s.ModTime().Before(time.Now().Add(kit.Duration("-72h"))) {
|
||||
m.Cmd(cli.SYSTEM, "gotags", "-R", "-f", _TAGS, ice.PWD)
|
||||
if s, e := os.Stat(path.Join(m.Option(cli.CMD_DIR), TAGS)); os.IsNotExist(e) || s.ModTime().Before(time.Now().Add(kit.Duration("-72h"))) {
|
||||
m.Cmd(cli.SYSTEM, "gotags", "-R", "-f", TAGS, ice.PWD)
|
||||
}
|
||||
|
||||
ls := strings.Split(key, ice.PT)
|
||||
key = ls[len(ls)-1]
|
||||
|
||||
for _, l := range strings.Split(m.Cmdx(cli.SYSTEM, GREP, "^"+key+"\\>", _TAGS), ice.NL) {
|
||||
for _, l := range strings.Split(m.Cmdx(cli.SYSTEM, nfs.GREP, "^"+key+"\\>", TAGS), ice.NL) {
|
||||
ls := strings.SplitN(l, ice.TB, 2)
|
||||
if len(ls) < 2 {
|
||||
continue
|
||||
@ -41,37 +41,30 @@ func _go_tags(m *ice.Message, key string) {
|
||||
bio := bufio.NewScanner(f)
|
||||
for i := 1; bio.Scan(); i++ {
|
||||
if i == line || bio.Text() == text {
|
||||
m.PushSearch(ice.CMD, "tags", nfs.FILE, strings.TrimPrefix(file, ice.PWD), nfs.LINE, kit.Format(i), mdb.TEXT, bio.Text())
|
||||
m.PushSearch(nfs.FILE, strings.TrimPrefix(file, ice.PWD), nfs.LINE, kit.Format(i), mdb.TEXT, bio.Text())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
func _go_help(m *ice.Message, key string) {
|
||||
p := m.Cmd(cli.SYSTEM, GO, "doc", key).Append(cli.CMD_OUT)
|
||||
if strings.TrimSpace(p) == "" {
|
||||
return
|
||||
}
|
||||
m.PushSearch(ice.CMD, "help", nfs.FILE, key+".godoc", nfs.LINE, 1, mdb.TEXT, p)
|
||||
}
|
||||
func _go_find(m *ice.Message, key string) {
|
||||
for _, p := range strings.Split(m.Cmdx(cli.SYSTEM, FIND, ".", "-name", key), ice.NL) {
|
||||
if p == "" {
|
||||
continue
|
||||
}
|
||||
m.PushSearch(ice.CMD, FIND, nfs.FILE, strings.TrimPrefix(p, ice.PWD), nfs.LINE, 1, mdb.TEXT, "")
|
||||
if p := m.Cmd(cli.SYSTEM, GO, "doc", key).Append(cli.CMD_OUT); strings.TrimSpace(p) != "" {
|
||||
m.PushSearch(nfs.FILE, key+".godoc", nfs.LINE, 1, mdb.TEXT, p)
|
||||
}
|
||||
}
|
||||
func _go_grep(m *ice.Message, key string) {
|
||||
msg := m.Spawn()
|
||||
msg.Split(m.Cmd(cli.SYSTEM, GREP, "--exclude-dir=.git", "--exclude=.[a-z]*", "-rn", key, ice.PT).Append(cli.CMD_OUT), "file:line:text", ":", ice.NL)
|
||||
msg.Table(func(index int, value map[string]string, head []string) { m.PushSearch(ice.CMD, GREP, value) })
|
||||
func _go_find(m *ice.Message, key string, dir string) {
|
||||
m.Cmd(nfs.FIND, dir, key).Table(func(index int, value map[string]string, head []string) {
|
||||
m.PushSearch(nfs.LINE, 1, value)
|
||||
})
|
||||
}
|
||||
func _go_grep(m *ice.Message, key string, dir string) {
|
||||
m.Cmd(nfs.GREP, dir, key).Table(func(index int, value map[string]string, head []string) {
|
||||
m.PushSearch(value)
|
||||
})
|
||||
}
|
||||
|
||||
const (
|
||||
_TAGS = ".tags"
|
||||
FIND = "find"
|
||||
GREP = "grep"
|
||||
MAIN = "main"
|
||||
TAGS = ".tags"
|
||||
MAIN = "main"
|
||||
)
|
||||
const GO = "go"
|
||||
const MOD = "mod"
|
||||
@ -86,13 +79,11 @@ func init() {
|
||||
m.Cmd(mdb.SEARCH, mdb.CREATE, GO, m.Prefix(GO))
|
||||
m.Cmd(mdb.ENGINE, mdb.CREATE, GO, m.Prefix(GO))
|
||||
|
||||
for _, k := range []string{GODOC, PROTO, SUM, MOD, GO} {
|
||||
LoadPlug(m, GO, MOD, SUM, PROTO)
|
||||
for _, k := range []string{GO, MOD, SUM, PROTO, GODOC} {
|
||||
m.Cmd(mdb.PLUGIN, mdb.CREATE, k, m.Prefix(k))
|
||||
m.Cmd(mdb.RENDER, mdb.CREATE, k, m.Prefix(k))
|
||||
}
|
||||
LoadPlug(m, GO)
|
||||
LoadPlug(m, MOD)
|
||||
LoadPlug(m, PROTO)
|
||||
}},
|
||||
GODOC: {Name: GODOC, Help: "文档", Action: ice.MergeAction(map[string]*ice.Action{
|
||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
|
||||
@ -100,53 +91,42 @@ func init() {
|
||||
m.Echo(m.Cmdx(cli.SYSTEM, GO, "doc", strings.TrimSuffix(arg[1], ice.PT+arg[0])))
|
||||
}},
|
||||
}, PlugAction())},
|
||||
PROTO: {Name: PROTO, Help: "协议", Action: ice.MergeAction(map[string]*ice.Action{}, PlugAction())},
|
||||
SUM: {Name: SUM, Help: "版本", Action: ice.MergeAction(map[string]*ice.Action{}, PlugAction())},
|
||||
MOD: {Name: MOD, Help: "模块", Action: ice.MergeAction(map[string]*ice.Action{}, PlugAction())},
|
||||
PROTO: {Name: PROTO, Help: "协议", Action: PlugAction()},
|
||||
SUM: {Name: SUM, Help: "版本", Action: PlugAction()},
|
||||
MOD: {Name: MOD, Help: "模块", Action: PlugAction()},
|
||||
GO: {Name: GO, Help: "后端", Action: ice.MergeAction(map[string]*ice.Action{
|
||||
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Option(cli.CMD_DIR, arg[2])
|
||||
if strings.HasSuffix(arg[1], "test.go") {
|
||||
m.Cmdy(cli.SYSTEM, GO, "test", "-v", ice.PWD+arg[1])
|
||||
} else {
|
||||
m.Cmdy(cli.SYSTEM, GO, "run", ice.PWD+arg[1])
|
||||
}
|
||||
m.Set(ice.MSG_APPEND)
|
||||
}},
|
||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if arg[0] == mdb.FOREACH {
|
||||
return
|
||||
}
|
||||
_go_tags(m, kit.Select(MAIN, arg, 1))
|
||||
_go_help(m, kit.Select(MAIN, arg, 1))
|
||||
// _go_find(m, kit.Select(MAIN, arg, 1))
|
||||
// _go_grep(m, kit.Select(MAIN, arg, 1))
|
||||
// _go_find(m, kit.Select(MAIN, arg, 1), arg[2])
|
||||
// _go_grep(m, kit.Select(MAIN, arg, 1), arg[2])
|
||||
}},
|
||||
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Option(cli.CMD_DIR, arg[2]); strings.HasSuffix(arg[1], "_test.go") {
|
||||
m.Cmdy(cli.SYSTEM, GO, "test", "-v", ice.PWD+arg[1])
|
||||
} else {
|
||||
m.Cmdy(cli.SYSTEM, GO, "run", ice.PWD+arg[1])
|
||||
}
|
||||
}},
|
||||
}, PlugAction())},
|
||||
}, Configs: map[string]*ice.Config{
|
||||
PROTO: {Name: PROTO, Help: "协议", Value: kit.Data(PLUG, kit.Dict(
|
||||
PREFIX, kit.Dict("//", COMMENT),
|
||||
PREPARE, kit.Dict(
|
||||
KEYWORD, kit.Simple(
|
||||
"syntax", "option", "package", "import", "service", "message",
|
||||
),
|
||||
DATATYPE, kit.Simple(
|
||||
"string", "int64", "int32",
|
||||
),
|
||||
PREFIX, kit.Dict("//", COMMENT), PREPARE, kit.Dict(
|
||||
KEYWORD, kit.Simple("syntax", "option", "package", "import", "service", "message"),
|
||||
DATATYPE, kit.Simple("string", "int64", "int32"),
|
||||
), KEYWORD, kit.Dict(),
|
||||
))},
|
||||
MOD: {Name: MOD, Help: "模块", Value: kit.Data(PLUG, kit.Dict(
|
||||
PREFIX, kit.Dict("//", COMMENT),
|
||||
PREPARE, kit.Dict(
|
||||
KEYWORD, kit.Simple(
|
||||
"go", "module", "require", "replace", "=>",
|
||||
),
|
||||
PREFIX, kit.Dict("//", COMMENT), PREPARE, kit.Dict(
|
||||
KEYWORD, kit.Simple("go", "module", "require", "replace", "=>"),
|
||||
), KEYWORD, kit.Dict(),
|
||||
))},
|
||||
GO: {Name: GO, Help: "后端", Value: kit.Data(PLUG, kit.Dict(
|
||||
SPLIT, kit.Dict("space", "\t ", "operator", "{[(&.,:;!|<>)]}"),
|
||||
PREFIX, kit.Dict("// ", COMMENT, "/*", COMMENT, "* ", COMMENT),
|
||||
PREPARE, kit.Dict(
|
||||
PREFIX, kit.Dict("// ", COMMENT, "/*", COMMENT, "* ", COMMENT), PREPARE, kit.Dict(
|
||||
KEYWORD, kit.Simple(
|
||||
"package", "import", "type", "struct", "interface", "const", "var", "func",
|
||||
"if", "else", "for", "range", "break", "continue",
|
||||
|
@ -13,46 +13,52 @@ import (
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
func _inner_list(m *ice.Message, ext, file, dir string, arg ...string) {
|
||||
if !m.Right(dir, file) {
|
||||
return // 没有权限
|
||||
}
|
||||
if m.Conf(nfs.CAT, kit.Keym(ssh.SOURCE, ext)) == ice.TRUE {
|
||||
m.Cmdy(nfs.CAT, path.Join(dir, file))
|
||||
} else {
|
||||
_inner_show(m, ext, file, dir, arg...)
|
||||
}
|
||||
}
|
||||
func _inner_exec(m *ice.Message, ext, file, dir string, arg ...string) {
|
||||
if !m.Right(dir, file) {
|
||||
return // 没有权限
|
||||
}
|
||||
defer m.StatusTime()
|
||||
if m.Cmdy(mdb.ENGINE, ext, file, dir, arg); m.Result() != "" {
|
||||
return // 执行成功
|
||||
}
|
||||
if ls := kit.Simple(m.Confv(INNER, kit.Keym(EXEC, ext))); len(ls) > 0 {
|
||||
if ls := kit.Simple(m.Configv(kit.Keys(EXEC, ext))); len(ls) > 0 {
|
||||
m.Cmdy(cli.SYSTEM, ls, file, ice.Option{cli.CMD_DIR, dir})
|
||||
m.Set(ice.MSG_APPEND)
|
||||
}
|
||||
}
|
||||
func _inner_list(m *ice.Message, ext, file, dir string, arg ...string) {
|
||||
func _inner_show(m *ice.Message, ext, file, dir string, arg ...string) {
|
||||
if !m.Right(dir, file) {
|
||||
return // 没有权限
|
||||
}
|
||||
if m.Cmdy(mdb.RENDER, ext, file, dir, arg); m.Result() != "" {
|
||||
return // 解析成功
|
||||
}
|
||||
if m.Config(kit.Keys(ssh.SOURCE, ext)) == ice.TRUE {
|
||||
m.Cmdy(nfs.CAT, path.Join(dir, file))
|
||||
}
|
||||
}
|
||||
|
||||
func LoadPlug(m *ice.Message, language string) {
|
||||
m.Confm(language, kit.Keym(PLUG, PREPARE), func(key string, value interface{}) {
|
||||
for _, v := range kit.Simple(value) {
|
||||
m.Conf(language, kit.Keym(PLUG, KEYWORD, v), key)
|
||||
}
|
||||
})
|
||||
func LoadPlug(m *ice.Message, language ...string) {
|
||||
for _, language := range language {
|
||||
m.Conf(nfs.CAT, kit.Keym(nfs.SOURCE, language), ice.TRUE)
|
||||
m.Confm(language, kit.Keym(PLUG, PREPARE), func(key string, value interface{}) {
|
||||
for _, v := range kit.Simple(value) {
|
||||
m.Conf(language, kit.Keym(PLUG, KEYWORD, v), key)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func PlugAction(fields ...string) map[string]*ice.Action {
|
||||
return ice.SelectAction(map[string]*ice.Action{
|
||||
mdb.PLUGIN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Debug("what %v", m.Config(PLUG))
|
||||
m.Echo(m.Config(PLUG))
|
||||
}},
|
||||
mdb.PLUGIN: {Hand: func(m *ice.Message, arg ...string) { m.Echo(m.Config(PLUG)) }},
|
||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(nfs.CAT, path.Join(arg[2], arg[1])) }},
|
||||
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(nfs.CAT, path.Join(arg[2], arg[1])) }},
|
||||
}, fields...)
|
||||
}
|
||||
|
||||
@ -71,18 +77,13 @@ const (
|
||||
const (
|
||||
PLUG = "plug"
|
||||
EXEC = "exec"
|
||||
SHOW = "show"
|
||||
)
|
||||
const INNER = "inner"
|
||||
|
||||
func init() {
|
||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
||||
INNER: {Name: "inner path=src/@key file=main.go line=1 auto", Help: "源代码", Meta: kit.Dict(ice.DisplayLocal("")), Action: ice.MergeAction(map[string]*ice.Action{
|
||||
mdb.PLUGIN: {Name: "plugin", Help: "插件", Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Cmdy(mdb.PLUGIN, arg); m.Result() == "" {
|
||||
m.Echo(kit.Select("{}", m.Config(kit.Keys(PLUG, arg[0]))))
|
||||
}
|
||||
m.Set(ice.MSG_STATUS)
|
||||
}},
|
||||
mdb.SEARCH: {Name: "search", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Option(nfs.DIR_ROOT, arg[2])
|
||||
m.Option(cli.CMD_DIR, kit.Path(arg[2]))
|
||||
@ -98,9 +99,18 @@ func init() {
|
||||
m.Cmdy(INNER, nfs.GREP, arg[1])
|
||||
}
|
||||
}},
|
||||
mdb.PLUGIN: {Name: "plugin", Help: "插件", Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Cmdy(mdb.PLUGIN, arg); m.Result() == "" {
|
||||
m.Echo(kit.Select("{}", m.Config(kit.Keys(PLUG, arg[0]))))
|
||||
}
|
||||
m.Set(ice.MSG_STATUS)
|
||||
}},
|
||||
mdb.ENGINE: {Name: "engine", Help: "引擎", Hand: func(m *ice.Message, arg ...string) {
|
||||
_inner_exec(m, arg[0], arg[1], arg[2])
|
||||
}},
|
||||
mdb.RENDER: {Name: "render", Help: "渲染", Hand: func(m *ice.Message, arg ...string) {
|
||||
_inner_show(m, arg[0], arg[1], arg[2])
|
||||
}},
|
||||
nfs.TAGS: {Name: "tags", Help: "索引", Hand: func(m *ice.Message, arg ...string) {
|
||||
}},
|
||||
nfs.GREP: {Name: "grep", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
||||
@ -109,8 +119,7 @@ func init() {
|
||||
}},
|
||||
cli.MAKE: {Name: "make", Help: "构建", Hand: func(m *ice.Message, arg ...string) {
|
||||
msg := m.Cmd(cli.SYSTEM, cli.MAKE, arg)
|
||||
list := strings.Split(msg.Append(cli.CMD_ERR), ice.NL)
|
||||
for _, line := range list {
|
||||
for _, line := range strings.Split(msg.Append(cli.CMD_ERR), ice.NL) {
|
||||
if strings.Contains(line, ice.DF) {
|
||||
if ls := strings.SplitN(line, ice.DF, 4); len(ls) > 3 {
|
||||
m.Push(nfs.FILE, strings.TrimPrefix(ls[0], m.Option(nfs.PATH)))
|
||||
@ -151,27 +160,13 @@ func init() {
|
||||
return
|
||||
}
|
||||
m.Option("exts", "inner/search.js?a=1,inner/favor.js")
|
||||
arg[1] = kit.Split(arg[1])[0]
|
||||
_inner_list(m, kit.Ext(arg[1]), arg[1], arg[0])
|
||||
if m.IsErrNotFound() {
|
||||
m.SetResult()
|
||||
m.Echo("")
|
||||
if _inner_list(m, kit.Ext(arg[1]), arg[1], arg[0]); m.IsErrNotFound() {
|
||||
m.SetResult("")
|
||||
}
|
||||
m.Set(ice.MSG_STATUS)
|
||||
}},
|
||||
}, Configs: map[string]*ice.Config{
|
||||
INNER: {Name: "inner", Help: "源代码", Value: kit.Data(
|
||||
ssh.SOURCE, kit.Dict(
|
||||
"s", ice.TRUE, "S", ice.TRUE,
|
||||
"shy", ice.TRUE, "py", ice.TRUE,
|
||||
"csv", ice.TRUE, "json", ice.TRUE,
|
||||
"css", ice.TRUE, "html", ice.TRUE,
|
||||
"txt", ice.TRUE, "url", ice.TRUE,
|
||||
"log", ice.TRUE, "err", ice.TRUE,
|
||||
|
||||
"md", ice.TRUE, "license", ice.TRUE, "makefile", ice.TRUE, "sql", ice.TRUE,
|
||||
"ini", ice.TRUE, "conf", ice.TRUE, "toml", ice.TRUE, "yaml", ice.TRUE, "yml", ice.TRUE,
|
||||
),
|
||||
EXEC, kit.Dict(
|
||||
"py", []string{"python"},
|
||||
"js", []string{"node"},
|
||||
|
@ -38,8 +38,8 @@ func init() {
|
||||
if arg[0] == mdb.FOREACH {
|
||||
return
|
||||
}
|
||||
_go_find(m, kit.Select(MAIN, arg, 1))
|
||||
_go_grep(m, kit.Select(MAIN, arg, 1))
|
||||
_go_find(m, kit.Select(MAIN, arg, 1), arg[2])
|
||||
_go_grep(m, kit.Select(MAIN, arg, 1), arg[2])
|
||||
}},
|
||||
}, PlugAction())},
|
||||
NODE: {Name: "node auto download", Help: "前端", Action: map[string]*ice.Action{
|
||||
|
@ -30,8 +30,8 @@ func init() {
|
||||
m.Option(cli.CMD_DIR, kit.Select(ice.SRC, arg, 2))
|
||||
m.Cmdy(mdb.SEARCH, MAN1, arg[1:])
|
||||
m.Cmdy(mdb.SEARCH, MAN8, arg[1:])
|
||||
_go_find(m, kit.Select(MAIN, arg, 1))
|
||||
_go_grep(m, kit.Select(MAIN, arg, 1))
|
||||
_go_find(m, kit.Select(MAIN, arg, 1), arg[2])
|
||||
_go_grep(m, kit.Select(MAIN, arg, 1), arg[2])
|
||||
}},
|
||||
MAN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Echo(_c_help(m, arg[0], arg[1]))
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
|
||||
@ -13,21 +14,24 @@ const SHY = "shy"
|
||||
func init() {
|
||||
Index.Register(&ice.Context{Name: SHY, Help: "脚本", Commands: map[string]*ice.Command{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
for _, cmd := range []string{mdb.PLUGIN, mdb.RENDER, mdb.ENGINE, mdb.SEARCH} {
|
||||
for _, cmd := range []string{mdb.SEARCH, mdb.PLUGIN, mdb.RENDER, mdb.ENGINE} {
|
||||
m.Cmd(cmd, mdb.CREATE, SHY, m.Prefix(SHY))
|
||||
}
|
||||
LoadPlug(m, SHY)
|
||||
}},
|
||||
SHY: {Name: SHY, Help: "脚本", Action: ice.MergeAction(map[string]*ice.Action{
|
||||
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if arg[0] == SHY {
|
||||
_go_find(m, kit.Select(MAIN, arg, 1), arg[2])
|
||||
_go_grep(m, kit.Select(MAIN, arg, 1), arg[2])
|
||||
}
|
||||
}},
|
||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.ProcessCommand()
|
||||
m.Cmdy("web.wiki.word", path.Join(arg[2], arg[1]))
|
||||
}},
|
||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if arg[0] == mdb.FOREACH {
|
||||
return
|
||||
}
|
||||
_go_find(m, kit.Select(MAIN, arg, 1))
|
||||
_go_grep(m, kit.Select(MAIN, arg, 1))
|
||||
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(nfs.SOURCE, path.Join(arg[2], arg[1]))
|
||||
}},
|
||||
}, PlugAction())},
|
||||
}, Configs: map[string]*ice.Config{
|
||||
|
Loading…
x
Reference in New Issue
Block a user