forked from x/icebergs
opt some
This commit is contained in:
parent
aac3c4a3d3
commit
08a56cfeb1
@ -3,20 +3,20 @@ package code
|
|||||||
import (
|
import (
|
||||||
ice "github.com/shylinux/icebergs"
|
ice "github.com/shylinux/icebergs"
|
||||||
"github.com/shylinux/icebergs/base/web"
|
"github.com/shylinux/icebergs/base/web"
|
||||||
|
kit "github.com/shylinux/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
const CODE = "code"
|
const CODE = "code"
|
||||||
|
|
||||||
var Index = &ice.Context{Name: CODE, Help: "编程中心",
|
var Index = &ice.Context{Name: CODE, Help: "编程中心", Commands: map[string]*ice.Command{
|
||||||
Configs: map[string]*ice.Config{},
|
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
Commands: map[string]*ice.Command{
|
m.Load()
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
m.Conf(PUBLISH, kit.Keym("contexts"), _contexts)
|
||||||
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()
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Save() }},
|
}},
|
||||||
},
|
}}
|
||||||
}
|
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
web.Index.Register(Index, &web.Frame{},
|
web.Index.Register(Index, &web.Frame{},
|
||||||
|
@ -19,6 +19,10 @@ func init() {
|
|||||||
"display", "/plugin/local/code/vimer.js", "style", "editor",
|
"display", "/plugin/local/code/vimer.js", "style", "editor",
|
||||||
), Action: map[string]*ice.Action{
|
), Action: map[string]*ice.Action{
|
||||||
mdb.ENGINE: {Name: "engine", Help: "运行", Hand: func(m *ice.Message, arg ...string) {
|
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 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 {
|
if m.Cmdy(arg); len(m.Appendv(ice.MSG_APPEND)) == 0 && len(m.Resultv()) == 0 {
|
||||||
m.Cmdy(cli.SYSTEM, arg)
|
m.Cmdy(cli.SYSTEM, arg)
|
||||||
|
@ -37,8 +37,8 @@ func init() {
|
|||||||
_task_inputs(m, kit.Select("", arg, 0), kit.Select("", arg, 1))
|
_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) {
|
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(), kit.Simple(kit.KeyValue(nil, "", kit.Dict(arg)))...)
|
_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"))
|
m.Set(ice.MSG_RESULT).Cmdy(PLAN, m.Option("scale"))
|
||||||
}},
|
}},
|
||||||
ctx.COMMAND: {Name: "command", Help: "命令", Hand: func(m *ice.Message, arg ...string) {
|
ctx.COMMAND: {Name: "command", Help: "命令", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user