1
0
forked from x/icebergs
This commit is contained in:
shaoying 2021-02-09 18:09:11 +08:00
parent aac3c4a3d3
commit 08a56cfeb1
3 changed files with 16 additions and 12 deletions

View File

@ -3,20 +3,20 @@ package code
import (
ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/web"
kit "github.com/shylinux/toolkits"
)
const CODE = "code"
var Index = &ice.Context{Name: CODE, Help: "编程中心",
Configs: map[string]*ice.Config{},
Commands: map[string]*ice.Command{
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
m.Load()
m.Conf(PUBLISH, "meta.contexts", _contexts)
}},
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Save() }},
},
}
var Index = &ice.Context{Name: CODE, Help: "编程中心", Commands: map[string]*ice.Command{
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
m.Load()
m.Conf(PUBLISH, kit.Keym("contexts"), _contexts)
}},
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
m.Save()
}},
}}
func init() {
web.Index.Register(Index, &web.Frame{},

View File

@ -19,6 +19,10 @@ func init() {
"display", "/plugin/local/code/vimer.js", "style", "editor",
), Action: map[string]*ice.Action{
mdb.ENGINE: {Name: "engine", Help: "运行", Hand: func(m *ice.Message, arg ...string) {
if m.Cmdy(mdb.ENGINE, arg); len(m.Resultv()) > 0 || len(m.Appendv(ice.MSG_APPEND)) > 0 {
return
}
if arg = kit.Split(strings.Join(arg, " ")); !m.Warn(!m.Right(arg)) {
if m.Cmdy(arg); len(m.Appendv(ice.MSG_APPEND)) == 0 && len(m.Resultv()) == 0 {
m.Cmdy(cli.SYSTEM, arg)

View File

@ -37,8 +37,8 @@ func init() {
_task_inputs(m, kit.Select("", arg, 0), kit.Select("", arg, 1))
}},
mdb.PLUGIN: {Name: "plugin extra.pod extra.ctx extra.cmd extra.arg", Help: "插件", Hand: func(m *ice.Message, arg ...string) {
_task_modify(m, m.Option(kit.MDB_ZONE), m.Option(kit.MDB_ID), kit.MDB_TIME, m.Time(), kit.Simple(kit.KeyValue(nil, "", kit.Dict(arg)))...)
mdb.PLUGIN: {Name: "plugin extra.ctx extra.cmd extra.arg", Help: "插件", Hand: func(m *ice.Message, arg ...string) {
_task_modify(m, m.Option(kit.MDB_ZONE), m.Option(kit.MDB_ID), kit.MDB_TIME, m.Time(), arg...)
m.Set(ice.MSG_RESULT).Cmdy(PLAN, m.Option("scale"))
}},
ctx.COMMAND: {Name: "command", Help: "命令", Hand: func(m *ice.Message, arg ...string) {