mirror of
https://shylinux.com/x/icebergs
synced 2025-04-27 17:58:29 +08:00
opt css
This commit is contained in:
parent
0f848feb53
commit
34ffc9bf73
@ -91,10 +91,10 @@ const (
|
|||||||
const ROLE = "role"
|
const ROLE = "role"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
ROLE: {Name: ROLE, Help: "角色", Value: kit.Data(mdb.SHORT, mdb.NAME)},
|
ROLE: {Name: ROLE, Help: "角色", Value: kit.Data(mdb.SHORT, mdb.NAME)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
ROLE: {Name: "role role auto insert", Help: "角色", Action: map[string]*ice.Action{
|
ROLE: {Name: "role role auto insert", Help: "角色", Actions: ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Rich(ROLE, nil, kit.Dict(mdb.NAME, TECH, BLACK, kit.Dict(), WHITE, kit.Dict()))
|
m.Rich(ROLE, nil, kit.Dict(mdb.NAME, TECH, BLACK, kit.Dict(), WHITE, kit.Dict()))
|
||||||
m.Rich(ROLE, nil, kit.Dict(mdb.NAME, VOID, WHITE, kit.Dict(), BLACK, kit.Dict()))
|
m.Rich(ROLE, nil, kit.Dict(mdb.NAME, VOID, WHITE, kit.Dict(), BLACK, kit.Dict()))
|
||||||
|
@ -70,12 +70,12 @@ const (
|
|||||||
const SESS = "sess"
|
const SESS = "sess"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
SESS: {Name: SESS, Help: "会话", Value: kit.Data(
|
SESS: {Name: SESS, Help: "会话", Value: kit.Data(
|
||||||
mdb.SHORT, "uniq", mdb.FIELD, "time,hash,userrole,username,usernick,ip,ua", mdb.EXPIRE, "720h",
|
mdb.SHORT, "uniq", mdb.FIELD, "time,hash,userrole,username,usernick,ip,ua", mdb.EXPIRE, "720h",
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
SESS: {Name: "sess hash auto prunes", Help: "会话", Action: ice.MergeAction(map[string]*ice.Action{
|
SESS: {Name: "sess hash auto prunes", Help: "会话", Actions: ice.MergeAction(ice.Actions{
|
||||||
mdb.CREATE: {Name: "create username", Help: "创建"},
|
mdb.CREATE: {Name: "create username", Help: "创建"},
|
||||||
}, mdb.HashAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.HashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.HashSelect(m, arg...)
|
mdb.HashSelect(m, arg...)
|
||||||
|
@ -53,12 +53,12 @@ const (
|
|||||||
const TOTP = "totp"
|
const TOTP = "totp"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
TOTP: {Name: TOTP, Help: "令牌", Value: kit.Data(
|
TOTP: {Name: TOTP, Help: "令牌", Value: kit.Data(
|
||||||
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,secret,period,number", mdb.LINK, "otpauth://totp/%s?secret=%s",
|
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,secret,period,number", mdb.LINK, "otpauth://totp/%s?secret=%s",
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
TOTP: {Name: "totp name auto create", Help: "令牌", Action: ice.MergeAction(map[string]*ice.Action{
|
TOTP: {Name: "totp name auto create", Help: "令牌", Actions: ice.MergeAction(ice.Actions{
|
||||||
mdb.CREATE: {Name: "create name=hi secret period=30 number=6", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create name=hi secret period=30 number=6", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Option(SECRET) == "" { // 创建密钥
|
if m.Option(SECRET) == "" { // 创建密钥
|
||||||
m.Option(SECRET, _totp_gen(kit.Int64(m.Option(PERIOD))))
|
m.Option(SECRET, _totp_gen(kit.Int64(m.Option(PERIOD))))
|
||||||
@ -67,7 +67,7 @@ func init() {
|
|||||||
m.Cmd(mdb.INSERT, TOTP, "", mdb.HASH, m.OptionSimple(mdb.NAME, SECRET, PERIOD, NUMBER))
|
m.Cmd(mdb.INSERT, TOTP, "", mdb.HASH, m.OptionSimple(mdb.NAME, SECRET, PERIOD, NUMBER))
|
||||||
}},
|
}},
|
||||||
}, mdb.HashAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.HashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.HashSelect(m.Spawn(), arg...).Tables(func(value map[string]string) {
|
mdb.HashSelect(m.Spawn(), arg...).Tables(func(value ice.Maps) {
|
||||||
if len(arg) > 0 {
|
if len(arg) > 0 {
|
||||||
m.OptionFields(mdb.DETAIL)
|
m.OptionFields(mdb.DETAIL)
|
||||||
}
|
}
|
||||||
|
@ -114,12 +114,12 @@ const (
|
|||||||
const USER = "user"
|
const USER = "user"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
USER: {Name: USER, Help: "用户", Value: kit.Data(
|
USER: {Name: USER, Help: "用户", Value: kit.Data(
|
||||||
mdb.SHORT, USERNAME, mdb.FIELD, "time,userrole,username,usernick,userzone",
|
mdb.SHORT, USERNAME, mdb.FIELD, "time,userrole,username,usernick,userzone",
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
USER: {Name: "user username auto create", Help: "用户", Action: ice.MergeAction(map[string]*ice.Action{
|
USER: {Name: "user username auto create", Help: "用户", Actions: ice.MergeAction(ice.Actions{
|
||||||
mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if arg[0] == USER {
|
if arg[0] == USER {
|
||||||
_user_search(m, arg[1], kit.Select("", arg, 2))
|
_user_search(m, arg[1], kit.Select("", arg, 2))
|
||||||
|
@ -101,12 +101,12 @@ const (
|
|||||||
const DAEMON = "daemon"
|
const DAEMON = "daemon"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
DAEMON: {Name: DAEMON, Help: "守护进程", Value: kit.Data(
|
DAEMON: {Name: DAEMON, Help: "守护进程", Value: kit.Data(
|
||||||
nfs.PATH, ice.USR_LOCAL_DAEMON, mdb.FIELD, "time,hash,status,pid,cmd,dir,env",
|
nfs.PATH, ice.USR_LOCAL_DAEMON, mdb.FIELD, "time,hash,status,pid,cmd,dir,env",
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
DAEMON: {Name: "daemon hash auto start prunes", Help: "守护进程", Action: ice.MergeAction(map[string]*ice.Action{
|
DAEMON: {Name: "daemon hash auto start prunes", Help: "守护进程", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(mdb.PRUNES, DAEMON, "", mdb.HASH, mdb.CACHE_CLEAR_ON_EXIT, ice.TRUE)
|
m.Cmd(mdb.PRUNES, DAEMON, "", mdb.HASH, mdb.CACHE_CLEAR_ON_EXIT, ice.TRUE)
|
||||||
}},
|
}},
|
||||||
@ -125,7 +125,7 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
STOP: {Name: "stop", Help: "停止", Hand: func(m *ice.Message, arg ...string) {
|
STOP: {Name: "stop", Help: "停止", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.OptionFields(m.Config(mdb.FIELD))
|
m.OptionFields(m.Config(mdb.FIELD))
|
||||||
m.Cmd(mdb.SELECT, DAEMON, "", mdb.HASH, m.OptionSimple(mdb.HASH)).Table(func(index int, value map[string]string, head []string) {
|
m.Cmd(mdb.SELECT, DAEMON, "", mdb.HASH, m.OptionSimple(mdb.HASH)).Table(func(index int, value ice.Maps, head []string) {
|
||||||
m.Cmd(mdb.MODIFY, DAEMON, "", mdb.HASH, m.OptionSimple(mdb.HASH), STATUS, STOP)
|
m.Cmd(mdb.MODIFY, DAEMON, "", mdb.HASH, m.OptionSimple(mdb.HASH), STATUS, STOP)
|
||||||
m.Cmdy(SYSTEM, KILL, value[PID])
|
m.Cmdy(SYSTEM, KILL, value[PID])
|
||||||
})
|
})
|
||||||
@ -134,7 +134,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
}, mdb.HashAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.HashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.HashSelect(m, arg...).Set(ctx.ACTION).Table(func(index int, value map[string]string, head []string) {
|
mdb.HashSelect(m, arg...).Set(ctx.ACTION).Table(func(index int, value ice.Maps, head []string) {
|
||||||
switch value[STATUS] {
|
switch value[STATUS] {
|
||||||
case START:
|
case START:
|
||||||
m.PushButton(RESTART, STOP)
|
m.PushButton(RESTART, STOP)
|
||||||
|
@ -26,8 +26,8 @@ const FOREVER = "forever"
|
|||||||
func init() {
|
func init() {
|
||||||
const SERVE = "serve"
|
const SERVE = "serve"
|
||||||
const RESTART = "restart"
|
const RESTART = "restart"
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
FOREVER: {Name: "forever auto", Help: "启动", Action: map[string]*ice.Action{
|
FOREVER: {Name: "forever auto", Help: "启动", Actions: ice.Actions{
|
||||||
RESTART: {Name: "restart", Help: "重启", Hand: func(m *ice.Message, arg ...string) {
|
RESTART: {Name: "restart", Help: "重启", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_forever_kill(m, "INT")
|
_forever_kill(m, "INT")
|
||||||
}},
|
}},
|
||||||
|
@ -28,8 +28,8 @@ const (
|
|||||||
const MIRRORS = "mirrors"
|
const MIRRORS = "mirrors"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
MIRRORS: {Name: "mirrors cli auto", Help: "软件镜像", Action: ice.MergeAction(map[string]*ice.Action{
|
MIRRORS: {Name: "mirrors cli auto", Help: "软件镜像", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Go(func() {
|
m.Go(func() {
|
||||||
m.Sleep("1s")
|
m.Sleep("1s")
|
||||||
|
@ -129,8 +129,8 @@ const (
|
|||||||
const QRCODE = "qrcode"
|
const QRCODE = "qrcode"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
QRCODE: {Name: "qrcode text@key fg@key bg@key size auto", Help: "二维码", Action: map[string]*ice.Action{
|
QRCODE: {Name: "qrcode text@key fg@key bg@key size auto", Help: "二维码", Actions: ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
ice.AddRender(ice.RENDER_QRCODE, func(m *ice.Message, cmd string, args ...ice.Any) string {
|
ice.AddRender(ice.RENDER_QRCODE, func(m *ice.Message, cmd string, args ...ice.Any) string {
|
||||||
return m.Cmd(QRCODE, kit.Simple(args...)).Result()
|
return m.Cmd(QRCODE, kit.Simple(args...)).Result()
|
||||||
|
@ -74,7 +74,7 @@ func _runtime_hostinfo(m *ice.Message) {
|
|||||||
m.Push("uptime", kit.Split(m.Cmdx(SYSTEM, "uptime"), ice.FS)[0])
|
m.Push("uptime", kit.Split(m.Cmdx(SYSTEM, "uptime"), ice.FS)[0])
|
||||||
}
|
}
|
||||||
func _runtime_diskinfo(m *ice.Message) {
|
func _runtime_diskinfo(m *ice.Message) {
|
||||||
m.Spawn().Split(kit.Replace(m.Cmdx(SYSTEM, "df", "-h"), "Mounted on", "Mountedon"), "", ice.SP, ice.NL).Table(func(index int, value map[string]string, head []string) {
|
m.Spawn().Split(kit.Replace(m.Cmdx(SYSTEM, "df", "-h"), "Mounted on", "Mountedon"), "", ice.SP, ice.NL).Table(func(index int, value ice.Maps, head []string) {
|
||||||
if strings.HasPrefix(value["Filesystem"], "/dev") {
|
if strings.HasPrefix(value["Filesystem"], "/dev") {
|
||||||
m.Push("", value, head)
|
m.Push("", value, head)
|
||||||
}
|
}
|
||||||
@ -151,10 +151,10 @@ const (
|
|||||||
const RUNTIME = "runtime"
|
const RUNTIME = "runtime"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
RUNTIME: {Name: RUNTIME, Help: "运行环境", Value: kit.Dict()},
|
RUNTIME: {Name: RUNTIME, Help: "运行环境", Value: kit.Dict()},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
RUNTIME: {Name: "runtime info=ifconfig,hostinfo,hostname,userinfo,procinfo,bootinfo,diskinfo,env,file,route auto", Help: "运行环境", Action: map[string]*ice.Action{
|
RUNTIME: {Name: "runtime info=ifconfig,hostinfo,hostname,userinfo,procinfo,bootinfo,diskinfo,env,file,route auto", Help: "运行环境", Actions: ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(RUNTIME, MAXPROCS, "1")
|
m.Cmd(RUNTIME, MAXPROCS, "1")
|
||||||
_runtime_init(m)
|
_runtime_init(m)
|
||||||
|
@ -147,10 +147,10 @@ const (
|
|||||||
const SYSTEM = "system"
|
const SYSTEM = "system"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
SYSTEM: {Name: SYSTEM, Help: "系统命令", Value: kit.Data(mdb.FIELD, "time,id,cmd")},
|
SYSTEM: {Name: SYSTEM, Help: "系统命令", Value: kit.Data(mdb.FIELD, "time,id,cmd")},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
SYSTEM: {Name: "system cmd run", Help: "系统命令", Action: map[string]*ice.Action{
|
SYSTEM: {Name: "system cmd run", Help: "系统命令", Actions: ice.Actions{
|
||||||
nfs.FIND: {Name: "find", Help: "查找", Hand: func(m *ice.Message, arg ...string) {
|
nfs.FIND: {Name: "find", Help: "查找", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Echo(_system_find(m, arg[0], arg[1:]...))
|
m.Echo(_system_find(m, arg[0], arg[1:]...))
|
||||||
}},
|
}},
|
||||||
|
@ -72,14 +72,17 @@ func _command_search(m *ice.Message, kind, name, text string) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func CmdAction(args ...ice.Any) map[string]*ice.Action {
|
func CmdAction(args ...ice.Any) ice.Actions {
|
||||||
return map[string]*ice.Action{ice.CTX_INIT: mdb.AutoConfig(args...),
|
return ice.Actions{ice.CTX_INIT: mdb.AutoConfig(args...),
|
||||||
COMMAND: {Name: "command", Help: "命令", Hand: func(m *ice.Message, arg ...string) {
|
COMMAND: {Name: "command", Help: "命令", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if !m.PodCmd(COMMAND, arg) {
|
if !m.PodCmd(COMMAND, arg) {
|
||||||
m.Cmdy(COMMAND, arg)
|
m.Cmdy(COMMAND, 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) {
|
||||||
|
if len(arg) > 3 && arg[1] == "action" && arg[2] == "config" && arg[3] == "reset" {
|
||||||
|
m.Cmd("config", "reset", arg[0])
|
||||||
|
}
|
||||||
if m.Right(arg) && !m.PodCmd(arg) {
|
if m.Right(arg) && !m.PodCmd(arg) {
|
||||||
m.Cmdy(arg)
|
m.Cmdy(arg)
|
||||||
}
|
}
|
||||||
@ -99,8 +102,8 @@ const (
|
|||||||
const COMMAND = "command"
|
const COMMAND = "command"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
COMMAND: {Name: "command key auto", Help: "命令", Action: map[string]*ice.Action{
|
COMMAND: {Name: "command key auto", Help: "命令", Actions: ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(aaa.ROLE, aaa.WHITE, aaa.VOID, m.Prefix(COMMAND))
|
m.Cmd(aaa.ROLE, aaa.WHITE, aaa.VOID, m.Prefix(COMMAND))
|
||||||
m.Cmd(aaa.ROLE, aaa.WHITE, aaa.VOID, COMMAND)
|
m.Cmd(aaa.ROLE, aaa.WHITE, aaa.VOID, COMMAND)
|
||||||
|
@ -99,10 +99,10 @@ const (
|
|||||||
const CONFIG = "config"
|
const CONFIG = "config"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
CONFIG: {Name: CONFIG, Help: "配置", Value: kit.Data(nfs.PATH, ice.VAR_CONF)},
|
CONFIG: {Name: CONFIG, Help: "配置", Value: kit.Data(nfs.PATH, ice.VAR_CONF)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
CONFIG: {Name: "config key auto reset", Help: "配置", Action: map[string]*ice.Action{
|
CONFIG: {Name: "config key auto reset", Help: "配置", Actions: ice.Actions{
|
||||||
SAVE: {Name: "save", Help: "保存", Hand: func(m *ice.Message, arg ...string) {
|
SAVE: {Name: "save", Help: "保存", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_config_save(m, arg[0], arg[1:]...)
|
_config_save(m, arg[0], arg[1:]...)
|
||||||
}},
|
}},
|
||||||
|
@ -38,15 +38,15 @@ func Inputs(m *ice.Message, field string) bool {
|
|||||||
const CONTEXT = "context"
|
const CONTEXT = "context"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
CONTEXT: {Name: "context name=web action=context,command,config key auto spide", Help: "模块", Action: ice.MergeAction(map[string]*ice.Action{
|
CONTEXT: {Name: "context name=web action=context,command,config key auto spide", Help: "模块", Actions: ice.MergeAction(ice.Actions{
|
||||||
"spide": {Name: "spide", Help: "架构图", Hand: func(m *ice.Message, arg ...string) {
|
"spide": {Name: "spide", Help: "架构图", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) == 0 || arg[1] == CONTEXT { // 模块列表
|
if len(arg) == 0 || arg[1] == CONTEXT { // 模块列表
|
||||||
m.Cmdy(CONTEXT, kit.Select(ice.ICE, arg, 0), CONTEXT)
|
m.Cmdy(CONTEXT, kit.Select(ice.ICE, arg, 0), CONTEXT)
|
||||||
m.Display("/plugin/story/spide.js?prefix=spide", "root", kit.Select(ice.ICE, arg, 0), "split", ice.PT)
|
m.Display("/plugin/story/spide.js?prefix=spide", "root", kit.Select(ice.ICE, arg, 0), "split", ice.PT)
|
||||||
|
|
||||||
} else if index := kit.Keys(arg[1]); strings.HasSuffix(index, arg[2]) { // 命令列表
|
} else 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.Cmdy(CONTEXT, index, COMMAND).Table(func(i int, value ice.Maps, head []string) {
|
||||||
m.Push("file", arg[1])
|
m.Push("file", arg[1])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
const MESSAGE = "message"
|
const MESSAGE = "message"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
MESSAGE: {Name: "message", Help: "消息", Hand: func(m *ice.Message, arg ...string) {
|
MESSAGE: {Name: "message", Help: "消息", Hand: func(m *ice.Message, arg ...string) {
|
||||||
t := reflect.TypeOf(m)
|
t := reflect.TypeOf(m)
|
||||||
for i := 0; i < t.NumMethod(); i++ {
|
for i := 0; i < t.NumMethod(); i++ {
|
||||||
|
@ -11,7 +11,7 @@ func _event_listen(m *ice.Message, event string, cmd string) {
|
|||||||
m.Cmdy(mdb.INSERT, EVENT, "", mdb.ZONE, event, ice.CMD, cmd)
|
m.Cmdy(mdb.INSERT, EVENT, "", mdb.ZONE, event, ice.CMD, cmd)
|
||||||
}
|
}
|
||||||
func _event_action(m *ice.Message, event string, arg ...string) {
|
func _event_action(m *ice.Message, event string, arg ...string) {
|
||||||
mdb.ZoneSelect(m, event).Table(func(index int, value map[string]string, head []string) {
|
mdb.ZoneSelect(m, event).Table(func(index int, value ice.Maps, head []string) {
|
||||||
m.Cmd(kit.Split(value[ice.CMD]), event, arg).Cost(EVENT, event, ice.ARG, arg)
|
m.Cmd(kit.Split(value[ice.CMD]), event, arg).Cost(EVENT, event, ice.ARG, arg)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -19,10 +19,10 @@ func _event_action(m *ice.Message, event string, arg ...string) {
|
|||||||
const EVENT = "event"
|
const EVENT = "event"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
EVENT: {Name: EVENT, Help: "事件流", Value: kit.Data(mdb.SHORT, EVENT, mdb.FIELD, "time,id,cmd")},
|
EVENT: {Name: EVENT, Help: "事件流", Value: kit.Data(mdb.SHORT, EVENT, mdb.FIELD, "time,id,cmd")},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
EVENT: {Name: "event event id auto listen", Help: "事件流", Action: ice.MergeAction(map[string]*ice.Action{
|
EVENT: {Name: "event event id auto listen", Help: "事件流", Actions: ice.MergeAction(ice.Actions{
|
||||||
LISTEN: {Name: "listen event cmd", Help: "监听", Hand: func(m *ice.Message, arg ...string) {
|
LISTEN: {Name: "listen event cmd", Help: "监听", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_event_listen(m, m.Option(EVENT), m.Option(ice.CMD))
|
_event_listen(m, m.Option(EVENT), m.Option(ice.CMD))
|
||||||
}},
|
}},
|
||||||
|
@ -45,7 +45,7 @@ func (f *Frame) Close(m *ice.Message, arg ...string) bool {
|
|||||||
|
|
||||||
const GDB = "gdb"
|
const GDB = "gdb"
|
||||||
|
|
||||||
var Index = &ice.Context{Name: GDB, Help: "事件模块", Commands: map[string]*ice.Command{
|
var Index = &ice.Context{Name: GDB, Help: "事件模块", Commands: ice.Commands{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Load(TIMER)
|
m.Load(TIMER)
|
||||||
}},
|
}},
|
||||||
|
@ -12,10 +12,10 @@ import (
|
|||||||
const ROUTINE = "routine"
|
const ROUTINE = "routine"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
ROUTINE: {Name: ROUTINE, Help: "协程池", Value: kit.Data(mdb.SHORT, "time,hash,status,fileline")},
|
ROUTINE: {Name: ROUTINE, Help: "协程池", Value: kit.Data(mdb.SHORT, "time,hash,status,fileline")},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
ROUTINE: {Name: "routine hash auto prunes", Help: "协程池", Action: ice.MergeAction(map[string]*ice.Action{
|
ROUTINE: {Name: "routine hash auto prunes", Help: "协程池", Actions: ice.MergeAction(ice.Actions{
|
||||||
mdb.CREATE: {Name: "create fileline status", Help: "创建"},
|
mdb.CREATE: {Name: "create fileline status", Help: "创建"},
|
||||||
mdb.PRUNES: {Name: "prunes", Help: "清理", Hand: func(m *ice.Message, arg ...string) {
|
mdb.PRUNES: {Name: "prunes", Help: "清理", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.OptionFields(m.Config(mdb.SHORT))
|
m.OptionFields(m.Config(mdb.SHORT))
|
||||||
|
@ -21,7 +21,7 @@ func _signal_listen(m *ice.Message, s int, arg ...string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
func _signal_action(m *ice.Message, arg ...string) {
|
func _signal_action(m *ice.Message, arg ...string) {
|
||||||
mdb.HashSelect(m.Spawn(), arg...).Table(func(index int, value map[string]string, head []string) {
|
mdb.HashSelect(m.Spawn(), arg...).Table(func(index int, value ice.Maps, head []string) {
|
||||||
m.Cmdy(kit.Split(value[ice.CMD]))
|
m.Cmdy(kit.Split(value[ice.CMD]))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -45,12 +45,12 @@ const (
|
|||||||
const SIGNAL = "signal"
|
const SIGNAL = "signal"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
SIGNAL: {Name: SIGNAL, Help: "信号器", Value: kit.Data(
|
SIGNAL: {Name: SIGNAL, Help: "信号器", Value: kit.Data(
|
||||||
mdb.SHORT, SIGNAL, mdb.FIELD, "time,signal,name,cmd", nfs.PATH, path.Join(ice.VAR_RUN, "ice.pid"),
|
mdb.SHORT, SIGNAL, mdb.FIELD, "time,signal,name,cmd", nfs.PATH, path.Join(ice.VAR_RUN, "ice.pid"),
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
SIGNAL: {Name: "signal signal auto listen", Help: "信号器", Action: ice.MergeAction(map[string]*ice.Action{
|
SIGNAL: {Name: "signal signal auto listen", Help: "信号器", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if log.LogDisable {
|
if log.LogDisable {
|
||||||
return // 禁用日志
|
return // 禁用日志
|
||||||
|
@ -41,12 +41,12 @@ const (
|
|||||||
const TIMER = "timer"
|
const TIMER = "timer"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
TIMER: {Name: TIMER, Help: "定时器", Value: kit.Data(
|
TIMER: {Name: TIMER, Help: "定时器", Value: kit.Data(
|
||||||
mdb.FIELD, "time,hash,delay,interval,order,next,cmd", TICK, "1s",
|
mdb.FIELD, "time,hash,delay,interval,order,next,cmd", TICK, "1s",
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
TIMER: {Name: "timer hash id auto create action prunes", Help: "定时器", Action: ice.MergeAction(map[string]*ice.Action{
|
TIMER: {Name: "timer hash id auto create action prunes", Help: "定时器", Actions: ice.MergeAction(ice.Actions{
|
||||||
mdb.CREATE: {Name: "create delay=10ms interval=10s order=3 cmd=runtime", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create delay=10ms interval=10s order=3 cmd=runtime", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(mdb.INSERT, TIMER, "", mdb.HASH, DELAY, "10ms", INTERVAL, "10m", ORDER, 1, NEXT, m.Time(m.Option(DELAY)), arg)
|
m.Cmdy(mdb.INSERT, TIMER, "", mdb.HASH, DELAY, "10ms", INTERVAL, "10m", ORDER, 1, NEXT, m.Time(m.Option(DELAY)), arg)
|
||||||
}},
|
}},
|
||||||
|
@ -385,10 +385,10 @@ const (
|
|||||||
const MATRIX = "matrix"
|
const MATRIX = "matrix"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
MATRIX: {Name: MATRIX, Help: "魔方矩阵", Value: kit.Data()},
|
MATRIX: {Name: MATRIX, Help: "魔方矩阵", Value: kit.Data()},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
MATRIX: {Name: "matrix hash npage text auto", Help: "魔方矩阵", Action: map[string]*ice.Action{
|
MATRIX: {Name: "matrix hash npage text auto", Help: "魔方矩阵", Actions: ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
// _lex_load(m.Load())
|
// _lex_load(m.Load())
|
||||||
}},
|
}},
|
||||||
|
@ -101,9 +101,9 @@ const (
|
|||||||
const SPLIT = "split"
|
const SPLIT = "split"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
SPLIT: {Name: "split", Help: "解析", Value: kit.Data()},
|
SPLIT: {Name: "split", Help: "解析", Value: kit.Data()},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
SPLIT: {Name: "split path key auto", Help: "解析", Hand: func(m *ice.Message, arg ...string) {
|
SPLIT: {Name: "split path key auto", Help: "解析", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) == 0 || strings.HasSuffix(arg[0], ice.PS) {
|
if len(arg) == 0 || strings.HasSuffix(arg[0], ice.PS) {
|
||||||
m.Cmdy(nfs.DIR, arg)
|
m.Cmdy(nfs.DIR, arg)
|
||||||
|
@ -94,7 +94,7 @@ const (
|
|||||||
SHOW = "show"
|
SHOW = "show"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Index = &ice.Context{Name: "log", Help: "日志模块", Configs: map[string]*ice.Config{
|
var Index = &ice.Context{Name: "log", Help: "日志模块", Configs: ice.Configs{
|
||||||
FILE: {Name: FILE, Help: "日志文件", Value: kit.Dict(
|
FILE: {Name: FILE, Help: "日志文件", Value: kit.Dict(
|
||||||
BENCH, kit.Dict(nfs.PATH, path.Join(ice.VAR_LOG, "bench.log"), mdb.LIST, []string{}),
|
BENCH, kit.Dict(nfs.PATH, path.Join(ice.VAR_LOG, "bench.log"), mdb.LIST, []string{}),
|
||||||
WATCH, kit.Dict(nfs.PATH, path.Join(ice.VAR_LOG, "watch.log"), mdb.LIST, []string{
|
WATCH, kit.Dict(nfs.PATH, path.Join(ice.VAR_LOG, "watch.log"), mdb.LIST, []string{
|
||||||
@ -122,7 +122,7 @@ var Index = &ice.Context{Name: "log", Help: "日志模块", Configs: map[string]
|
|||||||
}),
|
}),
|
||||||
)},
|
)},
|
||||||
SHOW: {Name: SHOW, Help: "日志分流", Value: kit.Dict()},
|
SHOW: {Name: SHOW, Help: "日志分流", Value: kit.Dict()},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if log.LogDisable {
|
if log.LogDisable {
|
||||||
return // 禁用日志
|
return // 禁用日志
|
||||||
|
@ -8,10 +8,10 @@ import (
|
|||||||
const ENGINE = "engine"
|
const ENGINE = "engine"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
ENGINE: {Name: ENGINE, Help: "引擎", Value: kit.Data(SHORT, TYPE, FIELD, "time,type,name,text")},
|
ENGINE: {Name: ENGINE, Help: "引擎", Value: kit.Data(SHORT, TYPE, FIELD, "time,type,name,text")},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
ENGINE: {Name: "engine type name text auto", Help: "引擎", Action: ice.MergeAction(map[string]*ice.Action{
|
ENGINE: {Name: "engine type name text auto", Help: "引擎", Actions: ice.MergeAction(ice.Actions{
|
||||||
CREATE: {Name: "create type name text", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
CREATE: {Name: "create type name text", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Option(NAME, kit.Select(m.Option(TYPE), m.Option(NAME)))
|
m.Option(NAME, kit.Select(m.Option(TYPE), m.Option(NAME)))
|
||||||
m.Option(TYPE, kit.Ext(m.Option(TYPE)))
|
m.Option(TYPE, kit.Ext(m.Option(TYPE)))
|
||||||
|
@ -138,7 +138,7 @@ func _hash_prunes(m *ice.Message, prefix, chain string, arg ...string) {
|
|||||||
}
|
}
|
||||||
m.Push(key, val, fields)
|
m.Push(key, val, fields)
|
||||||
})
|
})
|
||||||
m.Table(func(index int, value map[string]string, head []string) {
|
m.Table(func(index int, value ice.Maps, head []string) {
|
||||||
_hash_delete(m, prefix, chain, HASH, value[HASH])
|
_hash_delete(m, prefix, chain, HASH, value[HASH])
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -151,22 +151,36 @@ func AutoConfig(args ...ice.Any) *ice.Action {
|
|||||||
cs[m.CommandKey()] = &ice.Config{Value: kit.Data(args...)}
|
cs[m.CommandKey()] = &ice.Config{Value: kit.Data(args...)}
|
||||||
m.Load(m.CommandKey())
|
m.Load(m.CommandKey())
|
||||||
}
|
}
|
||||||
if cs := m.Target().Commands; cs[m.CommandKey()] == nil || cs[m.CommandKey()].Meta[CREATE] != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
inputs := []ice.Any{}
|
inputs := []ice.Any{}
|
||||||
kit.Fetch(kit.Split(m.Config(FIELD)), func(i int, k string) {
|
kit.Fetch(kit.Split(m.Config(FIELD)), func(i int, k string) {
|
||||||
switch k {
|
switch k {
|
||||||
case TIME, HASH:
|
case TIME, HASH, ID:
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
inputs = append(inputs, k)
|
inputs = append(inputs, k)
|
||||||
})
|
})
|
||||||
m.Design(CREATE, "创建", inputs...)
|
|
||||||
|
cs := m.Target().Commands
|
||||||
|
if cs[m.CommandKey()] == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
m.Debug("what %v %v", m.CommandKey(), cs[m.CommandKey()].Actions[INSERT])
|
||||||
|
if cs[m.CommandKey()].Actions[INSERT] != nil {
|
||||||
|
if cs[m.CommandKey()].Meta[INSERT] == nil {
|
||||||
|
m.Design(INSERT, "添加", append([]ice.Any{ZONE}, inputs...)...)
|
||||||
|
}
|
||||||
|
m.Debug("what %v %v", m.CommandKey(), cs[m.CommandKey()].Actions[INSERT])
|
||||||
|
} else if cs[m.CommandKey()].Actions[CREATE] != nil {
|
||||||
|
if cs[m.CommandKey()].Meta[CREATE] == nil {
|
||||||
|
m.Design(CREATE, "创建", inputs...)
|
||||||
|
}
|
||||||
|
m.Debug("what %v %v", m.CommandKey(), cs[m.CommandKey()].Actions[INSERT])
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
func HashAction(args ...ice.Any) map[string]*ice.Action {
|
func HashAction(args ...ice.Any) ice.Actions {
|
||||||
_key := func(m *ice.Message) string {
|
_key := func(m *ice.Message) string {
|
||||||
if m.Config(HASH) == UNIQ {
|
if m.Config(HASH) == UNIQ {
|
||||||
return HASH
|
return HASH
|
||||||
@ -176,7 +190,7 @@ func HashAction(args ...ice.Any) map[string]*ice.Action {
|
|||||||
}
|
}
|
||||||
return kit.Select(HASH, m.Config(SHORT))
|
return kit.Select(HASH, m.Config(SHORT))
|
||||||
}
|
}
|
||||||
return map[string]*ice.Action{ice.CTX_INIT: AutoConfig(args...),
|
return ice.Actions{ice.CTX_INIT: AutoConfig(args...),
|
||||||
INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(INPUTS, m.PrefixKey(), "", HASH, arg)
|
m.Cmdy(INPUTS, m.PrefixKey(), "", HASH, arg)
|
||||||
}},
|
}},
|
||||||
@ -206,7 +220,7 @@ func HashAction(args ...ice.Any) map[string]*ice.Action {
|
|||||||
}},
|
}},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func HashActionStatus(args ...ice.Any) map[string]*ice.Action {
|
func HashActionStatus(args ...ice.Any) ice.Actions {
|
||||||
list := HashAction(args...)
|
list := HashAction(args...)
|
||||||
list[PRUNES] = &ice.Action{Name: "prunes", Help: "清理", Hand: func(m *ice.Message, arg ...string) {
|
list[PRUNES] = &ice.Action{Name: "prunes", Help: "清理", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.OptionFields(m.Config(FIELD))
|
m.OptionFields(m.Config(FIELD))
|
||||||
@ -228,7 +242,7 @@ func HashSelect(m *ice.Message, arg ...string) *ice.Message {
|
|||||||
m.StatusTimeCount()
|
m.StatusTimeCount()
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
func HashPrunes(m *ice.Message, cb func(map[string]string) bool) *ice.Message {
|
func HashPrunes(m *ice.Message, cb func(ice.Maps) bool) *ice.Message {
|
||||||
_key := func(m *ice.Message) string {
|
_key := func(m *ice.Message) string {
|
||||||
if m.Config(HASH) == UNIQ {
|
if m.Config(HASH) == UNIQ {
|
||||||
return HASH
|
return HASH
|
||||||
@ -236,7 +250,7 @@ func HashPrunes(m *ice.Message, cb func(map[string]string) bool) *ice.Message {
|
|||||||
return kit.Select(HASH, m.Config(SHORT))
|
return kit.Select(HASH, m.Config(SHORT))
|
||||||
}
|
}
|
||||||
expire := kit.Time(kit.Select(m.Time("-72h"), m.Option(EXPIRE)))
|
expire := kit.Time(kit.Select(m.Time("-72h"), m.Option(EXPIRE)))
|
||||||
m.Cmd(m.CommandKey()).Table(func(index int, value map[string]string, head []string) {
|
m.Cmd(m.CommandKey()).Table(func(index int, value ice.Maps, head []string) {
|
||||||
if kit.Time(value[TIME]) > expire {
|
if kit.Time(value[TIME]) > expire {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -133,8 +133,8 @@ func _list_prunes(m *ice.Message, prefix, chain string, arg ...string) {
|
|||||||
|
|
||||||
const LIST = "list"
|
const LIST = "list"
|
||||||
|
|
||||||
func ListAction(args ...ice.Any) map[string]*ice.Action {
|
func ListAction(args ...ice.Any) ice.Actions {
|
||||||
return map[string]*ice.Action{ice.CTX_INIT: AutoConfig(args...),
|
return ice.Actions{ice.CTX_INIT: AutoConfig(args...),
|
||||||
INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(INPUTS, m.PrefixKey(), "", LIST, arg)
|
m.Cmdy(INPUTS, m.PrefixKey(), "", LIST, arg)
|
||||||
}},
|
}},
|
||||||
|
@ -145,7 +145,7 @@ func NextPageLimit(m *ice.Message, total string, arg ...string) {
|
|||||||
|
|
||||||
const MDB = "mdb"
|
const MDB = "mdb"
|
||||||
|
|
||||||
var Index = &ice.Context{Name: MDB, Help: "数据模块", Commands: map[string]*ice.Command{
|
var Index = &ice.Context{Name: MDB, Help: "数据模块", Commands: ice.Commands{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {}},
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {}},
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {}},
|
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {}},
|
||||||
INSERT: {Name: "insert key sub type arg...", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
INSERT: {Name: "insert key sub type arg...", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
@ -8,10 +8,10 @@ import (
|
|||||||
const PLUGIN = "plugin"
|
const PLUGIN = "plugin"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
PLUGIN: {Name: PLUGIN, Help: "插件", Value: kit.Data(SHORT, TYPE, FIELD, "time,type,name,text")},
|
PLUGIN: {Name: PLUGIN, Help: "插件", Value: kit.Data(SHORT, TYPE, FIELD, "time,type,name,text")},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
PLUGIN: {Name: "plugin type name text auto", Help: "插件", Action: map[string]*ice.Action{
|
PLUGIN: {Name: "plugin type name text auto", Help: "插件", Actions: ice.Actions{
|
||||||
CREATE: {Name: "create type name text", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
CREATE: {Name: "create type name text", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Option(NAME, kit.Select(m.Option(TYPE), m.Option(NAME)))
|
m.Option(NAME, kit.Select(m.Option(TYPE), m.Option(NAME)))
|
||||||
m.Option(TYPE, kit.Ext(m.Option(TYPE)))
|
m.Option(TYPE, kit.Ext(m.Option(TYPE)))
|
||||||
|
@ -8,10 +8,10 @@ import (
|
|||||||
const RENDER = "render"
|
const RENDER = "render"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
RENDER: {Name: RENDER, Help: "渲染", Value: kit.Data(SHORT, TYPE, FIELD, "time,type,name,text")},
|
RENDER: {Name: RENDER, Help: "渲染", Value: kit.Data(SHORT, TYPE, FIELD, "time,type,name,text")},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
RENDER: {Name: "render type name text auto", Help: "渲染", Action: map[string]*ice.Action{
|
RENDER: {Name: "render type name text auto", Help: "渲染", Actions: ice.Actions{
|
||||||
CREATE: {Name: "create type name text", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
CREATE: {Name: "create type name text", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Option(NAME, kit.Select(m.Option(TYPE), m.Option(NAME)))
|
m.Option(NAME, kit.Select(m.Option(TYPE), m.Option(NAME)))
|
||||||
m.Option(TYPE, kit.Ext(m.Option(TYPE)))
|
m.Option(TYPE, kit.Ext(m.Option(TYPE)))
|
||||||
|
@ -8,10 +8,10 @@ import (
|
|||||||
const SEARCH = "search"
|
const SEARCH = "search"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
SEARCH: {Name: SEARCH, Help: "搜索", Value: kit.Data(SHORT, TYPE, FIELD, "time,type,name,text")},
|
SEARCH: {Name: SEARCH, Help: "搜索", Value: kit.Data(SHORT, TYPE, FIELD, "time,type,name,text")},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
SEARCH: {Name: "search type name text auto", Help: "搜索", Action: map[string]*ice.Action{
|
SEARCH: {Name: "search type name text auto", Help: "搜索", Actions: ice.Actions{
|
||||||
CREATE: {Name: "create type name text", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
CREATE: {Name: "create type name text", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Option(NAME, kit.Select(m.Option(TYPE), m.Option(NAME)))
|
m.Option(NAME, kit.Select(m.Option(TYPE), m.Option(NAME)))
|
||||||
m.Option(TYPE, kit.Ext(m.Option(TYPE)))
|
m.Option(TYPE, kit.Ext(m.Option(TYPE)))
|
||||||
|
@ -41,8 +41,8 @@ func _zone_select(m *ice.Message, prefix, chain, zone string, id string) {
|
|||||||
cb(key, value)
|
cb(key, value)
|
||||||
case func(ice.Map):
|
case func(ice.Map):
|
||||||
cb(value)
|
cb(value)
|
||||||
case func(map[string]string):
|
case func(ice.Maps):
|
||||||
res := map[string]string{}
|
res := ice.Maps{}
|
||||||
for k, v := range value {
|
for k, v := range value {
|
||||||
res[k] = kit.Format(v)
|
res[k] = kit.Format(v)
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ func _zone_import(m *ice.Message, prefix, chain, file string) {
|
|||||||
head, _ := r.Read()
|
head, _ := r.Read()
|
||||||
count := 0
|
count := 0
|
||||||
|
|
||||||
list := map[string]string{}
|
list := ice.Maps{}
|
||||||
zkey := kit.Select(head[0], m.OptionFields())
|
zkey := kit.Select(head[0], m.OptionFields())
|
||||||
|
|
||||||
for {
|
for {
|
||||||
@ -145,10 +145,10 @@ func _zone_import(m *ice.Message, prefix, chain, file string) {
|
|||||||
|
|
||||||
const ZONE = "zone"
|
const ZONE = "zone"
|
||||||
|
|
||||||
func ZoneAction(args ...ice.Any) map[string]*ice.Action {
|
func ZoneAction(args ...ice.Any) ice.Actions {
|
||||||
_zone := func(m *ice.Message) string { return kit.Select(ZONE, m.Config(SHORT)) }
|
_zone := func(m *ice.Message) string { return kit.Select(ZONE, m.Config(SHORT)) }
|
||||||
|
|
||||||
return map[string]*ice.Action{ice.CTX_INIT: AutoConfig(args...),
|
return ice.Actions{ice.CTX_INIT: AutoConfig(args...),
|
||||||
INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||||
arg[0] = strings.TrimPrefix(arg[0], "extra.")
|
arg[0] = strings.TrimPrefix(arg[0], "extra.")
|
||||||
arg[0] = kit.Select(arg[0], m.Config(kit.Keys(ALIAS, arg[0])))
|
arg[0] = kit.Select(arg[0], m.Config(kit.Keys(ALIAS, arg[0])))
|
||||||
@ -177,7 +177,7 @@ func ZoneAction(args ...ice.Any) map[string]*ice.Action {
|
|||||||
REMOVE: {Name: "remove", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
REMOVE: {Name: "remove", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(DELETE, m.PrefixKey(), "", HASH, m.OptionSimple(_zone(m)), arg)
|
m.Cmdy(DELETE, m.PrefixKey(), "", HASH, m.OptionSimple(_zone(m)), arg)
|
||||||
}},
|
}},
|
||||||
INSERT: {Name: "insert zone type=go name=hi text=hello", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
INSERT: {Name: "insert", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
arg = m.OptionSimple(_zone(m), m.Config(FIELD))
|
arg = m.OptionSimple(_zone(m), m.Config(FIELD))
|
||||||
}
|
}
|
||||||
|
@ -167,7 +167,7 @@ const (
|
|||||||
const CAT = "cat"
|
const CAT = "cat"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
CAT: {Name: CAT, Help: "文件", Value: kit.Data(
|
CAT: {Name: CAT, Help: "文件", Value: kit.Data(
|
||||||
SOURCE, kit.Dict(
|
SOURCE, kit.Dict(
|
||||||
HTML, ice.TRUE, CSS, ice.TRUE, JS, ice.TRUE, GO, ice.TRUE, SH, ice.TRUE, CSV, ice.TRUE, JSON, ice.TRUE,
|
HTML, ice.TRUE, CSS, ice.TRUE, JS, ice.TRUE, GO, ice.TRUE, SH, ice.TRUE, CSV, ice.TRUE, JSON, ice.TRUE,
|
||||||
@ -176,8 +176,8 @@ func init() {
|
|||||||
"py", ice.TRUE,
|
"py", ice.TRUE,
|
||||||
),
|
),
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
CAT: {Name: "cat path auto", Help: "文件", Action: map[string]*ice.Action{
|
CAT: {Name: "cat path auto", Help: "文件", Actions: ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(mdb.RENDER, mdb.CREATE, m.CommandKey(), m.PrefixKey())
|
m.Cmd(mdb.RENDER, mdb.CREATE, m.CommandKey(), m.PrefixKey())
|
||||||
}},
|
}},
|
||||||
|
@ -86,7 +86,7 @@ func _dir_list(m *ice.Message, root string, name string, level int, deep bool, d
|
|||||||
continue
|
continue
|
||||||
case nil:
|
case nil:
|
||||||
default:
|
default:
|
||||||
m.Error(true, ice.ErrNotImplement)
|
m.Error(true, "what: %v: %v", ice.ErrNotImplement, cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, field := range fields {
|
for _, field := range fields {
|
||||||
@ -191,7 +191,7 @@ func _dir_list(m *ice.Message, root string, name string, level int, deep bool, d
|
|||||||
}
|
}
|
||||||
func _dir_search(m *ice.Message, kind, name string) {
|
func _dir_search(m *ice.Message, kind, name string) {
|
||||||
msg := _dir_list(m.Spawn(), PWD, "", 0, true, TYPE_BOTH, nil, kit.Split("time,type,name"))
|
msg := _dir_list(m.Spawn(), PWD, "", 0, true, TYPE_BOTH, nil, kit.Split("time,type,name"))
|
||||||
msg.Table(func(index int, value map[string]string, head []string) {
|
msg.Table(func(index int, value ice.Maps, head []string) {
|
||||||
if !strings.Contains(value[mdb.NAME], name) {
|
if !strings.Contains(value[mdb.NAME], name) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -235,10 +235,10 @@ const (
|
|||||||
const DIR = "dir"
|
const DIR = "dir"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
DIR: {Name: DIR, Help: "目录", Value: kit.Data()},
|
DIR: {Name: DIR, Help: "目录", Value: kit.Data()},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
DIR: {Name: "dir path field... auto upload", Help: "目录", Action: map[string]*ice.Action{
|
DIR: {Name: "dir path field... auto upload", Help: "目录", Actions: ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(mdb.RENDER, mdb.CREATE, m.CommandKey(), m.PrefixKey())
|
m.Cmd(mdb.RENDER, mdb.CREATE, m.CommandKey(), m.PrefixKey())
|
||||||
}},
|
}},
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
const FIND = "find"
|
const FIND = "find"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
FIND: {Name: "find path word auto", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
FIND: {Name: "find path word auto", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
||||||
for _, file := range strings.Split(m.Cmdx("cli.system", FIND, PWD, "-name", arg[1]), ice.NL) {
|
for _, file := range strings.Split(m.Cmdx("cli.system", FIND, PWD, "-name", arg[1]), ice.NL) {
|
||||||
m.Push(FILE, strings.TrimPrefix(file, PWD))
|
m.Push(FILE, strings.TrimPrefix(file, PWD))
|
||||||
|
@ -5,7 +5,7 @@ import ice "shylinux.com/x/icebergs"
|
|||||||
const GREP = "grep"
|
const GREP = "grep"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
GREP: {Name: "grep path word auto", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
GREP: {Name: "grep path word auto", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Option("cmd_dir", arg[0])
|
m.Option("cmd_dir", arg[0])
|
||||||
m.Split(m.Cmdx("cli.system", GREP, "--exclude=.[a-z]*", "--exclude-dir=.[a-z]*", "-rni", arg[1]), "file:line:text", ":")
|
m.Split(m.Cmdx("cli.system", GREP, "--exclude=.[a-z]*", "--exclude-dir=.[a-z]*", "-rni", arg[1]), "file:line:text", ":")
|
||||||
|
@ -92,7 +92,7 @@ const COPY = "copy"
|
|||||||
const LINK = "link"
|
const LINK = "link"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
DEFS: {Name: "defs file text...", Help: "默认", Hand: func(m *ice.Message, arg ...string) {
|
DEFS: {Name: "defs file text...", Help: "默认", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_defs_file(m, arg[0], arg[1:]...)
|
_defs_file(m, arg[0], arg[1:]...)
|
||||||
}},
|
}},
|
||||||
|
@ -36,12 +36,12 @@ func _tail_count(m *ice.Message, name string) string {
|
|||||||
const TAIL = "tail"
|
const TAIL = "tail"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
TAIL: {Name: TAIL, Help: "日志流", Value: kit.Data(
|
TAIL: {Name: TAIL, Help: "日志流", Value: kit.Data(
|
||||||
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,id,file,text",
|
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,id,file,text",
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
TAIL: {Name: "tail name id auto page filter:text create", Help: "日志流", Action: ice.MergeAction(map[string]*ice.Action{
|
TAIL: {Name: "tail name id auto page filter:text create", Help: "日志流", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Richs(TAIL, "", mdb.FOREACH, func(key string, value ice.Map) {
|
m.Richs(TAIL, "", mdb.FOREACH, func(key string, value ice.Map) {
|
||||||
value, _ = kit.GetMeta(value), m.Option(mdb.HASH, key)
|
value, _ = kit.GetMeta(value), m.Option(mdb.HASH, key)
|
||||||
@ -66,7 +66,7 @@ func init() {
|
|||||||
m.Fields(len(kit.Slice(arg, 0, 2)), "time,name,count,file", m.Config(mdb.FIELD))
|
m.Fields(len(kit.Slice(arg, 0, 2)), "time,name,count,file", m.Config(mdb.FIELD))
|
||||||
m.OptionPage(kit.Slice(arg, 2)...)
|
m.OptionPage(kit.Slice(arg, 2)...)
|
||||||
|
|
||||||
mdb.ZoneSelect(m.Spawn(), arg...).Table(func(index int, value map[string]string, head []string) {
|
mdb.ZoneSelect(m.Spawn(), arg...).Table(func(index int, value ice.Maps, head []string) {
|
||||||
if strings.Contains(value[mdb.TEXT], m.Option(ice.CACHE_FILTER)) {
|
if strings.Contains(value[mdb.TEXT], m.Option(ice.CACHE_FILTER)) {
|
||||||
m.Push("", value, head)
|
m.Push("", value, head)
|
||||||
}
|
}
|
||||||
|
@ -15,8 +15,8 @@ import (
|
|||||||
const TAR = "tar"
|
const TAR = "tar"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
TAR: {Name: "tar file path auto", Help: "打包", Action: map[string]*ice.Action{
|
TAR: {Name: "tar file path auto", Help: "打包", Actions: ice.Actions{
|
||||||
mdb.IMPORT: {Name: "import", Help: "导入", Hand: func(m *ice.Message, arg ...string) {
|
mdb.IMPORT: {Name: "import", Help: "导入", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) == 1 {
|
if len(arg) == 1 {
|
||||||
arg = append(arg, arg[0])
|
arg = append(arg, arg[0])
|
||||||
|
@ -32,12 +32,12 @@ const (
|
|||||||
const TRASH = "trash"
|
const TRASH = "trash"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
TRASH: {Name: TRASH, Help: "回收站", Value: kit.Data(
|
TRASH: {Name: TRASH, Help: "回收站", Value: kit.Data(
|
||||||
mdb.SHORT, FROM, mdb.FIELD, "time,hash,file,from", PATH, ice.VAR_TRASH,
|
mdb.SHORT, FROM, mdb.FIELD, "time,hash,file,from", PATH, ice.VAR_TRASH,
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
TRASH: {Name: "trash hash auto prunes", Help: "回收站", Action: ice.MergeAction(map[string]*ice.Action{
|
TRASH: {Name: "trash hash auto prunes", Help: "回收站", Actions: ice.MergeAction(ice.Actions{
|
||||||
mdb.REVERT: {Name: "revert", Help: "恢复", Hand: func(m *ice.Message, arg ...string) {
|
mdb.REVERT: {Name: "revert", Help: "恢复", Hand: func(m *ice.Message, arg ...string) {
|
||||||
os.Rename(m.Option(FILE), m.Option(FROM))
|
os.Rename(m.Option(FILE), m.Option(FROM))
|
||||||
m.Cmd(mdb.DELETE, TRASH, "", mdb.HASH, m.OptionSimple(mdb.HASH))
|
m.Cmd(mdb.DELETE, TRASH, "", mdb.HASH, m.OptionSimple(mdb.HASH))
|
||||||
@ -54,7 +54,7 @@ func init() {
|
|||||||
m.Cmd(mdb.DELETE, TRASH, "", mdb.HASH, m.OptionSimple(mdb.HASH))
|
m.Cmd(mdb.DELETE, TRASH, "", mdb.HASH, m.OptionSimple(mdb.HASH))
|
||||||
}},
|
}},
|
||||||
mdb.PRUNES: {Name: "prunes before@date", Help: "清理", Hand: func(m *ice.Message, arg ...string) {
|
mdb.PRUNES: {Name: "prunes before@date", Help: "清理", Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.HashPrunes(m, func(value map[string]string) bool {
|
mdb.HashPrunes(m, func(value ice.Maps) bool {
|
||||||
os.Remove(value[FILE])
|
os.Remove(value[FILE])
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
@ -259,15 +259,15 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
SOURCE: {Name: SOURCE, Help: "加载脚本", Value: kit.Data()},
|
SOURCE: {Name: SOURCE, Help: "加载脚本", Value: kit.Data()},
|
||||||
PROMPT: {Name: PROMPT, Help: "命令提示", Value: kit.Data(
|
PROMPT: {Name: PROMPT, Help: "命令提示", Value: kit.Data(
|
||||||
PS1, []ice.Any{"\033[33;44m", mdb.COUNT, "[", mdb.TIME, "]", "\033[5m", TARGET, "\033[0m", "\033[44m", ">", "\033[0m ", "\033[?25h", "\033[32m"},
|
PS1, []ice.Any{"\033[33;44m", mdb.COUNT, "[", mdb.TIME, "]", "\033[5m", TARGET, "\033[0m", "\033[44m", ">", "\033[0m ", "\033[?25h", "\033[32m"},
|
||||||
PS2, []ice.Any{mdb.COUNT, " ", TARGET, "> "},
|
PS2, []ice.Any{mdb.COUNT, " ", TARGET, "> "},
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {}},
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {}},
|
||||||
SOURCE: {Name: "source file", Help: "脚本解析", Action: ice.MergeAction(map[string]*ice.Action{
|
SOURCE: {Name: "source file", Help: "脚本解析", Actions: ice.MergeAction(ice.Actions{
|
||||||
"repeat": {Name: "repeat", Help: "执行", Hand: func(m *ice.Message, arg ...string) {
|
"repeat": {Name: "repeat", Help: "执行", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(SCREEN, m.Option(mdb.TEXT))
|
m.Cmdy(SCREEN, m.Option(mdb.TEXT))
|
||||||
m.ProcessInner()
|
m.ProcessInner()
|
||||||
|
@ -77,12 +77,12 @@ const (
|
|||||||
const CLIENT = "client"
|
const CLIENT = "client"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
CLIENT: {Name: CLIENT, Help: "客户端", Value: kit.Data(
|
CLIENT: {Name: CLIENT, Help: "客户端", Value: kit.Data(
|
||||||
mdb.FIELD, "time,hash,status,type,name,host,port,error,nread,nwrite",
|
mdb.FIELD, "time,hash,status,type,name,host,port,error,nread,nwrite",
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
CLIENT: {Name: "client hash auto prunes", Help: "客户端", Action: ice.MergeAction(map[string]*ice.Action{
|
CLIENT: {Name: "client hash auto prunes", Help: "客户端", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Richs(CLIENT, "", mdb.FOREACH, func(key string, value ice.Map) {
|
m.Richs(CLIENT, "", mdb.FOREACH, func(key string, value ice.Map) {
|
||||||
kit.Value(value, kit.Keym(STATUS), CLOSE)
|
kit.Value(value, kit.Keym(STATUS), CLOSE)
|
||||||
@ -93,7 +93,7 @@ func init() {
|
|||||||
_client_dial(m, arg...)
|
_client_dial(m, arg...)
|
||||||
}},
|
}},
|
||||||
}, mdb.HashActionStatus()), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.HashActionStatus()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.HashSelect(m, arg...).Table(func(index int, value map[string]string, head []string) {
|
mdb.HashSelect(m, arg...).Table(func(index int, value ice.Maps, head []string) {
|
||||||
m.PushButton(kit.Select("", mdb.REMOVE, value[STATUS] == OPEN))
|
m.PushButton(kit.Select("", mdb.REMOVE, value[STATUS] == OPEN))
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
|
@ -73,14 +73,14 @@ const (
|
|||||||
const HOST = "host"
|
const HOST = "host"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
HOST: {Name: HOST, Help: "主机", Value: kit.Data(
|
HOST: {Name: HOST, Help: "主机", Value: kit.Data(
|
||||||
aaa.BLACK, kit.Data(mdb.SHORT, mdb.TEXT), aaa.WHITE, kit.Data(mdb.SHORT, mdb.TEXT),
|
aaa.BLACK, kit.Data(mdb.SHORT, mdb.TEXT), aaa.WHITE, kit.Data(mdb.SHORT, mdb.TEXT),
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
HOST: {Name: "host name auto", Help: "主机", Action: map[string]*ice.Action{
|
HOST: {Name: "host name auto", Help: "主机", Actions: ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(HOST).Table(func(index int, value map[string]string, head []string) {
|
m.Cmd(HOST).Table(func(index int, value ice.Maps, head []string) {
|
||||||
m.Cmd(HOST, aaa.WHITE, value[aaa.IP])
|
m.Cmd(HOST, aaa.WHITE, value[aaa.IP])
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
|
@ -46,10 +46,10 @@ const (
|
|||||||
const PORT = "port"
|
const PORT = "port"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
PORT: {Name: PORT, Help: "端口", Value: kit.Data(BEGIN, 10000, CURRENT, 10000, END, 20000)},
|
PORT: {Name: PORT, Help: "端口", Value: kit.Data(BEGIN, 10000, CURRENT, 10000, END, 20000)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
PORT: {Name: "port port path auto", Help: "端口", Action: map[string]*ice.Action{
|
PORT: {Name: "port port path auto", Help: "端口", Actions: ice.Actions{
|
||||||
aaa.RIGHT: {Name: "right", Help: "分配", Hand: func(m *ice.Message, arg ...string) {
|
aaa.RIGHT: {Name: "right", Help: "分配", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Echo(_port_right(m, arg...))
|
m.Echo(_port_right(m, arg...))
|
||||||
}},
|
}},
|
||||||
@ -62,7 +62,7 @@ func init() {
|
|||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
current := kit.Int(m.Config(BEGIN))
|
current := kit.Int(m.Config(BEGIN))
|
||||||
m.Option(nfs.DIR_ROOT, ice.USR_LOCAL_DAEMON)
|
m.Option(nfs.DIR_ROOT, ice.USR_LOCAL_DAEMON)
|
||||||
m.Cmd(nfs.DIR, nfs.PWD, nfs.DIR_CLI_FIELDS).Tables(func(value map[string]string) {
|
m.Cmd(nfs.DIR, nfs.PWD, nfs.DIR_CLI_FIELDS).Tables(func(value ice.Maps) {
|
||||||
bin := m.Cmd(nfs.DIR, path.Join(value[nfs.PATH], ice.BIN), nfs.DIR_CLI_FIELDS).Append(nfs.PATH)
|
bin := m.Cmd(nfs.DIR, path.Join(value[nfs.PATH], ice.BIN), nfs.DIR_CLI_FIELDS).Append(nfs.PATH)
|
||||||
if bin == "" {
|
if bin == "" {
|
||||||
bin = m.Cmd(nfs.DIR, path.Join(value[nfs.PATH], "sbin"), nfs.DIR_CLI_FIELDS).Append(nfs.PATH)
|
bin = m.Cmd(nfs.DIR, path.Join(value[nfs.PATH], "sbin"), nfs.DIR_CLI_FIELDS).Append(nfs.PATH)
|
||||||
|
@ -85,12 +85,12 @@ const (
|
|||||||
const SERVER = "server"
|
const SERVER = "server"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
SERVER: {Name: SERVER, Help: "服务器", Value: kit.Data(
|
SERVER: {Name: SERVER, Help: "服务器", Value: kit.Data(
|
||||||
mdb.FIELD, "time,hash,status,type,name,host,port,error,nconn",
|
mdb.FIELD, "time,hash,status,type,name,host,port,error,nconn",
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
SERVER: {Name: "server hash auto prunes", Help: "服务器", Action: ice.MergeAction(map[string]*ice.Action{
|
SERVER: {Name: "server hash auto prunes", Help: "服务器", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Richs(SERVER, "", mdb.FOREACH, func(key string, value ice.Map) {
|
m.Richs(SERVER, "", mdb.FOREACH, func(key string, value ice.Map) {
|
||||||
kit.Value(value, kit.Keym(STATUS), CLOSE)
|
kit.Value(value, kit.Keym(STATUS), CLOSE)
|
||||||
@ -101,7 +101,7 @@ func init() {
|
|||||||
_server_listen(m, arg...)
|
_server_listen(m, arg...)
|
||||||
}},
|
}},
|
||||||
}, mdb.HashActionStatus()), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.HashActionStatus()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.HashSelect(m, arg...).Table(func(index int, value map[string]string, head []string) {
|
mdb.HashSelect(m, arg...).Table(func(index int, value ice.Maps, head []string) {
|
||||||
m.PushButton(kit.Select("", mdb.REMOVE, value[STATUS] == CLOSE))
|
m.PushButton(kit.Select("", mdb.REMOVE, value[STATUS] == CLOSE))
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
|
@ -46,7 +46,7 @@ func _serve_udp(m *ice.Message, host, port string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if remote, err := net.ResolveUDPAddr("udp4", kit.Format("%s:%s", msg.Option(tcp.HOST), msg.Option(tcp.PORT))); err == nil {
|
if remote, err := net.ResolveUDPAddr("udp4", kit.Format("%s:%s", msg.Option(tcp.HOST), msg.Option(tcp.PORT))); err == nil {
|
||||||
m.Cmd(BROAD).Table(func(index int, value map[string]string, head []string) {
|
m.Cmd(BROAD).Table(func(index int, value ice.Maps, head []string) {
|
||||||
m.Debug("broad %v to %v", kit.Format(value), kit.Format(remote))
|
m.Debug("broad %v to %v", kit.Format(value), kit.Format(remote))
|
||||||
s.WriteToUDP([]byte(m.Spawn(value).FormatMeta()), remote)
|
s.WriteToUDP([]byte(m.Spawn(value).FormatMeta()), remote)
|
||||||
})
|
})
|
||||||
@ -69,8 +69,8 @@ func _broad_search(m *ice.Message, kind, name, text string, arg ...string) {
|
|||||||
const BROAD = "broad"
|
const BROAD = "broad"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
BROAD: {Name: "broad hash auto", Help: "广播", Action: ice.MergeAction(map[string]*ice.Action{
|
BROAD: {Name: "broad hash auto", Help: "广播", Actions: ice.MergeAction(ice.Actions{
|
||||||
SERVE: {Name: "broad port=9020", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
SERVE: {Name: "broad port=9020", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_serve_udp(m, m.Cmd(tcp.HOST).Append("ip"), m.Option(tcp.PORT))
|
_serve_udp(m, m.Cmd(tcp.HOST).Append("ip"), m.Option(tcp.PORT))
|
||||||
}},
|
}},
|
||||||
|
@ -41,7 +41,7 @@ func _cache_save(m *ice.Message, kind, name, text string, arg ...string) { // fi
|
|||||||
m.Push(mdb.DATA, h)
|
m.Push(mdb.DATA, h)
|
||||||
}
|
}
|
||||||
func _cache_watch(m *ice.Message, key, file string) {
|
func _cache_watch(m *ice.Message, key, file string) {
|
||||||
mdb.HashSelect(m.Spawn(), key).Table(func(index int, value map[string]string, head []string) {
|
mdb.HashSelect(m.Spawn(), key).Table(func(index int, value ice.Maps, head []string) {
|
||||||
if value[nfs.FILE] == "" {
|
if value[nfs.FILE] == "" {
|
||||||
m.Cmdy(nfs.SAVE, file, value[mdb.TEXT])
|
m.Cmdy(nfs.SAVE, file, value[mdb.TEXT])
|
||||||
} else {
|
} else {
|
||||||
@ -135,13 +135,13 @@ const (
|
|||||||
const CACHE = "cache"
|
const CACHE = "cache"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
CACHE: {Name: CACHE, Help: "缓存池", Value: kit.Data(
|
CACHE: {Name: CACHE, Help: "缓存池", Value: kit.Data(
|
||||||
mdb.SHORT, mdb.TEXT, mdb.FIELD, "time,hash,size,type,name,text",
|
mdb.SHORT, mdb.TEXT, mdb.FIELD, "time,hash,size,type,name,text",
|
||||||
mdb.STORE, ice.VAR_DATA, nfs.PATH, ice.VAR_FILE, mdb.FSIZE, "200000",
|
mdb.STORE, ice.VAR_DATA, nfs.PATH, ice.VAR_FILE, mdb.FSIZE, "200000",
|
||||||
mdb.LIMIT, "50", mdb.LEAST, "30",
|
mdb.LIMIT, "50", mdb.LEAST, "30",
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
"/cache/": {Name: "/cache/", Help: "缓存池", Hand: func(m *ice.Message, arg ...string) {
|
"/cache/": {Name: "/cache/", Help: "缓存池", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Richs(CACHE, nil, arg[0], func(key string, value ice.Map) {
|
m.Richs(CACHE, nil, arg[0], func(key string, value ice.Map) {
|
||||||
if kit.Format(value[nfs.FILE]) == "" {
|
if kit.Format(value[nfs.FILE]) == "" {
|
||||||
@ -151,7 +151,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
CACHE: {Name: "cache hash auto", Help: "缓存池", Action: ice.MergeAction(map[string]*ice.Action{
|
CACHE: {Name: "cache hash auto", Help: "缓存池", Actions: ice.MergeAction(ice.Actions{
|
||||||
WATCH: {Name: "watch key file", Help: "释放", Hand: func(m *ice.Message, arg ...string) {
|
WATCH: {Name: "watch key file", Help: "释放", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_cache_watch(m, arg[0], arg[1])
|
_cache_watch(m, arg[0], arg[1])
|
||||||
}},
|
}},
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func _dream_list(m *ice.Message) *ice.Message {
|
func _dream_list(m *ice.Message) *ice.Message {
|
||||||
return m.Cmdy(nfs.DIR, m.Config(nfs.PATH), "time,size,name").Table(func(index int, value map[string]string, head []string) {
|
return m.Cmdy(nfs.DIR, m.Config(nfs.PATH), "time,size,name").Table(func(index int, value ice.Maps, head []string) {
|
||||||
if m.Richs(SPACE, nil, value[mdb.NAME], func(key string, val ice.Map) {
|
if m.Richs(SPACE, nil, value[mdb.NAME], func(key string, val ice.Map) {
|
||||||
m.Push(mdb.TYPE, val[mdb.TYPE])
|
m.Push(mdb.TYPE, val[mdb.TYPE])
|
||||||
m.Push(cli.STATUS, cli.START)
|
m.Push(cli.STATUS, cli.START)
|
||||||
@ -102,8 +102,8 @@ const (
|
|||||||
const DREAM = "dream"
|
const DREAM = "dream"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
DREAM: {Name: "dream name path auto start", Help: "梦想家", Action: map[string]*ice.Action{
|
DREAM: {Name: "dream name path auto start", Help: "梦想家", Actions: ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Config("miss", _dream_miss)
|
m.Config("miss", _dream_miss)
|
||||||
}},
|
}},
|
||||||
@ -143,7 +143,7 @@ func init() {
|
|||||||
}, Hand: func(m *ice.Message, arg ...string) {
|
}, Hand: func(m *ice.Message, arg ...string) {
|
||||||
if start := 0; len(arg) == 0 {
|
if start := 0; len(arg) == 0 {
|
||||||
_dream_list(m).SetAppend(mdb.TEXT)
|
_dream_list(m).SetAppend(mdb.TEXT)
|
||||||
m.Table(func(index int, value map[string]string, head []string) {
|
m.Table(func(index int, value ice.Maps, head []string) {
|
||||||
if value[cli.STATUS] != cli.START {
|
if value[cli.STATUS] != cli.START {
|
||||||
m.Push(mdb.TEXT, "")
|
m.Push(mdb.TEXT, "")
|
||||||
return
|
return
|
||||||
@ -170,7 +170,7 @@ func init() {
|
|||||||
m.Option(nfs.DIR_ROOT, path.Join(m.Config(nfs.PATH), arg[0]))
|
m.Option(nfs.DIR_ROOT, path.Join(m.Config(nfs.PATH), arg[0]))
|
||||||
m.Cmdy(nfs.CAT, arg[1:])
|
m.Cmdy(nfs.CAT, arg[1:])
|
||||||
}},
|
}},
|
||||||
}, Configs: map[string]*ice.Config{
|
}, Configs: ice.Configs{
|
||||||
DREAM: {Name: DREAM, Help: "梦想家", Value: kit.Data(nfs.PATH, ice.USR_LOCAL_WORK, "miss", _dream_miss)},
|
DREAM: {Name: DREAM, Help: "梦想家", Value: kit.Data(nfs.PATH, ice.USR_LOCAL_WORK, "miss", _dream_miss)},
|
||||||
}})
|
}})
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ func _route_travel(m *ice.Message, route string) {
|
|||||||
return // 避免循环
|
return // 避免循环
|
||||||
}
|
}
|
||||||
|
|
||||||
m.Cmd(SPACE, val[mdb.NAME], ROUTE).Table(func(index int, value map[string]string, head []string) {
|
m.Cmd(SPACE, val[mdb.NAME], ROUTE).Table(func(index int, value ice.Maps, head []string) {
|
||||||
m.Push(mdb.TYPE, value[mdb.TYPE])
|
m.Push(mdb.TYPE, value[mdb.TYPE])
|
||||||
m.Push(ROUTE, kit.Keys(val[mdb.NAME], value[ROUTE]))
|
m.Push(ROUTE, kit.Keys(val[mdb.NAME], value[ROUTE]))
|
||||||
})
|
})
|
||||||
@ -32,7 +32,7 @@ func _route_travel(m *ice.Message, route string) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
func _route_list(m *ice.Message) {
|
func _route_list(m *ice.Message) {
|
||||||
m.Table(func(index int, value map[string]string, field []string) {
|
m.Table(func(index int, value ice.Maps, field []string) {
|
||||||
m.PushAnchor(value[ROUTE], m.MergePod(value[ROUTE]))
|
m.PushAnchor(value[ROUTE], m.MergePod(value[ROUTE]))
|
||||||
|
|
||||||
switch value[mdb.TYPE] {
|
switch value[mdb.TYPE] {
|
||||||
@ -47,7 +47,7 @@ func _route_list(m *ice.Message) {
|
|||||||
|
|
||||||
// 网卡信息
|
// 网卡信息
|
||||||
u := kit.ParseURL(m.Option(ice.MSG_USERWEB))
|
u := kit.ParseURL(m.Option(ice.MSG_USERWEB))
|
||||||
m.Cmd(tcp.HOST).Table(func(index int, value map[string]string, head []string) {
|
m.Cmd(tcp.HOST).Table(func(index int, value ice.Maps, head []string) {
|
||||||
m.Push(mdb.TYPE, MYSELF)
|
m.Push(mdb.TYPE, MYSELF)
|
||||||
m.Push(ROUTE, ice.Info.NodeName)
|
m.Push(ROUTE, ice.Info.NodeName)
|
||||||
m.PushAnchor(value[aaa.IP], kit.Format("%s://%s:%s", u.Scheme, value[aaa.IP], u.Port()))
|
m.PushAnchor(value[aaa.IP], kit.Format("%s://%s:%s", u.Scheme, value[aaa.IP], u.Port()))
|
||||||
@ -64,10 +64,10 @@ func _route_list(m *ice.Message) {
|
|||||||
const ROUTE = "route"
|
const ROUTE = "route"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
ROUTE: {Name: ROUTE, Help: "路由器", Value: kit.Data(mdb.SHORT, ROUTE)},
|
ROUTE: {Name: ROUTE, Help: "路由器", Value: kit.Data(mdb.SHORT, ROUTE)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
ROUTE: {Name: "route route ctx cmd auto invite spide", Help: "路由器", Action: map[string]*ice.Action{
|
ROUTE: {Name: "route route ctx cmd auto invite spide", Help: "路由器", Actions: ice.Actions{
|
||||||
aaa.INVITE: {Name: "invite", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
aaa.INVITE: {Name: "invite", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(SPACE, m.Option(ROUTE), SPACE, aaa.INVITE, arg)
|
m.Cmdy(SPACE, m.Option(ROUTE), SPACE, aaa.INVITE, arg)
|
||||||
m.ProcessInner()
|
m.ProcessInner()
|
||||||
@ -106,13 +106,13 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if len(arg) == 1 || arg[1] == "" { // 模块列表
|
} else if len(arg) == 1 || arg[1] == "" { // 模块列表
|
||||||
m.Cmd(SPACE, arg[0], ctx.CONTEXT, ice.ICE).Table(func(index int, value map[string]string, head []string) {
|
m.Cmd(SPACE, arg[0], ctx.CONTEXT, ice.ICE).Table(func(index int, value ice.Maps, head []string) {
|
||||||
m.Push(ice.CTX, kit.Keys(value["ups"], value[mdb.NAME]))
|
m.Push(ice.CTX, kit.Keys(value["ups"], value[mdb.NAME]))
|
||||||
m.Push("", value, kit.List(ice.CTX_STATUS, ice.CTX_STREAM, mdb.HELP))
|
m.Push("", value, kit.List(ice.CTX_STATUS, ice.CTX_STREAM, mdb.HELP))
|
||||||
})
|
})
|
||||||
|
|
||||||
} else if len(arg) == 2 || arg[2] == "" { // 命令列表
|
} else if len(arg) == 2 || arg[2] == "" { // 命令列表
|
||||||
m.Cmd(SPACE, arg[0], ctx.CONTEXT, arg[1], ctx.COMMAND).Table(func(index int, value map[string]string, head []string) {
|
m.Cmd(SPACE, arg[0], ctx.CONTEXT, arg[1], ctx.COMMAND).Table(func(index int, value ice.Maps, head []string) {
|
||||||
m.Push(ice.CMD, value[mdb.KEY])
|
m.Push(ice.CMD, value[mdb.KEY])
|
||||||
m.Push("", value, kit.List(mdb.NAME, mdb.HELP))
|
m.Push("", value, kit.List(mdb.NAME, mdb.HELP))
|
||||||
})
|
})
|
||||||
|
@ -275,7 +275,7 @@ const (
|
|||||||
const SERVE = "serve"
|
const SERVE = "serve"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
SERVE: {Name: SERVE, Help: "服务器", Value: kit.Data(
|
SERVE: {Name: SERVE, Help: "服务器", Value: kit.Data(
|
||||||
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,status,name,port,dev",
|
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,status,name,port,dev",
|
||||||
tcp.LOCALHOST, ice.TRUE, aaa.BLACK, kit.Dict(), aaa.WHITE, kit.Dict(
|
tcp.LOCALHOST, ice.TRUE, aaa.BLACK, kit.Dict(), aaa.WHITE, kit.Dict(
|
||||||
@ -294,8 +294,8 @@ func init() {
|
|||||||
nfs.REPOS, "https://shylinux.com/x/intshell", nfs.BRANCH, nfs.MASTER,
|
nfs.REPOS, "https://shylinux.com/x/intshell", nfs.BRANCH, nfs.MASTER,
|
||||||
), ice.REQUIRE, ".ish/pluged",
|
), ice.REQUIRE, ".ish/pluged",
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
SERVE: {Name: "serve name auto start spide", Help: "服务器", Action: ice.MergeAction(map[string]*ice.Action{
|
SERVE: {Name: "serve name auto start spide", Help: "服务器", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
cli.NodeInfo(m, WORKER, ice.Info.PathName)
|
cli.NodeInfo(m, WORKER, ice.Info.PathName)
|
||||||
AddRewrite(func(w http.ResponseWriter, r *http.Request) bool {
|
AddRewrite(func(w http.ResponseWriter, r *http.Request) bool {
|
||||||
@ -321,7 +321,7 @@ func init() {
|
|||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(SERVE).Table(func(index int, value map[string]string, head []string) {
|
m.Cmd(SERVE).Table(func(index int, value ice.Maps, head []string) {
|
||||||
m.Done(value[cli.STATUS] == tcp.START)
|
m.Done(value[cli.STATUS] == tcp.START)
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
|
@ -122,12 +122,12 @@ const (
|
|||||||
const SHARE = "share"
|
const SHARE = "share"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
SHARE: {Name: SHARE, Help: "共享链", Value: kit.Data(
|
SHARE: {Name: SHARE, Help: "共享链", Value: kit.Data(
|
||||||
mdb.EXPIRE, "72h", mdb.FIELD, "time,hash,userrole,username,river,storm,type,name,text",
|
mdb.EXPIRE, "72h", mdb.FIELD, "time,hash,userrole,username,river,storm,type,name,text",
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
SHARE: {Name: "share hash auto prunes", Help: "共享链", Action: ice.MergeAction(map[string]*ice.Action{
|
SHARE: {Name: "share hash auto prunes", Help: "共享链", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
ice.AddRender(ice.RENDER_DOWNLOAD, func(msg *ice.Message, cmd string, args ...ice.Any) string {
|
ice.AddRender(ice.RENDER_DOWNLOAD, func(msg *ice.Message, cmd string, args ...ice.Any) string {
|
||||||
list := []string{}
|
list := []string{}
|
||||||
|
@ -220,8 +220,8 @@ func _space_search(m *ice.Message, kind, name, text string, arg ...string) {
|
|||||||
if name != "" {
|
if name != "" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
m.Cmd(SERVE, ice.OptionFields("")).Table(func(index int, val map[string]string, head []string) {
|
m.Cmd(SERVE, ice.OptionFields("")).Table(func(index int, val ice.Maps, head []string) {
|
||||||
m.Cmd(tcp.HOST, ice.OptionFields("")).Table(func(index int, value map[string]string, head []string) {
|
m.Cmd(tcp.HOST, ice.OptionFields("")).Table(func(index int, value ice.Maps, head []string) {
|
||||||
m.PushSearch(kit.SimpleKV("", MYSELF, value[mdb.NAME], kit.Format("http://%s:%s", value[aaa.IP], val[tcp.PORT])))
|
m.PushSearch(kit.SimpleKV("", MYSELF, value[mdb.NAME], kit.Format("http://%s:%s", value[aaa.IP], val[tcp.PORT])))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -289,14 +289,14 @@ const (
|
|||||||
const SPACE = "space"
|
const SPACE = "space"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
SPACE: {Name: SPACE, Help: "空间站", Value: kit.Data(
|
SPACE: {Name: SPACE, Help: "空间站", Value: kit.Data(
|
||||||
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,type,name,text",
|
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,type,name,text",
|
||||||
BUFFER, kit.Dict("r", ice.MOD_BUFS, "w", ice.MOD_BUFS),
|
BUFFER, kit.Dict("r", ice.MOD_BUFS, "w", ice.MOD_BUFS),
|
||||||
REDIAL, kit.Dict("a", 3000, "b", 1000, "c", 1000), TIMEOUT, kit.Dict("c", "180s"),
|
REDIAL, kit.Dict("a", 3000, "b", 1000, "c", 1000), TIMEOUT, kit.Dict("c", "180s"),
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
SPACE: {Name: "space name cmd auto invite", Help: "空间站", Action: ice.MergeAction(map[string]*ice.Action{
|
SPACE: {Name: "space name cmd auto invite", Help: "空间站", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Conf(SPACE, mdb.HASH, "")
|
m.Conf(SPACE, mdb.HASH, "")
|
||||||
}},
|
}},
|
||||||
@ -327,7 +327,7 @@ func init() {
|
|||||||
}, mdb.HashAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.HashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) < 2 { // 节点列表
|
if len(arg) < 2 { // 节点列表
|
||||||
if mdb.HashSelect(m, arg...); len(arg) == 0 {
|
if mdb.HashSelect(m, arg...); len(arg) == 0 {
|
||||||
m.Table(func(index int, value map[string]string, head []string) {
|
m.Table(func(index int, value ice.Maps, head []string) {
|
||||||
switch value[mdb.TYPE] {
|
switch value[mdb.TYPE] {
|
||||||
case MASTER:
|
case MASTER:
|
||||||
m.PushAnchor(value[mdb.NAME], m.Cmd(SPIDE, value[mdb.NAME], ice.OptionFields("")).Append("client.url"))
|
m.PushAnchor(value[mdb.NAME], m.Cmd(SPIDE, value[mdb.NAME], ice.OptionFields("")).Append("client.url"))
|
||||||
|
@ -127,8 +127,8 @@ func _spide_list(m *ice.Message, arg ...string) {
|
|||||||
_spide_save(m, cache, save, uri, res)
|
_spide_save(m, cache, save, uri, res)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
func _spide_body(m *ice.Message, method string, arg ...string) (io.Reader, map[string]string, []string) {
|
func _spide_body(m *ice.Message, method string, arg ...string) (io.Reader, ice.Maps, []string) {
|
||||||
head := map[string]string{}
|
head := ice.Maps{}
|
||||||
body, ok := m.Optionv(SPIDE_BODY).(io.Reader)
|
body, ok := m.Optionv(SPIDE_BODY).(io.Reader)
|
||||||
if !ok && len(arg) > 0 && method != SPIDE_GET {
|
if !ok && len(arg) > 0 && method != SPIDE_GET {
|
||||||
if len(arg) == 1 {
|
if len(arg) == 1 {
|
||||||
@ -216,7 +216,7 @@ func _spide_part(m *ice.Message, arg ...string) (io.Reader, string) {
|
|||||||
}
|
}
|
||||||
return buf, mp.FormDataContentType()
|
return buf, mp.FormDataContentType()
|
||||||
}
|
}
|
||||||
func _spide_head(m *ice.Message, req *http.Request, head map[string]string, value ice.Map) {
|
func _spide_head(m *ice.Message, req *http.Request, head ice.Maps, value ice.Map) {
|
||||||
m.Info("%s %s", req.Method, req.URL)
|
m.Info("%s %s", req.Method, req.URL)
|
||||||
kit.Fetch(value[SPIDE_HEADER], func(key string, value string) {
|
kit.Fetch(value[SPIDE_HEADER], func(key string, value string) {
|
||||||
req.Header.Set(key, value)
|
req.Header.Set(key, value)
|
||||||
@ -331,6 +331,7 @@ const (
|
|||||||
ContentFORM = "application/x-www-form-urlencoded"
|
ContentFORM = "application/x-www-form-urlencoded"
|
||||||
ContentJSON = "application/json"
|
ContentJSON = "application/json"
|
||||||
ContentHTML = "text/html"
|
ContentHTML = "text/html"
|
||||||
|
ContentCSS = "text/css"
|
||||||
ContentPNG = "image/png"
|
ContentPNG = "image/png"
|
||||||
)
|
)
|
||||||
const (
|
const (
|
||||||
@ -353,10 +354,10 @@ const (
|
|||||||
const SPIDE = "spide"
|
const SPIDE = "spide"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
SPIDE: {Name: SPIDE, Help: "蜘蛛侠", Value: kit.Data(mdb.SHORT, CLIENT_NAME, mdb.FIELD, "time,client.name,client.url", LOGHEADERS, ice.FALSE)},
|
SPIDE: {Name: SPIDE, Help: "蜘蛛侠", Value: kit.Data(mdb.SHORT, CLIENT_NAME, mdb.FIELD, "time,client.name,client.url", LOGHEADERS, ice.FALSE)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
SPIDE: {Name: "spide client.name action=raw,msg,save,cache method=GET,PUT,POST,DELETE url format=form,part,json,data,file arg run create", Help: "蜘蛛侠", Action: ice.MergeAction(map[string]*ice.Action{
|
SPIDE: {Name: "spide client.name action=raw,msg,save,cache method=GET,PUT,POST,DELETE url format=form,part,json,data,file arg run create", Help: "蜘蛛侠", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
conf := m.Confm(cli.RUNTIME, "conf")
|
conf := m.Confm(cli.RUNTIME, "conf")
|
||||||
m.Cmd(SPIDE, mdb.CREATE, ice.OPS, kit.Select("http://127.0.0.1:9020", conf["ctx_ops"]))
|
m.Cmd(SPIDE, mdb.CREATE, ice.OPS, kit.Select("http://127.0.0.1:9020", conf["ctx_ops"]))
|
||||||
@ -382,21 +383,21 @@ func init() {
|
|||||||
_spide_list(m, arg...)
|
_spide_list(m, arg...)
|
||||||
}},
|
}},
|
||||||
|
|
||||||
SPIDE_GET: {Name: "GET url key value run", Help: "蜘蛛侠", Action: map[string]*ice.Action{
|
SPIDE_GET: {Name: "GET url key value run", Help: "蜘蛛侠", Actions: ice.Actions{
|
||||||
mdb.REMOVE: {Name: "remove", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
mdb.REMOVE: {Name: "remove", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(mdb.DELETE, SPIDE, "", mdb.HASH, m.OptionSimple(CLIENT_NAME))
|
m.Cmdy(mdb.DELETE, SPIDE, "", mdb.HASH, m.OptionSimple(CLIENT_NAME))
|
||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, arg ...string) {
|
}, Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Echo(kit.Formats(kit.UnMarshal(m.Cmdx(SPIDE, ice.DEV, SPIDE_RAW, SPIDE_GET, arg[0], arg[1:]))))
|
m.Echo(kit.Formats(kit.UnMarshal(m.Cmdx(SPIDE, ice.DEV, SPIDE_RAW, SPIDE_GET, arg[0], arg[1:]))))
|
||||||
}},
|
}},
|
||||||
SPIDE_POST: {Name: "POST url key value run", Help: "蜘蛛侠", Action: map[string]*ice.Action{
|
SPIDE_POST: {Name: "POST url key value run", Help: "蜘蛛侠", Actions: ice.Actions{
|
||||||
mdb.REMOVE: {Name: "remove", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
mdb.REMOVE: {Name: "remove", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(mdb.DELETE, SPIDE, "", mdb.HASH, m.OptionSimple(CLIENT_NAME))
|
m.Cmdy(mdb.DELETE, SPIDE, "", mdb.HASH, m.OptionSimple(CLIENT_NAME))
|
||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, arg ...string) {
|
}, Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Echo(kit.Formats(kit.UnMarshal(m.Cmdx(SPIDE, ice.DEV, SPIDE_RAW, SPIDE_POST, arg[0], arg[1:]))))
|
m.Echo(kit.Formats(kit.UnMarshal(m.Cmdx(SPIDE, ice.DEV, SPIDE_RAW, SPIDE_POST, arg[0], arg[1:]))))
|
||||||
}},
|
}},
|
||||||
SPIDE_DELETE: {Name: "DELETE url key value run", Help: "蜘蛛侠", Action: map[string]*ice.Action{
|
SPIDE_DELETE: {Name: "DELETE url key value run", Help: "蜘蛛侠", Actions: ice.Actions{
|
||||||
mdb.REMOVE: {Name: "remove", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
mdb.REMOVE: {Name: "remove", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(mdb.DELETE, SPIDE, "", mdb.HASH, m.OptionSimple(CLIENT_NAME))
|
m.Cmdy(mdb.DELETE, SPIDE, "", mdb.HASH, m.OptionSimple(CLIENT_NAME))
|
||||||
}},
|
}},
|
||||||
|
@ -162,13 +162,13 @@ const (
|
|||||||
const STORY = "story"
|
const STORY = "story"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
STORY: {Name: "story", Help: "故事会", Value: kit.Dict(
|
STORY: {Name: "story", Help: "故事会", Value: kit.Dict(
|
||||||
mdb.META, kit.Dict(mdb.SHORT, DATA),
|
mdb.META, kit.Dict(mdb.SHORT, DATA),
|
||||||
HEAD, kit.Data(mdb.SHORT, STORY),
|
HEAD, kit.Data(mdb.SHORT, STORY),
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
STORY: {Name: "story story auto", Help: "故事会", Action: map[string]*ice.Action{
|
STORY: {Name: "story story auto", Help: "故事会", Actions: ice.Actions{
|
||||||
WRITE: {Name: "write type name text arg...", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
WRITE: {Name: "write type name text arg...", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_story_write(m, arg[0], arg[1], arg[2], arg[3:]...)
|
_story_write(m, arg[0], arg[1], arg[2], arg[3:]...)
|
||||||
}},
|
}},
|
||||||
@ -260,7 +260,7 @@ func _story_pull(m *ice.Message, arg ...string) {
|
|||||||
pull := end
|
pull := end
|
||||||
var first ice.Map
|
var first ice.Map
|
||||||
for begin != "" && begin != end {
|
for begin != "" && begin != end {
|
||||||
if m.Cmd(SPIDE, arg[2], "msg", "/story/pull", "begin", begin, "end", end).Table(func(index int, value map[string]string, head []string) {
|
if m.Cmd(SPIDE, arg[2], "msg", "/story/pull", "begin", begin, "end", end).Table(func(index int, value ice.Maps, head []string) {
|
||||||
if m.Richs(CACHE, nil, value["data"], nil) == nil {
|
if m.Richs(CACHE, nil, value["data"], nil) == nil {
|
||||||
m.Log(ice.LOG_IMPORT, "%v: %v", value["data"], value["save"])
|
m.Log(ice.LOG_IMPORT, "%v: %v", value["data"], value["save"])
|
||||||
if node := kit.UnMarshal(value["save"]); kit.Format(kit.Value(node, "file")) != "" {
|
if node := kit.UnMarshal(value["save"]); kit.Format(kit.Value(node, "file")) != "" {
|
||||||
@ -404,7 +404,7 @@ func _story_commit(m *ice.Message, arg ...string) {
|
|||||||
arg[2] = m.Cmdx(STORY, "add", "submit", arg[2], "hostname,username")
|
arg[2] = m.Cmdx(STORY, "add", "submit", arg[2], "hostname,username")
|
||||||
|
|
||||||
// 节点信息
|
// 节点信息
|
||||||
menu := map[string]string{}
|
menu := ice.Maps{}
|
||||||
for i := 3; i < len(arg); i++ {
|
for i := 3; i < len(arg); i++ {
|
||||||
menu[arg[i]] = m.Cmdx(STORY, INDEX, arg[i])
|
menu[arg[i]] = m.Cmdx(STORY, INDEX, arg[i])
|
||||||
}
|
}
|
||||||
|
@ -344,10 +344,10 @@ const (
|
|||||||
const MATRIX = "matrix"
|
const MATRIX = "matrix"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
MATRIX: {Name: MATRIX, Help: "魔方矩阵", Value: kit.Data(mdb.SHORT, mdb.NAME)},
|
MATRIX: {Name: MATRIX, Help: "魔方矩阵", Value: kit.Data(mdb.SHORT, mdb.NAME)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
MATRIX: {Name: "matrix name npage text auto", Help: "魔方矩阵", Action: map[string]*ice.Action{
|
MATRIX: {Name: "matrix name npage text auto", Help: "魔方矩阵", Actions: ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { _yac_load(m) }},
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { _yac_load(m) }},
|
||||||
mdb.CREATE: {Name: "create name=shy nlang=32 ncell=32", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create name=shy nlang=32 ncell=32", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||||
mat := NewMatrix(m, kit.Int(kit.Select("32", m.Option(NLANG))), kit.Int(kit.Select("32", m.Option(NCELL))))
|
mat := NewMatrix(m, kit.Int(kit.Select("32", m.Option(NLANG))), kit.Int(kit.Select("32", m.Option(NCELL))))
|
||||||
|
@ -16,7 +16,7 @@ type frame struct {
|
|||||||
pos int
|
pos int
|
||||||
key string
|
key string
|
||||||
skip bool
|
skip bool
|
||||||
data map[string]string
|
data ice.Maps
|
||||||
}
|
}
|
||||||
type stack struct {
|
type stack struct {
|
||||||
fs []*frame
|
fs []*frame
|
||||||
@ -24,7 +24,7 @@ type stack struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *stack) push(f *frame) *stack {
|
func (s *stack) push(f *frame) *stack {
|
||||||
f.data = map[string]string{}
|
f.data = ice.Maps{}
|
||||||
s.fs = append(s.fs, f)
|
s.fs = append(s.fs, f)
|
||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
@ -95,8 +95,8 @@ func _exp_true(m *ice.Message, arg string) bool {
|
|||||||
const SCRIPT = "script"
|
const SCRIPT = "script"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
SCRIPT: {Name: "script name npage text auto create", Help: "脚本解析", Action: map[string]*ice.Action{
|
SCRIPT: {Name: "script name npage text auto create", Help: "脚本解析", Actions: ice.Actions{
|
||||||
mdb.CREATE: {Name: "create name=shy text=etc/yac.txt", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create name=shy text=etc/yac.txt", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(MATRIX, mdb.CREATE, m.Option(mdb.NAME))
|
m.Cmd(MATRIX, mdb.CREATE, m.Option(mdb.NAME))
|
||||||
if buf, err := ioutil.ReadFile(m.Option(mdb.TEXT)); err == nil {
|
if buf, err := ioutil.ReadFile(m.Option(mdb.TEXT)); err == nil {
|
||||||
@ -206,7 +206,7 @@ func init() {
|
|||||||
m.Option("stack", stack)
|
m.Option("stack", stack)
|
||||||
m.Cmdy(MATRIX, PARSE, arg[0], arg[1], arg[2], func(nhash string, hash int, word []string, begin int, stream *lex.Stream) (int, []string) {
|
m.Cmdy(MATRIX, PARSE, arg[0], arg[1], arg[2], func(nhash string, hash int, word []string, begin int, stream *lex.Stream) (int, []string) {
|
||||||
m.Option("stream", stream)
|
m.Option("stream", stream)
|
||||||
if _, ok := m.Target().Commands[SCRIPT].Action[nhash]; ok && stack.can_run(nhash) {
|
if _, ok := m.Target().Commands[SCRIPT].Actions[nhash]; ok && stack.can_run(nhash) {
|
||||||
msg := m.Cmd(SCRIPT, nhash, word, ice.Option{"begin", begin})
|
msg := m.Cmd(SCRIPT, nhash, word, ice.Option{"begin", begin})
|
||||||
return hash, msg.Resultv()
|
return hash, msg.Resultv()
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ func _action_key(m *ice.Message, arg ...string) string {
|
|||||||
return kit.Keys(mdb.HASH, kit.Select(m.Option(RIVER), arg, 0), STORM, mdb.HASH, kit.Select(m.Option(STORM), arg, 1))
|
return kit.Keys(mdb.HASH, kit.Select(m.Option(RIVER), arg, 0), STORM, mdb.HASH, kit.Select(m.Option(STORM), arg, 1))
|
||||||
}
|
}
|
||||||
func _action_list(m *ice.Message, river, storm string) {
|
func _action_list(m *ice.Message, river, storm string) {
|
||||||
m.Cmdy(STORM, storm, ice.Option{ice.MSG_RIVER, river}).Table(func(index int, value map[string]string, head []string) {
|
m.Cmdy(STORM, storm, ice.Option{ice.MSG_RIVER, river}).Table(func(index int, value ice.Maps, head []string) {
|
||||||
m.Cmdy(m.Space(kit.Select(m.Option(ice.POD), value[ice.POD])), ctx.COMMAND, kit.Keys(value[ice.CTX], value[ice.CMD]))
|
m.Cmdy(m.Space(kit.Select(m.Option(ice.POD), value[ice.POD])), ctx.COMMAND, kit.Keys(value[ice.CTX], value[ice.CMD]))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -146,8 +146,8 @@ const (
|
|||||||
const ACTION = "action"
|
const ACTION = "action"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
web.P(ACTION): {Name: "/action river storm action arg...", Help: "工作台", Action: ice.MergeAction(map[string]*ice.Action{
|
web.P(ACTION): {Name: "/action river storm action arg...", Help: "工作台", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
for _, cmd := range []string{
|
for _, cmd := range []string{
|
||||||
"web.chat.meet.miss",
|
"web.chat.meet.miss",
|
||||||
|
@ -51,10 +51,10 @@ func _cmd_file(m *ice.Message, arg ...string) bool {
|
|||||||
const CMD = "cmd"
|
const CMD = "cmd"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
CMD: {Name: CMD, Help: "命令", Value: kit.Data(mdb.SHORT, "type", nfs.PATH, nfs.PWD)},
|
CMD: {Name: CMD, Help: "命令", Value: kit.Data(mdb.SHORT, "type", nfs.PATH, nfs.PWD)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
"/cmd/": {Name: "/cmd/", Help: "命令", Action: ice.MergeAction(map[string]*ice.Action{
|
"/cmd/": {Name: "/cmd/", Help: "命令", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Name: "_init", Help: "初始化", Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Name: "_init", Help: "初始化", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(CMD, mdb.CREATE, mdb.TYPE, "shy", mdb.NAME, "web.wiki.word")
|
m.Cmdy(CMD, mdb.CREATE, mdb.TYPE, "shy", mdb.NAME, "web.wiki.word")
|
||||||
m.Cmdy(CMD, mdb.CREATE, mdb.TYPE, "svg", mdb.NAME, "web.wiki.draw")
|
m.Cmdy(CMD, mdb.CREATE, mdb.TYPE, "svg", mdb.NAME, "web.wiki.draw")
|
||||||
@ -84,7 +84,7 @@ func init() {
|
|||||||
m.RenderDownload(path.Join(m.Config(nfs.PATH), path.Join(arg...))) // 文件
|
m.RenderDownload(path.Join(m.Config(nfs.PATH), path.Join(arg...))) // 文件
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
CMD: {Name: "cmd path auto upload up home", Help: "命令", Action: ice.MergeAction(map[string]*ice.Action{
|
CMD: {Name: "cmd path auto upload up home", Help: "命令", Actions: ice.MergeAction(ice.Actions{
|
||||||
web.UPLOAD: {Name: "upload", Help: "上传", Hand: func(m *ice.Message, arg ...string) {
|
web.UPLOAD: {Name: "upload", Help: "上传", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Upload(path.Join(m.Config(nfs.PATH), strings.TrimPrefix(path.Dir(m.R.URL.Path), "/cmd")))
|
m.Upload(path.Join(m.Config(nfs.PATH), strings.TrimPrefix(path.Dir(m.R.URL.Path), "/cmd")))
|
||||||
}},
|
}},
|
||||||
|
@ -25,13 +25,13 @@ func _div_parse(m *ice.Message, text string) string {
|
|||||||
const DIV = "div"
|
const DIV = "div"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
DIV: {Name: "div", Help: "定制", Value: kit.Data(
|
DIV: {Name: "div", Help: "定制", Value: kit.Data(
|
||||||
mdb.FIELD, "time,hash,type,name,text", nfs.PATH, ice.USR_PUBLISH,
|
mdb.FIELD, "time,hash,type,name,text", nfs.PATH, ice.USR_PUBLISH,
|
||||||
nfs.TEMPLATE, _div_template,
|
nfs.TEMPLATE, _div_template,
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
"/div/": {Name: "/div/", Help: "定制", Action: ice.MergeAction(ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
"/div/": {Name: "/div/", Help: "定制", Actions: ice.MergeAction(ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch p := path.Join(arg...); kit.Ext(kit.Select("", p)) {
|
switch p := path.Join(arg...); kit.Ext(kit.Select("", p)) {
|
||||||
case nfs.HTML:
|
case nfs.HTML:
|
||||||
m.RenderDownload(p)
|
m.RenderDownload(p)
|
||||||
@ -45,7 +45,7 @@ func init() {
|
|||||||
m.RenderCmd(m.PrefixKey(), p)
|
m.RenderCmd(m.PrefixKey(), p)
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
DIV: {Name: "div hash auto import", Help: "定制", Action: ice.MergeAction(map[string]*ice.Action{
|
DIV: {Name: "div hash auto import", Help: "定制", Actions: ice.MergeAction(ice.Actions{
|
||||||
lex.SPLIT: {Name: "split name=hi text", Help: "生成", Hand: func(m *ice.Message, arg ...string) {
|
lex.SPLIT: {Name: "split name=hi text", Help: "生成", Hand: func(m *ice.Message, arg ...string) {
|
||||||
h := m.Cmdx(DIV, mdb.CREATE, m.OptionSimple(mdb.NAME), mdb.TEXT, _div_parse(m, m.Option(mdb.TEXT)))
|
h := m.Cmdx(DIV, mdb.CREATE, m.OptionSimple(mdb.NAME), mdb.TEXT, _div_parse(m, m.Option(mdb.TEXT)))
|
||||||
m.ProcessRewrite(mdb.HASH, h)
|
m.ProcessRewrite(mdb.HASH, h)
|
||||||
|
@ -11,12 +11,12 @@ import (
|
|||||||
const FILES = "files"
|
const FILES = "files"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
FILES: {Name: FILES, Help: "文件夹", Value: kit.Data(
|
FILES: {Name: FILES, Help: "文件夹", Value: kit.Data(
|
||||||
mdb.SHORT, mdb.DATA, mdb.FIELD, "time,hash,type,name,size,data",
|
mdb.SHORT, mdb.DATA, mdb.FIELD, "time,hash,type,name,size,data",
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
FILES: {Name: "files hash auto upload", Help: "文件夹", Action: ice.MergeAction(map[string]*ice.Action{
|
FILES: {Name: "files hash auto upload", Help: "文件夹", Actions: ice.MergeAction(ice.Actions{
|
||||||
web.UPLOAD: {Name: "upload", Help: "上传", Hand: func(m *ice.Message, arg ...string) {
|
web.UPLOAD: {Name: "upload", Help: "上传", Hand: func(m *ice.Message, arg ...string) {
|
||||||
up := kit.Simple(m.Optionv(ice.MSG_UPLOAD))
|
up := kit.Simple(m.Optionv(ice.MSG_UPLOAD))
|
||||||
if len(up) < 2 {
|
if len(up) < 2 {
|
||||||
@ -27,7 +27,7 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
}, mdb.HashAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.HashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.HashSelect(m, arg...)
|
mdb.HashSelect(m, arg...)
|
||||||
m.Table(func(index int, value map[string]string, head []string) {
|
m.Table(func(index int, value ice.Maps, head []string) {
|
||||||
link := web.SHARE_CACHE + value[mdb.DATA]
|
link := web.SHARE_CACHE + value[mdb.DATA]
|
||||||
if m.PushDownload(mdb.LINK, value[mdb.NAME], link); len(arg) > 0 && kit.ExtIsImage(value[mdb.NAME]) {
|
if m.PushDownload(mdb.LINK, value[mdb.NAME], link); len(arg) > 0 && kit.ExtIsImage(value[mdb.NAME]) {
|
||||||
m.PushImages("image", link)
|
m.PushImages("image", link)
|
||||||
|
@ -14,10 +14,10 @@ const (
|
|||||||
const FOOTER = "footer"
|
const FOOTER = "footer"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
FOOTER: {Name: FOOTER, Help: "状态栏", Value: kit.Dict(LEGAL, kit.List(`<a href="mailto:shylinuxc@gmail.com">shylinuxc@gmail.com</a>`))},
|
FOOTER: {Name: FOOTER, Help: "状态栏", Value: kit.Dict(LEGAL, kit.List(`<a href="mailto:shylinuxc@gmail.com">shylinuxc@gmail.com</a>`))},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
web.P(FOOTER): {Name: "/footer", Help: "状态栏", Action: ice.MergeAction(map[string]*ice.Action{
|
web.P(FOOTER): {Name: "/footer", Help: "状态栏", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.RUN: {Name: "run", Help: "执行", Hand: func(m *ice.Message, arg ...string) {
|
ice.RUN: {Name: "run", Help: "执行", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Cmdy(arg); m.Result(1) == ice.ErrNotFound {
|
if m.Cmdy(arg); m.Result(1) == ice.ErrNotFound {
|
||||||
m.Set(ice.MSG_RESULT).Cmdy(cli.SYSTEM, arg)
|
m.Set(ice.MSG_RESULT).Cmdy(cli.SYSTEM, arg)
|
||||||
|
@ -10,8 +10,8 @@ import (
|
|||||||
const GRANT = "grant"
|
const GRANT = "grant"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
GRANT: {Name: "grant space id auto insert", Help: "授权", Action: ice.MergeAction(map[string]*ice.Action{
|
GRANT: {Name: "grant space id auto insert", Help: "授权", Actions: ice.MergeAction(ice.Actions{
|
||||||
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case web.SPACE:
|
case web.SPACE:
|
||||||
|
@ -20,6 +20,12 @@ func _header_agent(m *ice.Message, arg ...string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
func _header_check(m *ice.Message, arg ...string) bool {
|
func _header_check(m *ice.Message, arg ...string) bool {
|
||||||
|
if m.Option(web.SHARE) != "" {
|
||||||
|
m.Cmd(web.SHARE, m.Option(web.SHARE), ice.OptionFields("")).Tables(func(value ice.Maps) {
|
||||||
|
m.Option(ice.MSG_USERNAME, value["username"])
|
||||||
|
m.Option(ice.MSG_USERROLE, value["userrole"])
|
||||||
|
})
|
||||||
|
}
|
||||||
if m.Option(ice.MSG_USERNAME) != "" {
|
if m.Option(ice.MSG_USERNAME) != "" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -49,7 +55,6 @@ func _header_users(m *ice.Message, key string, arg ...string) {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
TITLE = "title"
|
TITLE = "title"
|
||||||
TOPIC = "topic"
|
|
||||||
MENUS = "menus"
|
MENUS = "menus"
|
||||||
TRANS = "trans"
|
TRANS = "trans"
|
||||||
AGENT = "agent"
|
AGENT = "agent"
|
||||||
@ -59,9 +64,9 @@ const (
|
|||||||
const HEADER = "header"
|
const HEADER = "header"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
HEADER: {Name: HEADER, Help: "标题栏", Value: kit.Data(aaa.LOGIN, kit.List("登录", "扫码"))},
|
HEADER: {Name: HEADER, Help: "标题栏", Value: kit.Data(aaa.LOGIN, kit.List("登录", "扫码"))},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
web.WEB_LOGIN: {Hand: func(m *ice.Message, arg ...string) {
|
web.WEB_LOGIN: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case "/header":
|
case "/header":
|
||||||
@ -75,7 +80,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
m.Warn(m.Option(ice.MSG_USERNAME) == "", ice.ErrNotLogin, arg)
|
m.Warn(m.Option(ice.MSG_USERNAME) == "", ice.ErrNotLogin, arg)
|
||||||
}},
|
}},
|
||||||
web.P(HEADER): {Name: "/header", Help: "标题栏", Action: map[string]*ice.Action{
|
web.P(HEADER): {Name: "/header", Help: "标题栏", Actions: ice.Actions{
|
||||||
AGENT: {Name: "agent", Help: "宿主应用", Hand: func(m *ice.Message, arg ...string) {
|
AGENT: {Name: "agent", Help: "宿主应用", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_header_agent(m, arg...)
|
_header_agent(m, arg...)
|
||||||
}},
|
}},
|
||||||
|
@ -8,8 +8,8 @@ import (
|
|||||||
const INFO = "info"
|
const INFO = "info"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
INFO: {Name: "info auto", Help: "信息", Action: map[string]*ice.Action{
|
INFO: {Name: "info auto", Help: "信息", Actions: ice.Actions{
|
||||||
mdb.MODIFY: {Name: "modify", Help: "编辑", Hand: func(m *ice.Message, arg ...string) {
|
mdb.MODIFY: {Name: "modify", Help: "编辑", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(mdb.MODIFY, RIVER, "", mdb.HASH, mdb.HASH, m.Option(ice.MSG_RIVER), arg)
|
m.Cmdy(mdb.MODIFY, RIVER, "", mdb.HASH, mdb.HASH, m.Option(ice.MSG_RIVER), arg)
|
||||||
}},
|
}},
|
||||||
|
@ -15,7 +15,7 @@ func distance(lat1, long1, lat2, long2 float64) float64 {
|
|||||||
long2 = long2 * math.Pi / 180
|
long2 = long2 * math.Pi / 180
|
||||||
return 2 * 6371 * math.Asin(math.Sqrt(math.Pow(math.Sin(math.Abs(lat1-lat2)/2), 2)+math.Cos(lat1)*math.Cos(lat2)*math.Pow(math.Sin(math.Abs(long1-long2)/2), 2)))
|
return 2 * 6371 * math.Asin(math.Sqrt(math.Pow(math.Sin(math.Abs(lat1-lat2)/2), 2)+math.Cos(lat1)*math.Cos(lat2)*math.Pow(math.Sin(math.Abs(long1-long2)/2), 2)))
|
||||||
}
|
}
|
||||||
func _trans(arg []string, tr map[string]string) {
|
func _trans(arg []string, tr ice.Maps) {
|
||||||
for i := 0; i < len(arg)-1; i += 2 {
|
for i := 0; i < len(arg)-1; i += 2 {
|
||||||
arg[i] = kit.Select(arg[i], tr[arg[i]])
|
arg[i] = kit.Select(arg[i], tr[arg[i]])
|
||||||
}
|
}
|
||||||
@ -32,12 +32,12 @@ const (
|
|||||||
const LOCATION = "location"
|
const LOCATION = "location"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
LOCATION: {Name: LOCATION, Help: "地理位置", Value: kit.Data(
|
LOCATION: {Name: LOCATION, Help: "地理位置", Value: kit.Data(
|
||||||
mdb.SHORT, mdb.TEXT, mdb.FIELD, "time,hash,type,name,text,longitude,latitude",
|
mdb.SHORT, mdb.TEXT, mdb.FIELD, "time,hash,type,name,text,longitude,latitude",
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
LOCATION: {Name: "location hash auto getLocation", Help: "地理位置", Action: ice.MergeAction(map[string]*ice.Action{
|
LOCATION: {Name: "location hash auto getLocation", Help: "地理位置", Actions: ice.MergeAction(ice.Actions{
|
||||||
OPENLOCATION: {Name: "location", Help: "地图"},
|
OPENLOCATION: {Name: "location", Help: "地图"},
|
||||||
GETLOCATION: {Name: "location create", Help: "打卡"},
|
GETLOCATION: {Name: "location create", Help: "打卡"},
|
||||||
mdb.CREATE: {Name: "create type=text name text latitude longitude", Help: "添加"},
|
mdb.CREATE: {Name: "create type=text name text latitude longitude", Help: "添加"},
|
||||||
|
@ -12,12 +12,12 @@ const (
|
|||||||
const MISS = "miss"
|
const MISS = "miss"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Register(&ice.Context{Name: MEET, Help: "遇见", Configs: map[string]*ice.Config{
|
Index.Register(&ice.Context{Name: MEET, Help: "遇见", Configs: ice.Configs{
|
||||||
MISS: {Name: MISS, Help: "miss", Value: kit.Data(
|
MISS: {Name: MISS, Help: "miss", Value: kit.Data(
|
||||||
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,照片,性别,年龄,身高,体重,籍贯,户口,学历,学校,职业,公司,年薪,资产,家境",
|
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,照片,性别,年龄,身高,体重,籍贯,户口,学历,学校,职业,公司,年薪,资产,家境",
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
"monkey": {Name: "monkey total=888 count=9 run", Help: "猴子开箱子", Meta: kit.Dict("_trans", kit.Dict("name", "姓名")), Action: ice.MergeAction(map[string]*ice.Action{
|
"monkey": {Name: "monkey total=888 count=9 run", Help: "猴子开箱子", Meta: kit.Dict("_trans", kit.Dict("name", "姓名")), Actions: ice.MergeAction(ice.Actions{
|
||||||
mdb.CREATE: {Name: "create name 照片 性别 年龄 身高 体重 籍贯 户口 学历 学校 职业 公司 年薪 资产 家境", Help: "添加"},
|
mdb.CREATE: {Name: "create name 照片 性别 年龄 身高 体重 籍贯 户口 学历 学校 职业 公司 年薪 资产 家境", Help: "添加"},
|
||||||
}, mdb.HashAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.HashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
total := kit.Int(arg[0])
|
total := kit.Int(arg[0])
|
||||||
@ -38,11 +38,11 @@ func init() {
|
|||||||
}
|
}
|
||||||
m.StatusTimeCount()
|
m.StatusTimeCount()
|
||||||
}},
|
}},
|
||||||
MISS: {Name: "miss name auto create", Help: "资料", Meta: kit.Dict("_trans", kit.Dict("name", "姓名")), Action: ice.MergeAction(map[string]*ice.Action{
|
MISS: {Name: "miss name auto create", Help: "资料", Meta: kit.Dict("_trans", kit.Dict("name", "姓名")), Actions: ice.MergeAction(ice.Actions{
|
||||||
mdb.CREATE: {Name: "create name 照片 性别 年龄 身高 体重 籍贯 户口 学历 学校 职业 公司 年薪 资产 家境", Help: "添加"},
|
mdb.CREATE: {Name: "create name 照片 性别 年龄 身高 体重 籍贯 户口 学历 学校 职业 公司 年薪 资产 家境", Help: "添加"},
|
||||||
}, mdb.HashAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.HashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
msg := m.Spawn()
|
msg := m.Spawn()
|
||||||
mdb.HashSelect(msg, arg...).Table(func(index int, value map[string]string, head []string) {
|
mdb.HashSelect(msg, arg...).Table(func(index int, value ice.Maps, head []string) {
|
||||||
value["照片"] = ice.Render(m, ice.RENDER_IMAGES, value["照片"], kit.Select("100", "400", msg.FieldsIsDetail()))
|
value["照片"] = ice.Render(m, ice.RENDER_IMAGES, value["照片"], kit.Select("100", "400", msg.FieldsIsDetail()))
|
||||||
m.Push(m.OptionFields(), value, kit.Split(msg.OptionFields()))
|
m.Push(m.OptionFields(), value, kit.Split(msg.OptionFields()))
|
||||||
})
|
})
|
||||||
|
@ -12,8 +12,8 @@ import (
|
|||||||
const NODE = "node"
|
const NODE = "node"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
NODE: {Name: "node pod ctx cmd auto insert invite", Help: "设备", Action: map[string]*ice.Action{
|
NODE: {Name: "node pod ctx cmd auto insert invite", Help: "设备", Actions: ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Watch(web.DREAM_START, m.PrefixKey())
|
m.Watch(web.DREAM_START, m.PrefixKey())
|
||||||
m.Watch(web.SPACE_START, m.PrefixKey())
|
m.Watch(web.SPACE_START, m.PrefixKey())
|
||||||
@ -51,7 +51,7 @@ func init() {
|
|||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
m.OptionFields("time,type,name,share")
|
m.OptionFields("time,type,name,share")
|
||||||
m.Cmdy(mdb.SELECT, RIVER, _river_key(m, NODE), mdb.HASH)
|
m.Cmdy(mdb.SELECT, RIVER, _river_key(m, NODE), mdb.HASH)
|
||||||
m.Table(func(index int, value map[string]string, head []string) {
|
m.Table(func(index int, value ice.Maps, head []string) {
|
||||||
m.PushAnchor(value[mdb.NAME], m.MergeURL2("/chat/pod/"+kit.Keys(m.Option(ice.POD), value[mdb.NAME])))
|
m.PushAnchor(value[mdb.NAME], m.MergeURL2("/chat/pod/"+kit.Keys(m.Option(ice.POD), value[mdb.NAME])))
|
||||||
})
|
})
|
||||||
m.RenameAppend("name", "pod")
|
m.RenameAppend("name", "pod")
|
||||||
|
@ -55,8 +55,8 @@ const (
|
|||||||
)
|
)
|
||||||
const OAUTH = "oauth"
|
const OAUTH = "oauth"
|
||||||
|
|
||||||
var Index = &ice.Context{Name: OAUTH, Help: "认证授权", Commands: map[string]*ice.Command{
|
var Index = &ice.Context{Name: OAUTH, Help: "认证授权", Commands: ice.Commands{
|
||||||
OAUTH: {Name: "oauth hash auto prunes", Help: "权限", Action: ice.MergeAction(map[string]*ice.Action{
|
OAUTH: {Name: "oauth hash auto prunes", Help: "权限", Actions: ice.MergeAction(ice.Actions{
|
||||||
CHECK: {Name: "check scope domain", Help: "检查", Hand: func(m *ice.Message, arg ...string) {
|
CHECK: {Name: "check scope domain", Help: "检查", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Echo(_merge_url(m, kit.Select(ice.Info.Make.Domain, m.Option(web.DOMAIN)), APPLY, m.OptionSimple(SCOPE), REDIRECT_URI, _merge_url(m, "", REPLY)))
|
m.Echo(_merge_url(m, kit.Select(ice.Info.Make.Domain, m.Option(web.DOMAIN)), APPLY, m.OptionSimple(SCOPE), REDIRECT_URI, _merge_url(m, "", REPLY)))
|
||||||
}},
|
}},
|
||||||
@ -77,11 +77,11 @@ var Index = &ice.Context{Name: OAUTH, Help: "认证授权", Commands: map[string
|
|||||||
}},
|
}},
|
||||||
})},
|
})},
|
||||||
|
|
||||||
APPLY: {Name: "apply hash auto create prunes", Help: "申请", Action: mdb.HashAction(mdb.EXPIRE, "72h", mdb.FIELD, "time,hash,username,scope,redirect_uri")},
|
APPLY: {Name: "apply hash auto create prunes", Help: "申请", Actions: mdb.HashAction(mdb.EXPIRE, "72h", mdb.FIELD, "time,hash,username,scope,redirect_uri")},
|
||||||
REPLY: {Name: "reply hash auto create prunes", Help: "授权", Action: mdb.HashAction(mdb.EXPIRE, "720h", mdb.SHORT, mdb.UNIQ, mdb.FIELD, "time,hash,username,scope,offer")},
|
REPLY: {Name: "reply hash auto create prunes", Help: "授权", Actions: mdb.HashAction(mdb.EXPIRE, "720h", mdb.SHORT, mdb.UNIQ, mdb.FIELD, "time,hash,username,scope,offer")},
|
||||||
OFFER: {Name: "offer hash auto create prunes", Help: "访问", Action: mdb.HashAction(mdb.EXPIRE, "720h", mdb.SHORT, mdb.UNIQ, mdb.FIELD, "time,hash,username,scope,redirect_uri")},
|
OFFER: {Name: "offer hash auto create prunes", Help: "访问", Actions: mdb.HashAction(mdb.EXPIRE, "720h", mdb.SHORT, mdb.UNIQ, mdb.FIELD, "time,hash,username,scope,redirect_uri")},
|
||||||
|
|
||||||
web.P(APPLY): {Name: "/apply scope redirect_uri", Help: "申请", Action: ctx.CmdAction(), Hand: func(m *ice.Message, arg ...string) {
|
web.P(APPLY): {Name: "/apply scope redirect_uri", Help: "申请", Actions: ctx.CmdAction(), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Option(REDIRECT_URI) == "" {
|
if m.Option(REDIRECT_URI) == "" {
|
||||||
m.RenderStatusBadRequest() // 参数错误
|
m.RenderStatusBadRequest() // 参数错误
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ var Index = &ice.Context{Name: OAUTH, Help: "认证授权", Commands: map[string
|
|||||||
m.RenderCmd(m.Prefix(OAUTH), APPLY)
|
m.RenderCmd(m.Prefix(OAUTH), APPLY)
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
web.P(REPLY): {Name: "/reply scope offer", Help: "授权", Action: ctx.CmdAction(), Hand: func(m *ice.Message, arg ...string) {
|
web.P(REPLY): {Name: "/reply scope offer", Help: "授权", Actions: ctx.CmdAction(), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Option(OFFER) == "" {
|
if m.Option(OFFER) == "" {
|
||||||
m.RenderStatusBadRequest() // 参数错误
|
m.RenderStatusBadRequest() // 参数错误
|
||||||
|
|
||||||
@ -109,9 +109,9 @@ var Index = &ice.Context{Name: OAUTH, Help: "认证授权", Commands: map[string
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
|
|
||||||
AUTHORIZE: {Name: "authorize hash auto create prunes", Help: "认证", Action: mdb.HashAction(mdb.SHORT, mdb.UNIQ, mdb.FIELD, "time,hash,redirect_uri")},
|
AUTHORIZE: {Name: "authorize hash auto create prunes", Help: "认证", Actions: mdb.HashAction(mdb.SHORT, mdb.UNIQ, mdb.FIELD, "time,hash,redirect_uri")},
|
||||||
TOKEN: {Name: "token hash auto create prunes", Help: "授权", Action: mdb.HashAction(mdb.EXPIRE, "72h", mdb.FIELD, "time,hash,used,state,scope,redirect_uri")},
|
TOKEN: {Name: "token hash auto create prunes", Help: "授权", Actions: mdb.HashAction(mdb.EXPIRE, "72h", mdb.FIELD, "time,hash,used,state,scope,redirect_uri")},
|
||||||
ACCESS: {Name: "access hash auto create prunes", Help: "访问", Action: mdb.HashAction(mdb.EXPIRE, "720h", mdb.SHORT, mdb.UNIQ, mdb.FIELD, "time,hash,username,scope,redirect_uri")},
|
ACCESS: {Name: "access hash auto create prunes", Help: "访问", Actions: mdb.HashAction(mdb.EXPIRE, "720h", mdb.SHORT, mdb.UNIQ, mdb.FIELD, "time,hash,username,scope,redirect_uri")},
|
||||||
|
|
||||||
web.P(AUTHORIZE): {Name: "/authorize state scope client_id redirect_uri", Help: "认证", Hand: func(m *ice.Message, arg ...string) {
|
web.P(AUTHORIZE): {Name: "/authorize state scope client_id redirect_uri", Help: "认证", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Option(CLIENT_ID) == "" || m.Option(REDIRECT_URI) == "" {
|
if m.Option(CLIENT_ID) == "" || m.Option(REDIRECT_URI) == "" {
|
||||||
|
@ -10,8 +10,8 @@ import (
|
|||||||
const OCEAN = "ocean"
|
const OCEAN = "ocean"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
OCEAN: {Name: "ocean username auto insert invite", Help: "用户", Action: map[string]*ice.Action{
|
OCEAN: {Name: "ocean username auto insert invite", Help: "用户", Actions: ice.Actions{
|
||||||
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(aaa.USER, ice.OptionFields(aaa.USERNAME, aaa.USERNICK, aaa.USERZONE))
|
m.Cmdy(aaa.USER, ice.OptionFields(aaa.USERNAME, aaa.USERNICK, aaa.USERZONE))
|
||||||
}},
|
}},
|
||||||
@ -24,7 +24,7 @@ func init() {
|
|||||||
}, Hand: func(m *ice.Message, arg ...string) {
|
}, Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Fields(len(arg), "time,username")
|
m.Fields(len(arg), "time,username")
|
||||||
m.Cmdy(mdb.SELECT, RIVER, _river_key(m, OCEAN), mdb.HASH, aaa.USERNAME, arg)
|
m.Cmdy(mdb.SELECT, RIVER, _river_key(m, OCEAN), mdb.HASH, aaa.USERNAME, arg)
|
||||||
m.Table(func(index int, value map[string]string, head []string) {
|
m.Table(func(index int, value ice.Maps, head []string) {
|
||||||
msg := m.Cmd(aaa.USER, value[aaa.USERNAME])
|
msg := m.Cmd(aaa.USER, value[aaa.USERNAME])
|
||||||
m.Push(aaa.USERNICK, msg.Append(aaa.USERNICK))
|
m.Push(aaa.USERNICK, msg.Append(aaa.USERNICK))
|
||||||
m.PushImages(aaa.AVATAR, msg.Append(aaa.AVATAR), kit.Select("60", "240", m.FieldsIsDetail()))
|
m.PushImages(aaa.AVATAR, msg.Append(aaa.AVATAR), kit.Select("60", "240", m.FieldsIsDetail()))
|
||||||
|
@ -11,12 +11,12 @@ import (
|
|||||||
const PASTE = "paste"
|
const PASTE = "paste"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
PASTE: {Name: PASTE, Help: "粘贴", Value: kit.Data(
|
PASTE: {Name: PASTE, Help: "粘贴", Value: kit.Data(
|
||||||
mdb.SHORT, mdb.TEXT, mdb.FIELD, "time,hash,type,name,text",
|
mdb.SHORT, mdb.TEXT, mdb.FIELD, "time,hash,type,name,text",
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
PASTE: {Name: "paste hash auto getClipboardData", Help: "粘贴", Action: ice.MergeAction(map[string]*ice.Action{
|
PASTE: {Name: "paste hash auto getClipboardData", Help: "粘贴", Actions: ice.MergeAction(ice.Actions{
|
||||||
"getClipboardData": {Name: "getClipboardData", Help: "粘贴", Hand: func(m *ice.Message, arg ...string) {
|
"getClipboardData": {Name: "getClipboardData", Help: "粘贴", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(PASTE, mdb.CREATE, arg)
|
m.Cmdy(PASTE, mdb.CREATE, arg)
|
||||||
}},
|
}},
|
||||||
|
@ -16,10 +16,10 @@ import (
|
|||||||
const POD = "pod"
|
const POD = "pod"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
POD: {Name: POD, Help: "节点", Value: kit.Data()},
|
POD: {Name: POD, Help: "节点", Value: kit.Data()},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
"/pod/": {Name: "/pod/", Help: "节点", Action: ice.MergeAction(map[string]*ice.Action{
|
"/pod/": {Name: "/pod/", Help: "节点", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Name: "_init", Help: "初始化", Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Name: "_init", Help: "初始化", Hand: func(m *ice.Message, arg ...string) {
|
||||||
}},
|
}},
|
||||||
}, ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
@ -53,8 +53,8 @@ func _river_list(m *ice.Message) {
|
|||||||
const RIVER = "river"
|
const RIVER = "river"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
RIVER: {Name: "river hash auto create", Help: "群组", Action: ice.MergeAction(map[string]*ice.Action{
|
RIVER: {Name: "river hash auto create", Help: "群组", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { m.Config(nfs.TEMPLATE, _river_template) }},
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { m.Config(nfs.TEMPLATE, _river_template) }},
|
||||||
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch m.Option(ctx.ACTION) {
|
switch m.Option(ctx.ACTION) {
|
||||||
|
@ -15,21 +15,21 @@ func init() {
|
|||||||
JOIN = "join"
|
JOIN = "join"
|
||||||
QUIT = "quit"
|
QUIT = "quit"
|
||||||
)
|
)
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
ROOM: {Name: "room", Help: "room", Value: kit.Data(
|
ROOM: {Name: "room", Help: "room", Value: kit.Data(
|
||||||
mdb.SHORT, "zone", mdb.FIELD, "time,id,type,name,text",
|
mdb.SHORT, "zone", mdb.FIELD, "time,id,type,name,text",
|
||||||
)},
|
)},
|
||||||
JOIN: {Name: "join", Help: "join", Value: kit.Data(
|
JOIN: {Name: "join", Help: "join", Value: kit.Data(
|
||||||
mdb.SHORT, "space", mdb.FIELD, "time,hash,username,socket",
|
mdb.SHORT, "space", mdb.FIELD, "time,hash,username,socket",
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
ROOM: {Name: "room zone id auto", Help: "room", Action: ice.MergeAction(map[string]*ice.Action{
|
ROOM: {Name: "room zone id auto", Help: "room", Actions: ice.MergeAction(ice.Actions{
|
||||||
mdb.CREATE: {Name: "create zone", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create zone", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(mdb.INSERT, m.PrefixKey(), "", mdb.HASH, m.OptionSimple(mdb.ZONE))
|
m.Cmdy(mdb.INSERT, m.PrefixKey(), "", mdb.HASH, m.OptionSimple(mdb.ZONE))
|
||||||
}},
|
}},
|
||||||
mdb.INSERT: {Name: "insert zone type=hi name=hello text=world", Help: "发送", Hand: func(m *ice.Message, arg ...string) {
|
mdb.INSERT: {Name: "insert zone type=hi name=hello text=world", Help: "发送", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(mdb.INSERT, m.PrefixKey(), "", mdb.ZONE, m.Option(mdb.ZONE), arg[2:])
|
m.Cmdy(mdb.INSERT, m.PrefixKey(), "", mdb.ZONE, m.Option(mdb.ZONE), arg[2:])
|
||||||
m.Cmdy(mdb.SELECT, m.PrefixKey(), kit.KeyHash(m.Option(mdb.ZONE)), mdb.HASH, ice.Option{"fields", "time,space"}).Table(func(index int, value map[string]string, head []string) {
|
m.Cmdy(mdb.SELECT, m.PrefixKey(), kit.KeyHash(m.Option(mdb.ZONE)), mdb.HASH, ice.Option{"fields", "time,space"}).Table(func(index int, value ice.Maps, head []string) {
|
||||||
m.Cmdy(web.SPACE, value[web.SPACE], "toast", m.Option("text"), m.Option("name"))
|
m.Cmdy(web.SPACE, value[web.SPACE], "toast", m.Option("text"), m.Option("name"))
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
@ -51,7 +51,7 @@ func init() {
|
|||||||
m.Action(mdb.INSERT, JOIN)
|
m.Action(mdb.INSERT, JOIN)
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
JOIN: {Name: "join space zone auto", Help: "join", Action: ice.MergeAction(map[string]*ice.Action{
|
JOIN: {Name: "join space zone auto", Help: "join", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
// m.Watch(web.SPACE_START, m.PrefixKey())
|
// m.Watch(web.SPACE_START, m.PrefixKey())
|
||||||
}},
|
}},
|
||||||
|
@ -11,14 +11,14 @@ import (
|
|||||||
const SCAN = "scan"
|
const SCAN = "scan"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
SCAN: {Name: SCAN, Help: "扫码", Value: kit.Data(
|
SCAN: {Name: SCAN, Help: "扫码", Value: kit.Data(
|
||||||
mdb.SHORT, mdb.TEXT, mdb.FIELD, "time,hash,type,name,text",
|
mdb.SHORT, mdb.TEXT, mdb.FIELD, "time,hash,type,name,text",
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
SCAN: {Name: "scan hash auto scanQRCode scanQRCode0", Help: "扫码", Meta: kit.Dict(
|
SCAN: {Name: "scan hash auto scanQRCode scanQRCode0", Help: "扫码", Meta: kit.Dict(
|
||||||
ice.Display("scan.js"),
|
ice.Display("scan.js"),
|
||||||
), Action: ice.MergeAction(map[string]*ice.Action{
|
), Actions: ice.MergeAction(ice.Actions{
|
||||||
"scanQRCode0": {Name: "scan create", Help: "本机扫码"},
|
"scanQRCode0": {Name: "scan create", Help: "本机扫码"},
|
||||||
"scanQRCode": {Name: "scan create", Help: "扫码"},
|
"scanQRCode": {Name: "scan create", Help: "扫码"},
|
||||||
mdb.CREATE: {Name: "create type=text name=hi text:textarea=hi", Help: "添加"},
|
mdb.CREATE: {Name: "create type=text name=hi text:textarea=hi", Help: "添加"},
|
||||||
|
@ -10,8 +10,8 @@ import (
|
|||||||
const SEARCH = "search"
|
const SEARCH = "search"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
web.P(SEARCH): {Name: "/search", Help: "搜索引擎", Action: ctx.CmdAction(mdb.SHORT, mdb.NAME), Hand: func(m *ice.Message, arg ...string) {
|
web.P(SEARCH): {Name: "/search", Help: "搜索引擎", Actions: ctx.CmdAction(mdb.SHORT, mdb.NAME), Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(m.Space(m.Option(ice.POD)), mdb.SEARCH, arg).StatusTimeCount()
|
m.Cmdy(m.Space(m.Option(ice.POD)), mdb.SEARCH, arg).StatusTimeCount()
|
||||||
}},
|
}},
|
||||||
}})
|
}})
|
||||||
|
@ -12,7 +12,7 @@ import (
|
|||||||
const SSO = "sso"
|
const SSO = "sso"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
"/sso": {Name: "/sso", Help: "登录", Hand: func(m *ice.Message, arg ...string) {
|
"/sso": {Name: "/sso", Help: "登录", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Option(ice.MSG_USERNAME) == "" {
|
if m.Option(ice.MSG_USERNAME) == "" {
|
||||||
m.RenderIndex(web.SERVE, ice.VOLCANOS)
|
m.RenderIndex(web.SERVE, ice.VOLCANOS)
|
||||||
|
@ -14,8 +14,8 @@ func _storm_key(m *ice.Message, key ...ice.Any) string {
|
|||||||
const STORM = "storm"
|
const STORM = "storm"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
STORM: {Name: "storm hash id auto insert create", Help: "应用", Action: map[string]*ice.Action{
|
STORM: {Name: "storm hash id auto insert create", Help: "应用", Actions: ice.Actions{
|
||||||
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if ctx.Inputs(m, arg[0]) {
|
if ctx.Inputs(m, arg[0]) {
|
||||||
return
|
return
|
||||||
@ -81,7 +81,7 @@ func init() {
|
|||||||
|
|
||||||
if m.Copy(msg); len(arg) > 1 { // 命令插件
|
if m.Copy(msg); len(arg) > 1 { // 命令插件
|
||||||
m.ProcessField(arg[0], arg[1], ice.RUN)
|
m.ProcessField(arg[0], arg[1], ice.RUN)
|
||||||
m.Table(func(index int, value map[string]string, head []string) {
|
m.Table(func(index int, value ice.Maps, head []string) {
|
||||||
m.Cmdy(m.Space(value[ice.POD]), ctx.CONTEXT, value[ice.CTX], ctx.COMMAND, value[ice.CMD])
|
m.Cmdy(m.Space(value[ice.POD]), ctx.CONTEXT, value[ice.CTX], ctx.COMMAND, value[ice.CMD])
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
@ -18,8 +18,8 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
TRANS: {Name: "trans from to auto", Help: "传输", Action: ice.MergeAction(map[string]*ice.Action{
|
TRANS: {Name: "trans from to auto", Help: "传输", Actions: ice.MergeAction(ice.Actions{
|
||||||
SEND: {Name: "send", Help: "发送", Hand: func(m *ice.Message, arg ...string) {
|
SEND: {Name: "send", Help: "发送", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(web.SPACE, m.Option(TO), web.SPIDE, ice.DEV, web.SPIDE_SAVE, kit.Select(nfs.PWD, m.Option("to_path")),
|
m.Cmdy(web.SPACE, m.Option(TO), web.SPIDE, ice.DEV, web.SPIDE_SAVE, kit.Select(nfs.PWD, m.Option("to_path")),
|
||||||
m.MergeURL2(path.Join(web.SHARE_LOCAL, m.Option("from_path")), ice.POD, m.Option(FROM),
|
m.MergeURL2(path.Join(web.SHARE_LOCAL, m.Option("from_path")), ice.POD, m.Option(FROM),
|
||||||
|
@ -156,7 +156,7 @@ func _website_render(m *ice.Message, w http.ResponseWriter, r *http.Request, kin
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
func _website_search(m *ice.Message, kind, name, text string, arg ...string) {
|
func _website_search(m *ice.Message, kind, name, text string, arg ...string) {
|
||||||
m.Cmd(m.PrefixKey(), ice.OptionFields("")).Table(func(index int, value map[string]string, head []string) {
|
m.Cmd(m.PrefixKey(), ice.OptionFields("")).Table(func(index int, value ice.Maps, head []string) {
|
||||||
m.PushSearch(value, mdb.TEXT, m.MergeWebsite(value[nfs.PATH]))
|
m.PushSearch(value, mdb.TEXT, m.MergeWebsite(value[nfs.PATH]))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -168,11 +168,11 @@ const (
|
|||||||
const WEBSITE = "website"
|
const WEBSITE = "website"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
WEBSITE: {Name: "website", Help: "网站", Value: kit.Data(mdb.SHORT, nfs.PATH, mdb.FIELD, "time,path,type,name,text")},
|
WEBSITE: {Name: "website", Help: "网站", Value: kit.Data(mdb.SHORT, nfs.PATH, mdb.FIELD, "time,path,type,name,text")},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
"/website/": {Name: "/website/", Help: "网站", Action: ice.MergeAction(map[string]*ice.Action{}, ctx.CmdAction())},
|
"/website/": {Name: "/website/", Help: "网站", Actions: ice.MergeAction(ice.Actions{}, ctx.CmdAction())},
|
||||||
WEBSITE: {Name: "website path auto create import", Help: "网站", Action: ice.MergeAction(map[string]*ice.Action{
|
WEBSITE: {Name: "website path auto create import", Help: "网站", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(mdb.RENDER, mdb.CREATE, nfs.IML, m.PrefixKey())
|
m.Cmd(mdb.RENDER, mdb.CREATE, nfs.IML, m.PrefixKey())
|
||||||
m.Cmd(mdb.ENGINE, mdb.CREATE, nfs.IML, m.PrefixKey())
|
m.Cmd(mdb.ENGINE, mdb.CREATE, nfs.IML, m.PrefixKey())
|
||||||
@ -250,7 +250,7 @@ func init() {
|
|||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
}, mdb.HashAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.HashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.HashSelect(m, arg...).Table(func(index int, value map[string]string, head []string) {
|
mdb.HashSelect(m, arg...).Table(func(index int, value ice.Maps, head []string) {
|
||||||
m.PushAnchor(m.MergeWebsite(value[nfs.PATH]))
|
m.PushAnchor(m.MergeWebsite(value[nfs.PATH]))
|
||||||
})
|
})
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
|
@ -164,8 +164,8 @@ func init() {
|
|||||||
const AUTOGEN = "autogen"
|
const AUTOGEN = "autogen"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
AUTOGEN: {Name: "autogen path auto create binpack script relay", Help: "生成", Action: map[string]*ice.Action{
|
AUTOGEN: {Name: "autogen path auto create binpack script relay", Help: "生成", Actions: ice.Actions{
|
||||||
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case cli.MAIN:
|
case cli.MAIN:
|
||||||
|
@ -61,8 +61,8 @@ const (
|
|||||||
const BENCH = "bench"
|
const BENCH = "bench"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
BENCH: {Name: "bench zone id auto insert", Help: "性能压测", Action: ice.MergeAction(map[string]*ice.Action{
|
BENCH: {Name: "bench zone id auto insert", Help: "性能压测", Actions: ice.MergeAction(ice.Actions{
|
||||||
mdb.INSERT: {Name: "insert zone=some type=http,redis name=demo text='http://localhost:9020' nconn=3 nreqs=10", Help: "添加"},
|
mdb.INSERT: {Name: "insert zone=some type=http,redis name=demo text='http://localhost:9020' nconn=3 nreqs=10", Help: "添加"},
|
||||||
ice.RUN: {Name: "run", Help: "执行", Hand: func(m *ice.Message, arg ...string) {
|
ice.RUN: {Name: "run", Help: "执行", Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch m.Option(mdb.TYPE) {
|
switch m.Option(mdb.TYPE) {
|
||||||
|
@ -31,7 +31,7 @@ func _binpack_dir(m *ice.Message, f *os.File, dir string) {
|
|||||||
m.Option(nfs.DIR_DEEP, true)
|
m.Option(nfs.DIR_DEEP, true)
|
||||||
m.Option(nfs.DIR_TYPE, nfs.CAT)
|
m.Option(nfs.DIR_TYPE, nfs.CAT)
|
||||||
|
|
||||||
m.Cmd(nfs.DIR, nfs.PWD).Sort(nfs.PATH).Tables(func(value map[string]string) {
|
m.Cmd(nfs.DIR, nfs.PWD).Sort(nfs.PATH).Tables(func(value ice.Maps) {
|
||||||
switch path.Base(value[nfs.PATH]) {
|
switch path.Base(value[nfs.PATH]) {
|
||||||
case "go.mod", "go.sum", "binpack.go", "version.go":
|
case "go.mod", "go.sum", "binpack.go", "version.go":
|
||||||
return
|
return
|
||||||
@ -54,7 +54,7 @@ func _binpack_can(m *ice.Message, f *os.File, dir string) {
|
|||||||
fmt.Fprintln(f, _binpack_file(m, path.Join(dir, k), ice.PS+k))
|
fmt.Fprintln(f, _binpack_file(m, path.Join(dir, k), ice.PS+k))
|
||||||
}
|
}
|
||||||
for _, k := range []string{LIB, PAGE, PANEL, PLUGIN, "publish/client/nodejs/"} {
|
for _, k := range []string{LIB, PAGE, PANEL, PLUGIN, "publish/client/nodejs/"} {
|
||||||
m.Cmd(nfs.DIR, k).Sort(nfs.PATH).Tables(func(value map[string]string) {
|
m.Cmd(nfs.DIR, k).Sort(nfs.PATH).Tables(func(value ice.Maps) {
|
||||||
fmt.Fprintln(f, _binpack_file(m, path.Join(dir, value[nfs.PATH]), ice.PS+value[nfs.PATH]))
|
fmt.Fprintln(f, _binpack_file(m, path.Join(dir, value[nfs.PATH]), ice.PS+value[nfs.PATH]))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -67,8 +67,8 @@ func _binpack_ctx(m *ice.Message, f *os.File) {
|
|||||||
const BINPACK = "binpack"
|
const BINPACK = "binpack"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
BINPACK: {Name: "binpack path auto create remove export", Help: "打包", Action: ice.MergeAction(map[string]*ice.Action{
|
BINPACK: {Name: "binpack path auto create remove export", Help: "打包", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if kit.FileExists(path.Join(ice.USR_VOLCANOS, ice.PROTO_JS)) {
|
if kit.FileExists(path.Join(ice.USR_VOLCANOS, ice.PROTO_JS)) {
|
||||||
m.Cmd(BINPACK, mdb.REMOVE)
|
m.Cmd(BINPACK, mdb.REMOVE)
|
||||||
@ -134,7 +134,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
`)
|
`)
|
||||||
|
|
||||||
fmt.Fprintln(f, ` pack := map[string]string{`)
|
fmt.Fprintln(f, ` pack := ice.Maps{`)
|
||||||
defer fmt.Fprintln(f, ` }`)
|
defer fmt.Fprintln(f, ` }`)
|
||||||
|
|
||||||
if kit.FileExists(ice.USR_VOLCANOS) && kit.FileExists(ice.USR_INTSHELL) && m.Option(ice.MSG_USERPOD) == "" {
|
if kit.FileExists(ice.USR_VOLCANOS) && kit.FileExists(ice.USR_INTSHELL) && m.Option(ice.MSG_USERPOD) == "" {
|
||||||
@ -153,7 +153,7 @@ func init() {
|
|||||||
fmt.Fprintln(f, _binpack_file(m, ice.README_MD))
|
fmt.Fprintln(f, _binpack_file(m, ice.README_MD))
|
||||||
fmt.Fprintln(f)
|
fmt.Fprintln(f)
|
||||||
|
|
||||||
m.Cmd(mdb.SELECT, m.PrefixKey(), "", mdb.HASH, ice.OptionFields(nfs.PATH)).Tables(func(value map[string]string) {
|
m.Cmd(mdb.SELECT, m.PrefixKey(), "", mdb.HASH, ice.OptionFields(nfs.PATH)).Tables(func(value ice.Maps) {
|
||||||
if s, e := os.Stat(value[nfs.PATH]); e == nil {
|
if s, e := os.Stat(value[nfs.PATH]); e == nil {
|
||||||
if s.IsDir() {
|
if s.IsDir() {
|
||||||
_binpack_dir(m, f, value[nfs.PATH])
|
_binpack_dir(m, f, value[nfs.PATH])
|
||||||
|
@ -48,8 +48,8 @@ const (
|
|||||||
const C = "c"
|
const C = "c"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Register(&ice.Context{Name: C, Help: "系统", Commands: map[string]*ice.Command{
|
Index.Register(&ice.Context{Name: C, Help: "系统", Commands: ice.Commands{
|
||||||
C: {Name: C, Help: "系统", Action: ice.MergeAction(map[string]*ice.Action{
|
C: {Name: C, Help: "系统", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
for _, cmd := range []string{mdb.SEARCH, mdb.ENGINE, mdb.RENDER, mdb.PLUGIN} {
|
for _, cmd := range []string{mdb.SEARCH, mdb.ENGINE, mdb.RENDER, mdb.PLUGIN} {
|
||||||
for _, k := range []string{H, C, CC} {
|
for _, k := range []string{H, C, CC} {
|
||||||
@ -79,7 +79,7 @@ func init() {
|
|||||||
// _go_grep(m, kit.Select(cli.MAIN, arg, 1), arg[2])
|
// _go_grep(m, kit.Select(cli.MAIN, arg, 1), arg[2])
|
||||||
}},
|
}},
|
||||||
}, PlugAction())},
|
}, PlugAction())},
|
||||||
MAN: {Name: MAN, Help: "手册", Action: ice.MergeAction(map[string]*ice.Action{
|
MAN: {Name: MAN, Help: "手册", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
for _, cmd := range []string{mdb.SEARCH, mdb.RENDER, mdb.PLUGIN} {
|
for _, cmd := range []string{mdb.SEARCH, mdb.RENDER, mdb.PLUGIN} {
|
||||||
for _, k := range []string{MAN1, MAN2, MAN3, MAN8} {
|
for _, k := range []string{MAN1, MAN2, MAN3, MAN8} {
|
||||||
@ -102,7 +102,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
}, PlugAction())},
|
}, PlugAction())},
|
||||||
}, Configs: map[string]*ice.Config{
|
}, Configs: ice.Configs{
|
||||||
C: {Name: C, Help: "系统", Value: kit.Data(PLUG, kit.Dict(
|
C: {Name: C, Help: "系统", Value: kit.Data(PLUG, kit.Dict(
|
||||||
SPLIT, kit.Dict("space", " ", "operator", "{[(.,:;!|<>)]}"),
|
SPLIT, kit.Dict("space", " ", "operator", "{[(.,:;!|<>)]}"),
|
||||||
PREFIX, kit.Dict("//", COMMENT, "/* ", COMMENT, "* ", COMMENT), PREPARE, kit.Dict(
|
PREFIX, kit.Dict("//", COMMENT, "/* ", COMMENT, "* ", COMMENT), PREPARE, kit.Dict(
|
||||||
|
@ -15,8 +15,8 @@ import (
|
|||||||
const CASE = "case"
|
const CASE = "case"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
CASE: {Name: "case dev zone id auto", Help: "用例", Action: ice.MergeAction(map[string]*ice.Action{
|
CASE: {Name: "case dev zone id auto", Help: "用例", Actions: ice.MergeAction(ice.Actions{
|
||||||
mdb.CREATE: {Name: "create name address", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create name address", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(web.SPIDE, mdb.CREATE, arg)
|
m.Cmdy(web.SPIDE, mdb.CREATE, arg)
|
||||||
}},
|
}},
|
||||||
@ -25,7 +25,7 @@ func init() {
|
|||||||
cli.CHECK: {Name: "check", Help: "检查", Hand: func(m *ice.Message, arg ...string) {
|
cli.CHECK: {Name: "check", Help: "检查", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.ProcessInner(); len(arg) > 0 {
|
if m.ProcessInner(); len(arg) > 0 {
|
||||||
success := 0
|
success := 0
|
||||||
m.Cmd(m.PrefixKey(), arg[0]).Tables(func(value map[string]string) {
|
m.Cmd(m.PrefixKey(), arg[0]).Tables(func(value ice.Maps) {
|
||||||
m.Push(mdb.TIME, m.Time())
|
m.Push(mdb.TIME, m.Time())
|
||||||
m.Push(mdb.ID, value[mdb.ID])
|
m.Push(mdb.ID, value[mdb.ID])
|
||||||
if err := m.Cmdx(m.PrefixKey(), cli.CHECK, value); err == ice.OK {
|
if err := m.Cmdx(m.PrefixKey(), cli.CHECK, value); err == ice.OK {
|
||||||
@ -75,7 +75,7 @@ func init() {
|
|||||||
m.PushAction(ice.RUN, cli.CHECK)
|
m.PushAction(ice.RUN, cli.CHECK)
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
"test": {Name: "test path func auto run case", Help: "测试用例", Action: map[string]*ice.Action{
|
"test": {Name: "test path func auto run case", Help: "测试用例", Actions: ice.Actions{
|
||||||
"run": {Name: "run", Help: "运行", Hand: func(m *ice.Message, arg ...string) {
|
"run": {Name: "run", Help: "运行", Hand: func(m *ice.Message, arg ...string) {
|
||||||
// cli.Follow(m, "run", func() {
|
// cli.Follow(m, "run", func() {
|
||||||
m.Option(cli.CMD_DIR, kit.Select(path.Dir(arg[0]), arg[0], strings.HasSuffix(arg[0], "/")))
|
m.Option(cli.CMD_DIR, kit.Select(path.Dir(arg[0]), arg[0], strings.HasSuffix(arg[0], "/")))
|
||||||
@ -87,7 +87,7 @@ func init() {
|
|||||||
if strings.HasSuffix(arg[0], "/") {
|
if strings.HasSuffix(arg[0], "/") {
|
||||||
msg.Option(cli.CMD_DIR, arg[0])
|
msg.Option(cli.CMD_DIR, arg[0])
|
||||||
msg.Split(msg.Cmdx(cli.SYSTEM, "grep", "-r", "func Test.*(", nfs.PWD), "file:line", ":", "\n")
|
msg.Split(msg.Cmdx(cli.SYSTEM, "grep", "-r", "func Test.*(", nfs.PWD), "file:line", ":", "\n")
|
||||||
msg.Tables(func(value map[string]string) {
|
msg.Tables(func(value ice.Maps) {
|
||||||
if strings.HasPrefix(strings.TrimSpace(value["line"]), "//") {
|
if strings.HasPrefix(strings.TrimSpace(value["line"]), "//") {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -41,12 +41,12 @@ const (
|
|||||||
const COMPILE = "compile"
|
const COMPILE = "compile"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
COMPILE: {Name: COMPILE, Help: "编译", Value: kit.Data(nfs.PATH, ice.USR_PUBLISH,
|
COMPILE: {Name: COMPILE, Help: "编译", Value: kit.Data(nfs.PATH, ice.USR_PUBLISH,
|
||||||
cli.ENV, kit.Dict("GOPROXY", "https://goproxy.cn,direct", "GOPRIVATE", "shylinux.com,github.com", "CGO_ENABLED", "0"),
|
cli.ENV, kit.Dict("GOPROXY", "https://goproxy.cn,direct", "GOPRIVATE", "shylinux.com,github.com", "CGO_ENABLED", "0"),
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
COMPILE: {Name: "compile arch=amd64,386,arm,arm64,mipsle os=linux,darwin,windows src=src/main.go@key run binpack relay install", Help: "编译", Action: map[string]*ice.Action{
|
COMPILE: {Name: "compile arch=amd64,386,arm,arm64,mipsle os=linux,darwin,windows src=src/main.go@key run binpack relay install", Help: "编译", Actions: ice.Actions{
|
||||||
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(nfs.DIR, ice.SRC, nfs.DIR_CLI_FIELDS, kit.Dict(nfs.DIR_REG, `.*\.go$`)).Sort(nfs.PATH)
|
m.Cmdy(nfs.DIR, ice.SRC, nfs.DIR_CLI_FIELDS, kit.Dict(nfs.DIR_REG, `.*\.go$`)).Sort(nfs.PATH)
|
||||||
}},
|
}},
|
||||||
|
@ -9,8 +9,8 @@ import (
|
|||||||
const FAVOR = "favor"
|
const FAVOR = "favor"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
FAVOR: {Name: "favor zone id auto insert", Help: "收藏夹", Action: ice.MergeAction(map[string]*ice.Action{
|
FAVOR: {Name: "favor zone id auto insert", Help: "收藏夹", Actions: ice.MergeAction(ice.Actions{
|
||||||
mdb.INSERT: {Name: "insert zone=数据结构 type=go name=hi text=hello path file line", Help: "添加"},
|
mdb.INSERT: {Name: "insert zone=数据结构 type=go name=hi text=hello path file line", Help: "添加"},
|
||||||
INNER: {Name: "inner", Help: "源码", Hand: func(m *ice.Message, arg ...string) {
|
INNER: {Name: "inner", Help: "源码", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.ProcessCommand(INNER, m.OptionSplit("path,file,line"), arg...)
|
m.ProcessCommand(INNER, m.OptionSplit("path,file,line"), arg...)
|
||||||
|
@ -53,10 +53,10 @@ func _go_help(m *ice.Message, key string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
func _go_find(m *ice.Message, key string, dir string) {
|
func _go_find(m *ice.Message, key string, dir string) {
|
||||||
m.Cmd(nfs.FIND, dir, key).Tables(func(value map[string]string) { m.PushSearch(nfs.LINE, 1, value) })
|
m.Cmd(nfs.FIND, dir, key).Tables(func(value ice.Maps) { m.PushSearch(nfs.LINE, 1, value) })
|
||||||
}
|
}
|
||||||
func _go_grep(m *ice.Message, key string, dir string) {
|
func _go_grep(m *ice.Message, key string, dir string) {
|
||||||
m.Cmd(nfs.GREP, dir, key).Tables(func(value map[string]string) { m.PushSearch(value) })
|
m.Cmd(nfs.GREP, dir, key).Tables(func(value ice.Maps) { m.PushSearch(value) })
|
||||||
}
|
}
|
||||||
|
|
||||||
var _cache_mods = map[string]*ice.Message{}
|
var _cache_mods = map[string]*ice.Message{}
|
||||||
@ -177,8 +177,8 @@ func _mod_show(m *ice.Message, file string) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
block := ""
|
block := ""
|
||||||
require := map[string]string{}
|
require := ice.Maps{}
|
||||||
replace := map[string]string{}
|
replace := ice.Maps{}
|
||||||
m.Cmd(nfs.CAT, file, func(ls []string, line string) {
|
m.Cmd(nfs.CAT, file, func(ls []string, line string) {
|
||||||
switch {
|
switch {
|
||||||
case strings.HasPrefix(line, MODULE):
|
case strings.HasPrefix(line, MODULE):
|
||||||
@ -223,7 +223,7 @@ const SUM = "sum"
|
|||||||
const GODOC = "godoc"
|
const GODOC = "godoc"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Register(&ice.Context{Name: GO, Help: "后端", Commands: map[string]*ice.Command{
|
Index.Register(&ice.Context{Name: GO, Help: "后端", Commands: ice.Commands{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(mdb.SEARCH, mdb.CREATE, GODOC, m.Prefix(GO))
|
m.Cmd(mdb.SEARCH, mdb.CREATE, GODOC, m.Prefix(GO))
|
||||||
m.Cmd(mdb.ENGINE, mdb.CREATE, GO, m.Prefix(GO))
|
m.Cmd(mdb.ENGINE, mdb.CREATE, GO, m.Prefix(GO))
|
||||||
@ -234,20 +234,20 @@ func init() {
|
|||||||
m.Cmd(mdb.PLUGIN, mdb.CREATE, k, m.Prefix(k))
|
m.Cmd(mdb.PLUGIN, mdb.CREATE, k, m.Prefix(k))
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
GODOC: {Name: "godoc", Help: "文档", Action: ice.MergeAction(map[string]*ice.Action{
|
GODOC: {Name: "godoc", Help: "文档", Actions: ice.MergeAction(ice.Actions{
|
||||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(cli.SYSTEM, GO, "doc", strings.TrimSuffix(arg[1], ice.PT+arg[0]), kit.Dict(cli.CMD_DIR, arg[2])).SetAppend()
|
m.Cmdy(cli.SYSTEM, GO, "doc", strings.TrimSuffix(arg[1], ice.PT+arg[0]), kit.Dict(cli.CMD_DIR, arg[2])).SetAppend()
|
||||||
}},
|
}},
|
||||||
}, PlugAction())},
|
}, PlugAction())},
|
||||||
SUM: {Name: "sum", Help: "版本", Action: ice.MergeAction(map[string]*ice.Action{
|
SUM: {Name: "sum", Help: "版本", Actions: ice.MergeAction(ice.Actions{
|
||||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) { _sum_show(m, path.Join(arg[2], arg[1])) }},
|
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) { _sum_show(m, path.Join(arg[2], arg[1])) }},
|
||||||
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) { _sum_show(m, path.Join(arg[2], arg[1])) }},
|
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) { _sum_show(m, path.Join(arg[2], arg[1])) }},
|
||||||
}, PlugAction())},
|
}, PlugAction())},
|
||||||
MOD: {Name: "mod", Help: "模块", Action: ice.MergeAction(map[string]*ice.Action{
|
MOD: {Name: "mod", Help: "模块", Actions: ice.MergeAction(ice.Actions{
|
||||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) { _mod_show(m, path.Join(arg[2], arg[1])) }},
|
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) { _mod_show(m, path.Join(arg[2], arg[1])) }},
|
||||||
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) { _mod_show(m, path.Join(arg[2], arg[1])) }},
|
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) { _mod_show(m, path.Join(arg[2], arg[1])) }},
|
||||||
}, PlugAction())},
|
}, PlugAction())},
|
||||||
GO: {Name: "go", Help: "后端", Action: ice.MergeAction(map[string]*ice.Action{
|
GO: {Name: "go", Help: "后端", Actions: ice.MergeAction(ice.Actions{
|
||||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if arg[0] == GO {
|
if arg[0] == GO {
|
||||||
_go_tags(m, kit.Select(cli.MAIN, arg, 1))
|
_go_tags(m, kit.Select(cli.MAIN, arg, 1))
|
||||||
@ -259,7 +259,7 @@ func init() {
|
|||||||
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) { _go_exec(m, arg...) }},
|
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) { _go_exec(m, arg...) }},
|
||||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) { _go_show(m, arg...) }},
|
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) { _go_show(m, arg...) }},
|
||||||
}, PlugAction())},
|
}, PlugAction())},
|
||||||
}, Configs: map[string]*ice.Config{
|
}, Configs: ice.Configs{
|
||||||
MOD: {Name: MOD, Help: "模块", Value: kit.Data(PLUG, kit.Dict(
|
MOD: {Name: MOD, Help: "模块", Value: kit.Data(PLUG, kit.Dict(
|
||||||
PREFIX, kit.Dict("//", COMMENT), PREPARE, kit.Dict(
|
PREFIX, kit.Dict("//", COMMENT), PREPARE, kit.Dict(
|
||||||
KEYWORD, kit.Simple("go", "module", "require", "replace", "=>"),
|
KEYWORD, kit.Simple("go", "module", "require", "replace", "=>"),
|
||||||
|
@ -68,8 +68,8 @@ func LoadPlug(m *ice.Message, language ...string) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func PlugAction() map[string]*ice.Action {
|
func PlugAction() ice.Actions {
|
||||||
return map[string]*ice.Action{
|
return ice.Actions{
|
||||||
mdb.PLUGIN: {Hand: func(m *ice.Message, arg ...string) { 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.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])) }},
|
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(nfs.CAT, path.Join(arg[2], arg[1])) }},
|
||||||
@ -98,8 +98,8 @@ const (
|
|||||||
const INNER = "inner"
|
const INNER = "inner"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
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{
|
INNER: {Name: "inner path=src/@key file=main.go line=1 auto", Help: "源代码", Meta: kit.Dict(ice.DisplayLocal("")), Actions: ice.MergeAction(ice.Actions{
|
||||||
mdb.PLUGIN: {Name: "plugin", Help: "插件", Hand: func(m *ice.Message, arg ...string) {
|
mdb.PLUGIN: {Name: "plugin", Help: "插件", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Cmdy(mdb.PLUGIN, arg); m.Result() == "" {
|
if m.Cmdy(mdb.PLUGIN, arg); m.Result() == "" {
|
||||||
m.Echo(kit.Select("{}", m.Config(kit.Keys(PLUG, arg[0]))))
|
m.Echo(kit.Select("{}", m.Config(kit.Keys(PLUG, arg[0]))))
|
||||||
@ -117,7 +117,7 @@ func init() {
|
|||||||
m.Option(nfs.DIR_ROOT, arg[2])
|
m.Option(nfs.DIR_ROOT, arg[2])
|
||||||
m.Option(cli.CMD_DIR, kit.Path(arg[2]))
|
m.Option(cli.CMD_DIR, kit.Path(arg[2]))
|
||||||
m.Cmdy(mdb.SEARCH, arg[0], arg[1], arg[2])
|
m.Cmdy(mdb.SEARCH, arg[0], arg[1], arg[2])
|
||||||
m.Cmd(FAVOR, arg[1], ice.OptionFields("")).Tables(func(value map[string]string) {
|
m.Cmd(FAVOR, arg[1], ice.OptionFields("")).Tables(func(value ice.Maps) {
|
||||||
if p := path.Join(value[nfs.PATH], value[nfs.FILE]); strings.HasPrefix(p, m.Option(nfs.PATH)) {
|
if p := path.Join(value[nfs.PATH], value[nfs.FILE]); strings.HasPrefix(p, m.Option(nfs.PATH)) {
|
||||||
m.Push(nfs.FILE, strings.TrimPrefix(p, m.Option(nfs.PATH)))
|
m.Push(nfs.FILE, strings.TrimPrefix(p, m.Option(nfs.PATH)))
|
||||||
m.Push(nfs.LINE, value[nfs.LINE])
|
m.Push(nfs.LINE, value[nfs.LINE])
|
||||||
@ -197,7 +197,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
m.Set(ice.MSG_STATUS)
|
m.Set(ice.MSG_STATUS)
|
||||||
}},
|
}},
|
||||||
}, Configs: map[string]*ice.Config{
|
}, Configs: ice.Configs{
|
||||||
INNER: {Name: "inner", Help: "源代码", Value: kit.Data(
|
INNER: {Name: "inner", Help: "源代码", Value: kit.Data(
|
||||||
EXEC, kit.Dict("py", []string{"python"}),
|
EXEC, kit.Dict("py", []string{"python"}),
|
||||||
PLUG, kit.Dict(
|
PLUG, kit.Dict(
|
||||||
|
@ -105,7 +105,7 @@ func _install_spawn(m *ice.Message, arg ...string) {
|
|||||||
if m.Option(INSTALL) == "" && kit.FileExists(kit.Path(source, "_install")) {
|
if m.Option(INSTALL) == "" && kit.FileExists(kit.Path(source, "_install")) {
|
||||||
m.Option(INSTALL, "_install")
|
m.Option(INSTALL, "_install")
|
||||||
}
|
}
|
||||||
m.Cmd(nfs.DIR, path.Join(source, m.Option(INSTALL))).Tables(func(value map[string]string) {
|
m.Cmd(nfs.DIR, path.Join(source, m.Option(INSTALL))).Tables(func(value ice.Maps) {
|
||||||
m.Cmd(cli.SYSTEM, "cp", "-r", strings.TrimSuffix(value[nfs.PATH], ice.PS), target+ice.PS)
|
m.Cmd(cli.SYSTEM, "cp", "-r", strings.TrimSuffix(value[nfs.PATH], ice.PS), target+ice.PS)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -127,7 +127,7 @@ func _install_start(m *ice.Message, arg ...string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
func _install_stop(m *ice.Message, arg ...string) {
|
func _install_stop(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(cli.DAEMON).Tables(func(value map[string]string) {
|
m.Cmd(cli.DAEMON).Tables(func(value ice.Maps) {
|
||||||
if value[cli.PID] == m.Option(cli.PID) {
|
if value[cli.PID] == m.Option(cli.PID) {
|
||||||
m.Cmd(cli.DAEMON, cli.STOP, kit.Dict(mdb.HASH, value[mdb.HASH]))
|
m.Cmd(cli.DAEMON, cli.STOP, kit.Dict(mdb.HASH, value[mdb.HASH]))
|
||||||
}
|
}
|
||||||
@ -137,12 +137,12 @@ func _install_stop(m *ice.Message, arg ...string) {
|
|||||||
func _install_service(m *ice.Message, arg ...string) {
|
func _install_service(m *ice.Message, arg ...string) {
|
||||||
arg = kit.Split(path.Base(arg[0]), "-.")[:1]
|
arg = kit.Split(path.Base(arg[0]), "-.")[:1]
|
||||||
m.Fields(len(arg[1:]), "time,port,status,pid,cmd,dir")
|
m.Fields(len(arg[1:]), "time,port,status,pid,cmd,dir")
|
||||||
m.Cmd(mdb.SELECT, cli.DAEMON, "", mdb.HASH).Tables(func(value map[string]string) {
|
m.Cmd(mdb.SELECT, cli.DAEMON, "", mdb.HASH).Tables(func(value ice.Maps) {
|
||||||
if strings.Contains(value[ice.CMD], path.Join(ice.BIN, arg[0])) {
|
if strings.Contains(value[ice.CMD], path.Join(ice.BIN, arg[0])) {
|
||||||
m.Push("", value, kit.Split(m.OptionFields()))
|
m.Push("", value, kit.Split(m.OptionFields()))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
m.Set(tcp.PORT).Tables(func(value map[string]string) { m.Push(tcp.PORT, path.Base(value[nfs.DIR])) })
|
m.Set(tcp.PORT).Tables(func(value ice.Maps) { m.Push(tcp.PORT, path.Base(value[nfs.DIR])) })
|
||||||
m.StatusTimeCount()
|
m.StatusTimeCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -152,12 +152,12 @@ const (
|
|||||||
const INSTALL = "install"
|
const INSTALL = "install"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
INSTALL: {Name: INSTALL, Help: "安装", Value: kit.Data(
|
INSTALL: {Name: INSTALL, Help: "安装", Value: kit.Data(
|
||||||
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,path,link", nfs.PATH, ice.USR_INSTALL,
|
mdb.SHORT, mdb.NAME, mdb.FIELD, "time,name,path,link", nfs.PATH, ice.USR_INSTALL,
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
INSTALL: {Name: "install name port path auto download", Help: "安装", Meta: kit.Dict(), Action: ice.MergeAction(map[string]*ice.Action{
|
INSTALL: {Name: "install name port path auto download", Help: "安装", Meta: kit.Dict(), Actions: ice.MergeAction(ice.Actions{
|
||||||
web.DOWNLOAD: {Name: "download link path", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
|
web.DOWNLOAD: {Name: "download link path", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_install_download(m)
|
_install_download(m)
|
||||||
}},
|
}},
|
||||||
@ -204,8 +204,8 @@ func init() {
|
|||||||
}})
|
}})
|
||||||
}
|
}
|
||||||
|
|
||||||
func InstallAction(args ...ice.Any) map[string]*ice.Action {
|
func InstallAction(args ...ice.Any) ice.Actions {
|
||||||
return map[string]*ice.Action{ice.CTX_INIT: mdb.AutoConfig(args...),
|
return ice.Actions{ice.CTX_INIT: mdb.AutoConfig(args...),
|
||||||
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.Cmdy(INSTALL, web.DOWNLOAD, m.Config(nfs.SOURCE))
|
m.Cmdy(INSTALL, web.DOWNLOAD, m.Config(nfs.SOURCE))
|
||||||
}},
|
}},
|
||||||
|
@ -51,8 +51,8 @@ const JSON = "json"
|
|||||||
const NODE = "node"
|
const NODE = "node"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Register(&ice.Context{Name: JS, Help: "前端", Commands: map[string]*ice.Command{
|
Index.Register(&ice.Context{Name: JS, Help: "前端", Commands: ice.Commands{
|
||||||
JS: {Name: "js", Help: "前端", Action: ice.MergeAction(map[string]*ice.Action{
|
JS: {Name: "js", Help: "前端", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
for _, cmd := range []string{mdb.SEARCH, mdb.ENGINE, mdb.RENDER, mdb.PLUGIN} {
|
for _, cmd := range []string{mdb.SEARCH, mdb.ENGINE, mdb.RENDER, mdb.PLUGIN} {
|
||||||
m.Cmd(cmd, mdb.CREATE, JSON, m.PrefixKey())
|
m.Cmd(cmd, mdb.CREATE, JSON, m.PrefixKey())
|
||||||
@ -83,12 +83,12 @@ func init() {
|
|||||||
_go_grep(m, kit.Select(cli.MAIN, arg, 1), arg[2])
|
_go_grep(m, kit.Select(cli.MAIN, arg, 1), arg[2])
|
||||||
}},
|
}},
|
||||||
}, PlugAction())},
|
}, PlugAction())},
|
||||||
NODE: {Name: "node auto download", Help: "前端", Action: map[string]*ice.Action{
|
NODE: {Name: "node auto download", Help: "前端", Actions: ice.Actions{
|
||||||
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.Cmdy(INSTALL, m.Config(nfs.SOURCE))
|
m.Cmdy(INSTALL, m.Config(nfs.SOURCE))
|
||||||
}},
|
}},
|
||||||
}},
|
}},
|
||||||
}, Configs: map[string]*ice.Config{
|
}, Configs: ice.Configs{
|
||||||
NODE: {Name: NODE, Help: "前端", Value: kit.Data(
|
NODE: {Name: NODE, Help: "前端", Value: kit.Data(
|
||||||
nfs.SOURCE, "https://nodejs.org/dist/v10.13.0/node-v10.13.0-linux-x64.tar.xz",
|
nfs.SOURCE, "https://nodejs.org/dist/v10.13.0/node-v10.13.0-linux-x64.tar.xz",
|
||||||
)},
|
)},
|
||||||
|
@ -22,10 +22,10 @@ func init() {
|
|||||||
LOGIN_OAUTH = "https://github.com/login/oauth/"
|
LOGIN_OAUTH = "https://github.com/login/oauth/"
|
||||||
API_GITHUB = "https://api.github.com/"
|
API_GITHUB = "https://api.github.com/"
|
||||||
)
|
)
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
OAUTH: {Name: OAUTH, Help: "授权", Value: kit.Data(mdb.FIELD, "time,hash,code,access_token,scope,token_type")},
|
OAUTH: {Name: OAUTH, Help: "授权", Value: kit.Data(mdb.FIELD, "time,hash,code,access_token,scope,token_type")},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
OAUTH: {Name: "oauth hash auto", Help: "授权", Action: ice.MergeAction(map[string]*ice.Action{
|
OAUTH: {Name: "oauth hash auto", Help: "授权", Actions: ice.MergeAction(ice.Actions{
|
||||||
ctx.CONFIG: {Name: "config client_id client_secret redirect_uri", Help: "配置", Hand: func(m *ice.Message, arg ...string) {
|
ctx.CONFIG: {Name: "config client_id client_secret redirect_uri", Help: "配置", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.ConfigOption(CLIENT_ID, CLIENT_SECRET, REDIRECT_URI)
|
m.ConfigOption(CLIENT_ID, CLIENT_SECRET, REDIRECT_URI)
|
||||||
}},
|
}},
|
||||||
@ -77,7 +77,7 @@ func init() {
|
|||||||
m.Debug("what %v", m.FormatMeta())
|
m.Debug("what %v", m.FormatMeta())
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
"/oauth": {Name: "/oauth", Help: "授权", Action: ice.MergeAction(map[string]*ice.Action{}, ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
"/oauth": {Name: "/oauth", Help: "授权", Actions: ice.MergeAction(ice.Actions{}, ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Option(CODE) != "" {
|
if m.Option(CODE) != "" {
|
||||||
m.RenderCmd(m.PrefixKey(), m.Cmdx(m.PrefixKey(), mdb.CREATE, m.OptionSimple(CODE)))
|
m.RenderCmd(m.PrefixKey(), m.Cmdx(m.PrefixKey(), mdb.CREATE, m.OptionSimple(CODE)))
|
||||||
}
|
}
|
||||||
|
@ -24,12 +24,12 @@ const (
|
|||||||
const PPROF = "pprof"
|
const PPROF = "pprof"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
PPROF: {Name: PPROF, Help: "性能分析", Value: kit.Data(
|
PPROF: {Name: PPROF, Help: "性能分析", Value: kit.Data(
|
||||||
mdb.SHORT, mdb.ZONE, mdb.FIELD, "time,id,text,file", PPROF, kit.List(GO, "tool", PPROF),
|
mdb.SHORT, mdb.ZONE, mdb.FIELD, "time,id,text,file", PPROF, kit.List(GO, "tool", PPROF),
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
PPROF: {Name: "pprof zone id auto", Help: "性能分析", Action: ice.MergeAction(map[string]*ice.Action{
|
PPROF: {Name: "pprof zone id auto", Help: "性能分析", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
web.AddRewrite(func(w http.ResponseWriter, r *http.Request) bool {
|
web.AddRewrite(func(w http.ResponseWriter, r *http.Request) bool {
|
||||||
if p := r.URL.Path; strings.HasPrefix(p, "/debug") {
|
if p := r.URL.Path; strings.HasPrefix(p, "/debug") {
|
||||||
@ -44,7 +44,7 @@ func init() {
|
|||||||
case BINNARY:
|
case BINNARY:
|
||||||
m.Cmdy(nfs.DIR, ice.BIN, nfs.DIR_CLI_FIELDS).RenameAppend(nfs.PATH, BINNARY)
|
m.Cmdy(nfs.DIR, ice.BIN, nfs.DIR_CLI_FIELDS).RenameAppend(nfs.PATH, BINNARY)
|
||||||
case SERVICE:
|
case SERVICE:
|
||||||
m.Cmd(web.SPIDE).Tables(func(value map[string]string) {
|
m.Cmd(web.SPIDE).Tables(func(value ice.Maps) {
|
||||||
m.Push(SERVICE, kit.MergeURL2(value["client.url"], "/debug/pprof/profile"))
|
m.Push(SERVICE, kit.MergeURL2(value["client.url"], "/debug/pprof/profile"))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ func init() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
m.Tables(func(value map[string]string) {
|
m.Tables(func(value ice.Maps) {
|
||||||
m.PushDownload(mdb.LINK, "pprof.pd.gz", value[nfs.FILE])
|
m.PushDownload(mdb.LINK, "pprof.pd.gz", value[nfs.FILE])
|
||||||
m.PushButton(web.SERVE)
|
m.PushButton(web.SERVE)
|
||||||
})
|
})
|
||||||
|
@ -60,10 +60,10 @@ const (
|
|||||||
const PUBLISH = "publish"
|
const PUBLISH = "publish"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
PUBLISH: {Name: PUBLISH, Help: "发布", Value: kit.Data(nfs.PATH, ice.USR_PUBLISH, ice.CONTEXTS, _contexts)},
|
PUBLISH: {Name: PUBLISH, Help: "发布", Value: kit.Data(nfs.PATH, ice.USR_PUBLISH, ice.CONTEXTS, _contexts)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
PUBLISH: {Name: "publish path auto create volcanos icebergs intshell export", Help: "发布", Action: map[string]*ice.Action{
|
PUBLISH: {Name: "publish path auto create volcanos icebergs intshell export", Help: "发布", Actions: ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(aaa.ROLE, aaa.WHITE, aaa.VOID, m.Config(nfs.PATH))
|
m.Cmd(aaa.ROLE, aaa.WHITE, aaa.VOID, m.Config(nfs.PATH))
|
||||||
m.Cmd(aaa.ROLE, aaa.WHITE, aaa.VOID, m.PrefixKey())
|
m.Cmd(aaa.ROLE, aaa.WHITE, aaa.VOID, m.PrefixKey())
|
||||||
|
@ -26,8 +26,8 @@ func _py_main_script(m *ice.Message, arg ...string) {
|
|||||||
const PY = nfs.PY
|
const PY = nfs.PY
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
PY: {Name: "py path auto", Help: "脚本", Action: ice.MergeAction(map[string]*ice.Action{
|
PY: {Name: "py path auto", Help: "脚本", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(mdb.ENGINE, mdb.CREATE, PY, m.PrefixKey())
|
m.Cmd(mdb.ENGINE, mdb.CREATE, PY, m.PrefixKey())
|
||||||
m.Cmd(mdb.RENDER, mdb.CREATE, PY, m.PrefixKey())
|
m.Cmd(mdb.RENDER, mdb.CREATE, PY, m.PrefixKey())
|
||||||
@ -48,7 +48,7 @@ func init() {
|
|||||||
m.Option(nfs.DIR_REG, ".*.(py)$")
|
m.Option(nfs.DIR_REG, ".*.(py)$")
|
||||||
m.Cmdy(nfs.DIR, arg)
|
m.Cmdy(nfs.DIR, arg)
|
||||||
}},
|
}},
|
||||||
}, Configs: map[string]*ice.Config{
|
}, Configs: ice.Configs{
|
||||||
PY: {Name: PY, Help: "脚本", Value: kit.Data(PLUG, kit.Dict(
|
PY: {Name: PY, Help: "脚本", Value: kit.Data(PLUG, kit.Dict(
|
||||||
SPLIT, kit.Dict(SPACE, " ", OPERATE, "{[(.,;!|<>)]}"),
|
SPLIT, kit.Dict(SPACE, " ", OPERATE, "{[(.,;!|<>)]}"),
|
||||||
PREFIX, kit.Dict("#!", COMMENT, "# ", COMMENT), SUFFIX, kit.Dict(" {", COMMENT),
|
PREFIX, kit.Dict("#!", COMMENT, "# ", COMMENT), SUFFIX, kit.Dict(" {", COMMENT),
|
||||||
|
@ -58,8 +58,8 @@ func _sh_exec(m *ice.Message, arg ...string) {
|
|||||||
const SH = nfs.SH
|
const SH = nfs.SH
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Register(&ice.Context{Name: SH, Help: "命令", Commands: map[string]*ice.Command{
|
Index.Register(&ice.Context{Name: SH, Help: "命令", Commands: ice.Commands{
|
||||||
SH: {Name: "sh path auto", Help: "命令", Action: ice.MergeAction(map[string]*ice.Action{
|
SH: {Name: "sh path auto", Help: "命令", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Name: "_init", Help: "初始化", Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Name: "_init", Help: "初始化", Hand: func(m *ice.Message, arg ...string) {
|
||||||
for _, cmd := range []string{mdb.SEARCH, mdb.ENGINE, mdb.RENDER, mdb.PLUGIN} {
|
for _, cmd := range []string{mdb.SEARCH, mdb.ENGINE, mdb.RENDER, mdb.PLUGIN} {
|
||||||
m.Cmd(cmd, mdb.CREATE, m.CommandKey(), m.PrefixKey())
|
m.Cmd(cmd, mdb.CREATE, m.CommandKey(), m.PrefixKey())
|
||||||
@ -92,7 +92,7 @@ func init() {
|
|||||||
m.Option(nfs.DIR_REG, ".*.(sh)$")
|
m.Option(nfs.DIR_REG, ".*.(sh)$")
|
||||||
m.Cmdy(nfs.DIR, arg)
|
m.Cmdy(nfs.DIR, arg)
|
||||||
}},
|
}},
|
||||||
}, Configs: map[string]*ice.Config{
|
}, Configs: ice.Configs{
|
||||||
SH: {Name: SH, Help: "命令", Value: kit.Data(PLUG, kit.Dict(
|
SH: {Name: SH, Help: "命令", Value: kit.Data(PLUG, kit.Dict(
|
||||||
SPLIT, kit.Dict(SPACE, " ", OPERATE, "{[(.,;!|<>)]}"),
|
SPLIT, kit.Dict(SPACE, " ", OPERATE, "{[(.,;!|<>)]}"),
|
||||||
PREFIX, kit.Dict("#!", COMMENT, "# ", COMMENT), SUFFIX, kit.Dict(" {", COMMENT),
|
PREFIX, kit.Dict("#!", COMMENT, "# ", COMMENT), SUFFIX, kit.Dict(" {", COMMENT),
|
||||||
|
@ -34,8 +34,8 @@ func _shy_exec(m *ice.Message, arg ...string) {
|
|||||||
const SHY = "shy"
|
const SHY = "shy"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Register(&ice.Context{Name: SHY, Help: "脚本", Commands: map[string]*ice.Command{
|
Index.Register(&ice.Context{Name: SHY, Help: "脚本", Commands: ice.Commands{
|
||||||
SHY: {Name: "shy path auto", Help: "脚本", Action: ice.MergeAction(map[string]*ice.Action{
|
SHY: {Name: "shy path auto", Help: "脚本", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
for _, cmd := range []string{mdb.SEARCH, mdb.ENGINE, mdb.RENDER, mdb.PLUGIN} {
|
for _, cmd := range []string{mdb.SEARCH, mdb.ENGINE, mdb.RENDER, mdb.PLUGIN} {
|
||||||
m.Cmd(cmd, mdb.CREATE, SHY, m.PrefixKey())
|
m.Cmd(cmd, mdb.CREATE, SHY, m.PrefixKey())
|
||||||
@ -61,7 +61,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
m.Cmdy("web.wiki.word", arg)
|
m.Cmdy("web.wiki.word", arg)
|
||||||
}},
|
}},
|
||||||
}, Configs: map[string]*ice.Config{
|
}, Configs: ice.Configs{
|
||||||
SHY: {Name: SHY, Help: "脚本", Value: kit.Data(PLUG, kit.Dict(
|
SHY: {Name: SHY, Help: "脚本", Value: kit.Data(PLUG, kit.Dict(
|
||||||
mdb.RENDER, kit.Dict(),
|
mdb.RENDER, kit.Dict(),
|
||||||
PREFIX, kit.Dict("# ", COMMENT), PREPARE, kit.Dict(
|
PREFIX, kit.Dict("# ", COMMENT), PREPARE, kit.Dict(
|
||||||
|
@ -13,8 +13,8 @@ import (
|
|||||||
const TEMPLATE = "template"
|
const TEMPLATE = "template"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
TEMPLATE: {Name: "template name auto", Help: "模板", Action: ice.MergeAction(map[string]*ice.Action{
|
TEMPLATE: {Name: "template name auto", Help: "模板", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
for _, _template := range _template_list {
|
for _, _template := range _template_list {
|
||||||
m.Cmd(TEMPLATE, mdb.CREATE, kit.SimpleKV(kit.Format(_template[0]), _template[1:]...))
|
m.Cmd(TEMPLATE, mdb.CREATE, kit.SimpleKV(kit.Format(_template[0]), _template[1:]...))
|
||||||
|
@ -16,14 +16,14 @@ import (
|
|||||||
const UPGRADE = "upgrade"
|
const UPGRADE = "upgrade"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
UPGRADE: {Name: UPGRADE, Help: "升级", Value: kit.Dict(mdb.HASH, kit.Dict(
|
UPGRADE: {Name: UPGRADE, Help: "升级", Value: kit.Dict(mdb.HASH, kit.Dict(
|
||||||
nfs.TARGET, kit.Dict(mdb.LIST, kit.List(mdb.TYPE, "bin", nfs.FILE, "ice.bin")),
|
nfs.TARGET, kit.Dict(mdb.LIST, kit.List(mdb.TYPE, "bin", nfs.FILE, "ice.bin")),
|
||||||
nfs.SOURCE, kit.Dict(mdb.LIST, kit.List(mdb.TYPE, "tar", nfs.FILE, "contexts.src.tar.gz")),
|
nfs.SOURCE, kit.Dict(mdb.LIST, kit.List(mdb.TYPE, "tar", nfs.FILE, "contexts.src.tar.gz")),
|
||||||
nfs.BINARY, kit.Dict(mdb.LIST, kit.List(mdb.TYPE, "tar", nfs.FILE, "contexts.bin.tar.gz")),
|
nfs.BINARY, kit.Dict(mdb.LIST, kit.List(mdb.TYPE, "tar", nfs.FILE, "contexts.bin.tar.gz")),
|
||||||
))},
|
))},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
UPGRADE: {Name: "upgrade item=target,source,binary run restart", Help: "升级", Action: map[string]*ice.Action{
|
UPGRADE: {Name: "upgrade item=target,source,binary run restart", Help: "升级", Actions: ice.Actions{
|
||||||
cli.RESTART: {Name: "restart", Help: "重启", Hand: func(m *ice.Message, arg ...string) {
|
cli.RESTART: {Name: "restart", Help: "重启", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Sleep("1s").Go(func() { m.Cmd(ice.EXIT, 1) })
|
m.Sleep("1s").Go(func() { m.Cmd(ice.EXIT, 1) })
|
||||||
}},
|
}},
|
||||||
|
@ -145,8 +145,8 @@ func _vimer_go_complete(m *ice.Message, name string, arg ...string) *ice.Message
|
|||||||
const VIMER = "vimer"
|
const VIMER = "vimer"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
VIMER: {Name: "vimer path=src/ file=main.go line=1 list", Help: "编辑器", Meta: kit.Dict(ice.DisplayLocal("", INNER)), Action: map[string]*ice.Action{
|
VIMER: {Name: "vimer path=src/ file=main.go line=1 list", Help: "编辑器", Meta: kit.Dict(ice.DisplayLocal("", INNER)), Actions: ice.Actions{
|
||||||
nfs.SAVE: {Name: "save type file path", Help: "保存", Hand: func(m *ice.Message, arg ...string) {
|
nfs.SAVE: {Name: "save type file path", Help: "保存", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Option(nfs.CONTENT, kit.Select(_vimer_defs(m, kit.Ext(m.Option(nfs.FILE))), m.Option(nfs.CONTENT)))
|
m.Option(nfs.CONTENT, kit.Select(_vimer_defs(m, kit.Ext(m.Option(nfs.FILE))), m.Option(nfs.CONTENT)))
|
||||||
m.Cmdy(nfs.SAVE, path.Join(m.Option(nfs.PATH), m.Option(nfs.FILE)))
|
m.Cmdy(nfs.SAVE, path.Join(m.Option(nfs.PATH), m.Option(nfs.FILE)))
|
||||||
|
@ -48,7 +48,7 @@ func _webpack_cache(m *ice.Message, dir string, write bool) {
|
|||||||
m.Option(nfs.DIR_PACK, true)
|
m.Option(nfs.DIR_PACK, true)
|
||||||
m.Option(nfs.DIR_TYPE, nfs.CAT)
|
m.Option(nfs.DIR_TYPE, nfs.CAT)
|
||||||
|
|
||||||
// m.Cmd(nfs.DIR, ice.SRC).Tables(func(value map[string]string) {
|
// m.Cmd(nfs.DIR, ice.SRC).Tables(func(value ice.Maps) {
|
||||||
// if kit.Ext(value[nfs.PATH]) == JS {
|
// if kit.Ext(value[nfs.PATH]) == JS {
|
||||||
// fmt.Fprintln(js, `_can_name = "`+path.Join("/require", ice.Info.Make.Module, value[nfs.PATH])+`"`)
|
// fmt.Fprintln(js, `_can_name = "`+path.Join("/require", ice.Info.Make.Module, value[nfs.PATH])+`"`)
|
||||||
// fmt.Fprintln(js, m.Cmdx(nfs.CAT, value[nfs.PATH]))
|
// fmt.Fprintln(js, m.Cmdx(nfs.CAT, value[nfs.PATH]))
|
||||||
@ -57,7 +57,7 @@ func _webpack_cache(m *ice.Message, dir string, write bool) {
|
|||||||
|
|
||||||
m.Option(nfs.DIR_ROOT, dir)
|
m.Option(nfs.DIR_ROOT, dir)
|
||||||
for _, k := range []string{LIB, PANEL, PLUGIN} {
|
for _, k := range []string{LIB, PANEL, PLUGIN} {
|
||||||
m.Cmd(nfs.DIR, k).Tables(func(value map[string]string) {
|
m.Cmd(nfs.DIR, k).Tables(func(value ice.Maps) {
|
||||||
if kit.Ext(value[nfs.PATH]) == CSS {
|
if kit.Ext(value[nfs.PATH]) == CSS {
|
||||||
fmt.Fprintln(css, m.Cmdx(nfs.CAT, value[nfs.PATH]))
|
fmt.Fprintln(css, m.Cmdx(nfs.CAT, value[nfs.PATH]))
|
||||||
fmt.Fprintln(js, `Volcanos.meta.cache["`+path.Join(ice.PS, value[nfs.PATH])+`"] = []`)
|
fmt.Fprintln(js, `Volcanos.meta.cache["`+path.Join(ice.PS, value[nfs.PATH])+`"] = []`)
|
||||||
@ -66,7 +66,7 @@ func _webpack_cache(m *ice.Message, dir string, write bool) {
|
|||||||
}
|
}
|
||||||
fmt.Fprintln(js)
|
fmt.Fprintln(js)
|
||||||
for _, k := range []string{LIB, PANEL, PLUGIN} {
|
for _, k := range []string{LIB, PANEL, PLUGIN} {
|
||||||
m.Cmd(nfs.DIR, k).Tables(func(value map[string]string) {
|
m.Cmd(nfs.DIR, k).Tables(func(value ice.Maps) {
|
||||||
if kit.Ext(value[nfs.PATH]) == JS {
|
if kit.Ext(value[nfs.PATH]) == JS {
|
||||||
fmt.Fprintln(js, `_can_name = "`+path.Join(ice.PS, value[nfs.PATH])+`"`)
|
fmt.Fprintln(js, `_can_name = "`+path.Join(ice.PS, value[nfs.PATH])+`"`)
|
||||||
fmt.Fprintln(js, m.Cmdx(nfs.CAT, value[nfs.PATH]))
|
fmt.Fprintln(js, m.Cmdx(nfs.CAT, value[nfs.PATH]))
|
||||||
@ -134,8 +134,8 @@ const DEVPACK = "devpack"
|
|||||||
const WEBPACK = "webpack"
|
const WEBPACK = "webpack"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: ice.Commands{
|
||||||
WEBPACK: {Name: "webpack path auto create remove", Help: "打包", Action: map[string]*ice.Action{
|
WEBPACK: {Name: "webpack path auto create remove", Help: "打包", Actions: ice.Actions{
|
||||||
mdb.CREATE: {Name: "create", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_webpack_cache(m.Spawn(), _volcanos(m), true)
|
_webpack_cache(m.Spawn(), _volcanos(m), true)
|
||||||
}},
|
}},
|
||||||
|
@ -27,8 +27,8 @@ func _website_url(m *ice.Message, file string) string {
|
|||||||
const ZML = nfs.ZML
|
const ZML = nfs.ZML
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Register(&ice.Context{Name: ZML, Help: "网页", Commands: map[string]*ice.Command{
|
Index.Register(&ice.Context{Name: ZML, Help: "网页", Commands: ice.Commands{
|
||||||
ZML: {Name: "zml", Help: "网页", Action: ice.MergeAction(map[string]*ice.Action{
|
ZML: {Name: "zml", Help: "网页", Actions: ice.MergeAction(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(mdb.PLUGIN, mdb.CREATE, nfs.ZML, m.PrefixKey())
|
m.Cmd(mdb.PLUGIN, mdb.CREATE, nfs.ZML, m.PrefixKey())
|
||||||
m.Cmd(mdb.RENDER, mdb.CREATE, nfs.ZML, m.PrefixKey())
|
m.Cmd(mdb.RENDER, mdb.CREATE, nfs.ZML, m.PrefixKey())
|
||||||
@ -38,7 +38,7 @@ func init() {
|
|||||||
m.EchoIFrame(_website_url(m, strings.TrimPrefix(path.Join(arg[2], arg[1]), SRC_WEBSITE)))
|
m.EchoIFrame(_website_url(m, strings.TrimPrefix(path.Join(arg[2], arg[1]), SRC_WEBSITE)))
|
||||||
}},
|
}},
|
||||||
}, PlugAction())},
|
}, PlugAction())},
|
||||||
}, Configs: map[string]*ice.Config{
|
}, Configs: ice.Configs{
|
||||||
ZML: {Name: ZML, Help: "网页", Value: kit.Data(PLUG, kit.Dict(PREFIX, kit.Dict("# ", COMMENT), PREPARE, kit.Dict(
|
ZML: {Name: ZML, Help: "网页", Value: kit.Data(PLUG, kit.Dict(PREFIX, kit.Dict("# ", COMMENT), PREPARE, kit.Dict(
|
||||||
KEYWORD, kit.Simple(
|
KEYWORD, kit.Simple(
|
||||||
"head", "left", "main", "foot",
|
"head", "left", "main", "foot",
|
||||||
|
@ -59,15 +59,15 @@ const (
|
|||||||
const ASSET = "asset"
|
const ASSET = "asset"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: ice.Configs{
|
||||||
ASSET: {Name: ASSET, Help: "资产", Value: kit.Data(
|
ASSET: {Name: ASSET, Help: "资产", Value: kit.Data(
|
||||||
mdb.SHORT, ACCOUNT, mdb.FIELD, "time,id,type,amount,name,text",
|
mdb.SHORT, ACCOUNT, mdb.FIELD, "time,id,type,amount,name,text",
|
||||||
mdb.ALIAS, kit.Dict(FROM, ACCOUNT, TO, ACCOUNT),
|
mdb.ALIAS, kit.Dict(FROM, ACCOUNT, TO, ACCOUNT),
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: ice.Commands{
|
||||||
ASSET: {Name: "asset account id auto spend trans bonus", Help: "资产", Meta: kit.Dict(
|
ASSET: {Name: "asset account id auto spend trans bonus", Help: "资产", Meta: kit.Dict(
|
||||||
"_trans", kit.Dict(ACCOUNT, "账户", AMOUNT, "金额", FROM, "转出", TO, "转入", "time", "时间", "name", "商家", "text", "备注"),
|
"_trans", kit.Dict(ACCOUNT, "账户", AMOUNT, "金额", FROM, "转出", TO, "转入", "time", "时间", "name", "商家", "text", "备注"),
|
||||||
), Action: ice.MergeAction(map[string]*ice.Action{
|
), Actions: ice.MergeAction(ice.Actions{
|
||||||
SPEND: {Name: "spend account name amount time@date text", Help: "支出", Hand: func(m *ice.Message, arg ...string) {
|
SPEND: {Name: "spend account name amount time@date text", Help: "支出", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_sub_amount(m, arg)
|
_sub_amount(m, arg)
|
||||||
_asset_insert(m, arg[1], kit.Simple(mdb.TYPE, "支出", arg[2:])...)
|
_asset_insert(m, arg[1], kit.Simple(mdb.TYPE, "支出", arg[2:])...)
|
||||||
@ -82,7 +82,7 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
CHECK: {Name: "check", Help: "核算", Hand: func(m *ice.Message, arg ...string) {
|
CHECK: {Name: "check", Help: "核算", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Option(ACCOUNT) == "" {
|
if m.Option(ACCOUNT) == "" {
|
||||||
m.Cmd(ASSET).Table(func(index int, value map[string]string, head []string) {
|
m.Cmd(ASSET).Table(func(index int, value ice.Maps, head []string) {
|
||||||
_asset_check(m, value[ACCOUNT])
|
_asset_check(m, value[ACCOUNT])
|
||||||
})
|
})
|
||||||
m.ProcessRefresh30ms()
|
m.ProcessRefresh30ms()
|
||||||
@ -98,7 +98,7 @@ func init() {
|
|||||||
m.PushAction(CHECK)
|
m.PushAction(CHECK)
|
||||||
m.SortIntR(AMOUNT)
|
m.SortIntR(AMOUNT)
|
||||||
|
|
||||||
m.Table(func(index int, value map[string]string, head []string) {
|
m.Table(func(index int, value ice.Maps, head []string) {
|
||||||
amount += kit.Int(value[AMOUNT])
|
amount += kit.Int(value[AMOUNT])
|
||||||
count += kit.Int(value[COUNT])
|
count += kit.Int(value[COUNT])
|
||||||
})
|
})
|
||||||
@ -106,7 +106,7 @@ func init() {
|
|||||||
} else {
|
} else {
|
||||||
m.PushAction(mdb.PLUGIN)
|
m.PushAction(mdb.PLUGIN)
|
||||||
|
|
||||||
m.Table(func(index int, value map[string]string, head []string) {
|
m.Table(func(index int, value ice.Maps, head []string) {
|
||||||
amount += kit.Int(value[AMOUNT])
|
amount += kit.Int(value[AMOUNT])
|
||||||
count++
|
count++
|
||||||
})
|
})
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user