forked from x/icebergs
opt some
This commit is contained in:
parent
a2219676ff
commit
1fff54b9bb
@ -38,7 +38,7 @@ func _daemon_exec(m *ice.Message, cmd *exec.Cmd) {
|
|||||||
m.Cmd(mdb.MODIFY, DAEMON, "", mdb.HASH, mdb.HASH, h, STATUS, ERROR, ERROR, e)
|
m.Cmd(mdb.MODIFY, DAEMON, "", mdb.HASH, mdb.HASH, h, STATUS, ERROR, ERROR, e)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m.Cost(kit.MDB_CODE, cmd.ProcessState.ExitCode(), ctx.ARGS, cmd.Args)
|
m.Cost(CODE, cmd.ProcessState.ExitCode(), ctx.ARGS, cmd.Args)
|
||||||
m.Cmd(mdb.MODIFY, DAEMON, "", mdb.HASH, mdb.HASH, h, STATUS, STOP)
|
m.Cmd(mdb.MODIFY, DAEMON, "", mdb.HASH, mdb.HASH, h, STATUS, STOP)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,6 +85,8 @@ const (
|
|||||||
RESTART = "restart"
|
RESTART = "restart"
|
||||||
RELOAD = "reload"
|
RELOAD = "reload"
|
||||||
STOP = "stop"
|
STOP = "stop"
|
||||||
|
CODE = "code"
|
||||||
|
BACK = "back"
|
||||||
|
|
||||||
OPEN = "open"
|
OPEN = "open"
|
||||||
CLOSE = "close"
|
CLOSE = "close"
|
||||||
|
@ -143,7 +143,7 @@ func init() {
|
|||||||
m.Option(FG, kit.Select(BLUE, arg, 1))
|
m.Option(FG, kit.Select(BLUE, arg, 1))
|
||||||
|
|
||||||
if m.IsCliUA() {
|
if m.IsCliUA() {
|
||||||
_qrcode_cli(m, kit.Select(m.Conf("share", kit.Keym(kit.MDB_DOMAIN)), arg, 0))
|
_qrcode_cli(m, kit.Select(m.Conf("share", kit.Keym("domain")), arg, 0))
|
||||||
} else {
|
} else {
|
||||||
_qrcode_web(m, kit.Select(m.Option(ice.MSG_USERWEB), arg, 0))
|
_qrcode_web(m, kit.Select(m.Option(ice.MSG_USERWEB), arg, 0))
|
||||||
}
|
}
|
||||||
|
@ -70,14 +70,14 @@ func _system_exec(m *ice.Message, cmd *exec.Cmd) {
|
|||||||
|
|
||||||
// 执行命令
|
// 执行命令
|
||||||
if e := cmd.Run(); !m.Warn(e, ice.ErrNotFound, cmd.Args) {
|
if e := cmd.Run(); !m.Warn(e, ice.ErrNotFound, cmd.Args) {
|
||||||
m.Cost(kit.MDB_CODE, cmd.ProcessState.ExitCode(), ctx.ARGS, cmd.Args)
|
m.Cost(CODE, cmd.ProcessState.ExitCode(), ctx.ARGS, cmd.Args)
|
||||||
}
|
}
|
||||||
|
|
||||||
m.Push(mdb.TIME, m.Time())
|
m.Push(mdb.TIME, m.Time())
|
||||||
m.Push(kit.MDB_CODE, int(cmd.ProcessState.ExitCode()))
|
m.Push(CODE, int(cmd.ProcessState.ExitCode()))
|
||||||
}
|
}
|
||||||
func IsSuccess(m *ice.Message) bool {
|
func IsSuccess(m *ice.Message) bool {
|
||||||
return m.Append(kit.MDB_CODE) == "0" || m.Append(kit.MDB_CODE) == ""
|
return m.Append(CODE) == "0" || m.Append(CODE) == ""
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -55,6 +55,7 @@ const (
|
|||||||
INDEX = kit.MDB_INDEX
|
INDEX = kit.MDB_INDEX
|
||||||
VALUE = kit.MDB_VALUE
|
VALUE = kit.MDB_VALUE
|
||||||
EXTRA = kit.MDB_EXTRA
|
EXTRA = kit.MDB_EXTRA
|
||||||
|
ALIAS = kit.MDB_ALIAS
|
||||||
EXPIRE = kit.MDB_EXPIRE
|
EXPIRE = kit.MDB_EXPIRE
|
||||||
STATUS = kit.MDB_STATUS
|
STATUS = kit.MDB_STATUS
|
||||||
STREAM = kit.MDB_STREAM
|
STREAM = kit.MDB_STREAM
|
||||||
|
@ -137,7 +137,7 @@ func ZoneAction(args ...interface{}) map[string]*ice.Action {
|
|||||||
}},
|
}},
|
||||||
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(kit.MDB_ALIAS, arg[0])))
|
arg[0] = kit.Select(arg[0], m.Config(kit.Keys(ALIAS, arg[0])))
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case ice.POD:
|
case ice.POD:
|
||||||
m.Cmdy("route")
|
m.Cmdy("route")
|
||||||
|
@ -124,6 +124,16 @@ const (
|
|||||||
BRANCH = "branch"
|
BRANCH = "branch"
|
||||||
REPOS = "repos"
|
REPOS = "repos"
|
||||||
)
|
)
|
||||||
|
const (
|
||||||
|
HTML = "html"
|
||||||
|
CSS = "css"
|
||||||
|
JS = "js"
|
||||||
|
GO = "go"
|
||||||
|
SH = "sh"
|
||||||
|
CSV = "csv"
|
||||||
|
JSON = "json"
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
PATH = "path"
|
PATH = "path"
|
||||||
FILE = "file"
|
FILE = "file"
|
||||||
@ -136,10 +146,9 @@ func init() {
|
|||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
||||||
CAT: {Name: CAT, Help: "文件", Value: kit.Data(
|
CAT: {Name: CAT, Help: "文件", Value: kit.Data(
|
||||||
SOURCE, kit.Dict(
|
SOURCE, kit.Dict(
|
||||||
"sh", ice.TRUE, "go", ice.TRUE, "js", ice.TRUE,
|
HTML, ice.TRUE, CSS, ice.TRUE, JS, ice.TRUE, GO, ice.TRUE, SH, ice.TRUE, CSV, ice.TRUE, JSON, ice.TRUE,
|
||||||
"shy", ice.TRUE, "json", ice.TRUE, "csv", ice.TRUE,
|
"md", ice.TRUE, "shy", ice.TRUE, "makefile", ice.TRUE, "license", ice.TRUE,
|
||||||
"conf", ice.TRUE, "yaml", ice.TRUE, "yml", ice.TRUE,
|
"conf", ice.TRUE, "yaml", ice.TRUE, "yml", ice.TRUE,
|
||||||
"makefile", ice.TRUE, "license", ice.TRUE, "md", ice.TRUE,
|
|
||||||
),
|
),
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: map[string]*ice.Command{
|
||||||
|
58
conf.go
58
conf.go
@ -8,13 +8,6 @@ const (
|
|||||||
PT = "."
|
PT = "."
|
||||||
FS = ","
|
FS = ","
|
||||||
NL = "\n"
|
NL = "\n"
|
||||||
OF = " of "
|
|
||||||
|
|
||||||
PWD = "./"
|
|
||||||
|
|
||||||
SH = "sh"
|
|
||||||
GO = "go"
|
|
||||||
JS = "js"
|
|
||||||
|
|
||||||
OK = "ok"
|
OK = "ok"
|
||||||
TRUE = "true"
|
TRUE = "true"
|
||||||
@ -22,6 +15,7 @@ const (
|
|||||||
SUCCESS = "success"
|
SUCCESS = "success"
|
||||||
FAILURE = "failure"
|
FAILURE = "failure"
|
||||||
PROCESS = "process"
|
PROCESS = "process"
|
||||||
|
OF = " of "
|
||||||
|
|
||||||
INIT = "init"
|
INIT = "init"
|
||||||
LOAD = "load"
|
LOAD = "load"
|
||||||
@ -71,10 +65,10 @@ const ( // REPOS
|
|||||||
CONTEXTS = "contexts"
|
CONTEXTS = "contexts"
|
||||||
|
|
||||||
INSTALL = "install"
|
INSTALL = "install"
|
||||||
|
RELEASE = "release"
|
||||||
|
PUBLISH = "publish"
|
||||||
REQUIRE = "require"
|
REQUIRE = "require"
|
||||||
DISPLAY = "display"
|
DISPLAY = "display"
|
||||||
PUBLISH = "publish"
|
|
||||||
RELEASE = "release"
|
|
||||||
)
|
)
|
||||||
const ( // DIR
|
const ( // DIR
|
||||||
SRC = "src"
|
SRC = "src"
|
||||||
@ -83,15 +77,25 @@ const ( // DIR
|
|||||||
VAR = "var"
|
VAR = "var"
|
||||||
USR = "usr"
|
USR = "usr"
|
||||||
|
|
||||||
|
PWD = "./"
|
||||||
|
HTML = "html"
|
||||||
|
CSS = "css"
|
||||||
|
JS = "js"
|
||||||
|
GO = "go"
|
||||||
|
SH = "sh"
|
||||||
|
CSV = "csv"
|
||||||
|
JSON = "json"
|
||||||
|
|
||||||
USR_VOLCANOS = "usr/volcanos"
|
USR_VOLCANOS = "usr/volcanos"
|
||||||
USR_LEARNING = "usr/learning"
|
USR_LEARNING = "usr/learning"
|
||||||
USR_ICEBERGS = "usr/icebergs"
|
USR_ICEBERGS = "usr/icebergs"
|
||||||
USR_TOOLKITS = "usr/toolkits"
|
USR_TOOLKITS = "usr/toolkits"
|
||||||
USR_INTSHELL = "usr/intshell"
|
USR_INTSHELL = "usr/intshell"
|
||||||
USR_RELEASE = "usr/release"
|
|
||||||
USR_INSTALL = "usr/install"
|
USR_INSTALL = "usr/install"
|
||||||
|
USR_RELEASE = "usr/release"
|
||||||
USR_PUBLISH = "usr/publish"
|
USR_PUBLISH = "usr/publish"
|
||||||
|
|
||||||
|
PLUGIN_INPUT = "/plugin/input"
|
||||||
PLUGIN_STORY = "/plugin/story"
|
PLUGIN_STORY = "/plugin/story"
|
||||||
PLUGIN_LOCAL = "/plugin/local"
|
PLUGIN_LOCAL = "/plugin/local"
|
||||||
|
|
||||||
@ -134,6 +138,7 @@ const ( // DIR
|
|||||||
SRC_RELEASE = "src/release"
|
SRC_RELEASE = "src/release"
|
||||||
SRC_MAIN_GO = "src/main.go"
|
SRC_MAIN_GO = "src/main.go"
|
||||||
SRC_MAIN_SHY = "src/main.shy"
|
SRC_MAIN_SHY = "src/main.shy"
|
||||||
|
SRC_MAIN_SVG = "src/main.svg"
|
||||||
SRC_VERSION_GO = "src/version.go"
|
SRC_VERSION_GO = "src/version.go"
|
||||||
SRC_BINPACK_GO = "src/binpack.go"
|
SRC_BINPACK_GO = "src/binpack.go"
|
||||||
MAKEFILE = "Makefile"
|
MAKEFILE = "Makefile"
|
||||||
@ -146,6 +151,12 @@ const ( // MSG
|
|||||||
MSG_APPEND = "append"
|
MSG_APPEND = "append"
|
||||||
MSG_RESULT = "result"
|
MSG_RESULT = "result"
|
||||||
|
|
||||||
|
MSG_CMDS = "cmds"
|
||||||
|
MSG_FIELDS = "fields"
|
||||||
|
MSG_SESSID = "sessid"
|
||||||
|
MSG_DOMAIN = "domain"
|
||||||
|
MSG_OPTS = "_option"
|
||||||
|
|
||||||
MSG_ALIAS = "_alias"
|
MSG_ALIAS = "_alias"
|
||||||
MSG_SCRIPT = "_script"
|
MSG_SCRIPT = "_script"
|
||||||
MSG_SOURCE = "_source"
|
MSG_SOURCE = "_source"
|
||||||
@ -162,12 +173,6 @@ const ( // MSG
|
|||||||
MSG_DISPLAY = "_display"
|
MSG_DISPLAY = "_display"
|
||||||
MSG_PROCESS = "_process"
|
MSG_PROCESS = "_process"
|
||||||
|
|
||||||
MSG_CMDS = "cmds"
|
|
||||||
MSG_FIELDS = "fields"
|
|
||||||
MSG_SESSID = "sessid"
|
|
||||||
MSG_DOMAIN = "domain"
|
|
||||||
MSG_OPTS = "_option"
|
|
||||||
|
|
||||||
MSG_USERIP = "user.ip"
|
MSG_USERIP = "user.ip"
|
||||||
MSG_USERUA = "user.ua"
|
MSG_USERUA = "user.ua"
|
||||||
MSG_USERWEB = "user.web"
|
MSG_USERWEB = "user.web"
|
||||||
@ -212,8 +217,8 @@ const ( // RENDER
|
|||||||
)
|
)
|
||||||
const ( // PROCESS
|
const ( // PROCESS
|
||||||
PROCESS_LOCATION = "_location"
|
PROCESS_LOCATION = "_location"
|
||||||
PROCESS_REWRITE = "_rewrite"
|
|
||||||
PROCESS_REFRESH = "_refresh"
|
PROCESS_REFRESH = "_refresh"
|
||||||
|
PROCESS_REWRITE = "_rewrite"
|
||||||
PROCESS_DISPLAY = "_display"
|
PROCESS_DISPLAY = "_display"
|
||||||
PROCESS_FIELD = "_field"
|
PROCESS_FIELD = "_field"
|
||||||
PROCESS_INNER = "_inner"
|
PROCESS_INNER = "_inner"
|
||||||
@ -298,6 +303,25 @@ const (
|
|||||||
MDB = "mdb"
|
MDB = "mdb"
|
||||||
)
|
)
|
||||||
const (
|
const (
|
||||||
|
CONFIG = "config"
|
||||||
COMMAND = "command"
|
COMMAND = "command"
|
||||||
ACTION = "action"
|
ACTION = "action"
|
||||||
|
STYLE = "style"
|
||||||
|
INDEX = "index"
|
||||||
|
ARGS = "args"
|
||||||
|
)
|
||||||
|
const (
|
||||||
|
SERVE = "serve"
|
||||||
|
SPACE = "space"
|
||||||
|
SPIDE = "spide"
|
||||||
|
CACHE = "cache"
|
||||||
|
)
|
||||||
|
const (
|
||||||
|
KEY = "key"
|
||||||
|
VALUE = "value"
|
||||||
|
HASH = "hash"
|
||||||
|
TIME = "time"
|
||||||
|
TYPE = "type"
|
||||||
|
NAME = "name"
|
||||||
|
TEXT = "text"
|
||||||
)
|
)
|
||||||
|
@ -81,9 +81,9 @@ func _action_share(m *ice.Message, arg ...string) {
|
|||||||
break // 分享超时
|
break // 分享超时
|
||||||
}
|
}
|
||||||
if arg[0] = msg.Append(mdb.NAME); len(arg) == 1 {
|
if arg[0] = msg.Append(mdb.NAME); len(arg) == 1 {
|
||||||
m.Push("title", msg.Append(kit.MDB_TITLE))
|
m.Push("title", msg.Append("title"))
|
||||||
m.Push("index", msg.Append(mdb.NAME))
|
m.Push(ctx.INDEX, msg.Append(mdb.NAME))
|
||||||
m.Push("args", msg.Append(mdb.TEXT))
|
m.Push(ctx.ARGS, msg.Append(mdb.TEXT))
|
||||||
break // 命令列表
|
break // 命令列表
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ func init() {
|
|||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
||||||
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",
|
||||||
kit.MDB_ALIAS, kit.Dict(FROM, ACCOUNT, TO, ACCOUNT),
|
mdb.ALIAS, kit.Dict(FROM, ACCOUNT, TO, ACCOUNT),
|
||||||
)},
|
)},
|
||||||
}, Commands: map[string]*ice.Command{
|
}, Commands: map[string]*ice.Command{
|
||||||
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(
|
||||||
|
@ -17,7 +17,7 @@ func init() {
|
|||||||
ice.DisplayLocal(""),
|
ice.DisplayLocal(""),
|
||||||
), Action: ice.MergeAction(map[string]*ice.Action{
|
), Action: ice.MergeAction(map[string]*ice.Action{
|
||||||
nfs.SAVE: {Name: "save", Help: "保存", Hand: func(m *ice.Message, arg ...string) {
|
nfs.SAVE: {Name: "save", Help: "保存", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_wiki_save(m, DRAW, arg[0], m.Option(kit.MDB_CONTENT))
|
_wiki_save(m, DRAW, arg[0], m.Option("content"))
|
||||||
}},
|
}},
|
||||||
}, ctx.CmdAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, ctx.CmdAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
if !_wiki_list(m, DRAW, kit.Select(ice.PWD, arg, 0)) {
|
if !_wiki_list(m, DRAW, kit.Select(ice.PWD, arg, 0)) {
|
||||||
|
@ -61,7 +61,7 @@ func _field_show(m *ice.Message, name, text string, arg ...string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch arg[i] {
|
switch arg[i] {
|
||||||
case kit.MDB_CONTENT:
|
case "content":
|
||||||
meta[arg[i]] = arg[i+1]
|
meta[arg[i]] = arg[i+1]
|
||||||
|
|
||||||
case ARGS:
|
case ARGS:
|
||||||
@ -69,7 +69,7 @@ func _field_show(m *ice.Message, name, text string, arg ...string) {
|
|||||||
|
|
||||||
count := 0
|
count := 0
|
||||||
kit.Fetch(meta[INPUTS], func(index int, value map[string]interface{}) {
|
kit.Fetch(meta[INPUTS], func(index int, value map[string]interface{}) {
|
||||||
if value[mdb.TYPE] != kit.MDB_BUTTON {
|
if value[mdb.TYPE] != "button" {
|
||||||
count++
|
count++
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -15,7 +15,7 @@ func _word_show(m *ice.Message, name string, arg ...string) {
|
|||||||
m.Option(TITLE, map[string]int{})
|
m.Option(TITLE, map[string]int{})
|
||||||
m.Option(MENU, kit.Dict(mdb.LIST, []interface{}{}))
|
m.Option(MENU, kit.Dict(mdb.LIST, []interface{}{}))
|
||||||
|
|
||||||
m.Option(ice.MSG_ALIAS, m.Confv(WORD, kit.Keym(kit.MDB_ALIAS)))
|
m.Option(ice.MSG_ALIAS, m.Confv(WORD, kit.Keym(mdb.ALIAS)))
|
||||||
m.Option(nfs.DIR_ROOT, _wiki_path(m, WORD))
|
m.Option(nfs.DIR_ROOT, _wiki_path(m, WORD))
|
||||||
m.Cmdy(ssh.SOURCE, name)
|
m.Cmdy(ssh.SOURCE, name)
|
||||||
}
|
}
|
||||||
@ -25,7 +25,7 @@ const WORD = "word"
|
|||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
Index.Merge(&ice.Context{Configs: map[string]*ice.Config{
|
||||||
WORD: {Name: WORD, Help: "语言文字", Value: kit.Data(
|
WORD: {Name: WORD, Help: "语言文字", Value: kit.Data(
|
||||||
nfs.PATH, "", REGEXP, ".*\\.shy", kit.MDB_ALIAS, kit.Dict(
|
nfs.PATH, "", REGEXP, ".*\\.shy", mdb.ALIAS, kit.Dict(
|
||||||
NAVMENU, kit.List(TITLE, NAVMENU),
|
NAVMENU, kit.List(TITLE, NAVMENU),
|
||||||
PREMENU, kit.List(TITLE, PREMENU),
|
PREMENU, kit.List(TITLE, PREMENU),
|
||||||
CHAPTER, kit.List(TITLE, CHAPTER),
|
CHAPTER, kit.List(TITLE, CHAPTER),
|
||||||
|
7
data.go
7
data.go
@ -25,7 +25,6 @@ func (m *Message) Config(key string, arg ...interface{}) string {
|
|||||||
m.Conf(m.PrefixKey(), kit.Keym(key), arg[0])
|
m.Conf(m.PrefixKey(), kit.Keym(key), arg[0])
|
||||||
}
|
}
|
||||||
return m.Conf(m.PrefixKey(), kit.Keym(key))
|
return m.Conf(m.PrefixKey(), kit.Keym(key))
|
||||||
// return kit.Format(m.Configv(key, arg...))
|
|
||||||
}
|
}
|
||||||
func (m *Message) Configv(key string, arg ...interface{}) interface{} {
|
func (m *Message) Configv(key string, arg ...interface{}) interface{} {
|
||||||
if len(arg) > 0 {
|
if len(arg) > 0 {
|
||||||
@ -52,7 +51,7 @@ func (m *Message) Save(arg ...string) *Message {
|
|||||||
for i, k := range arg {
|
for i, k := range arg {
|
||||||
arg[i] = m.Prefix(k)
|
arg[i] = m.Prefix(k)
|
||||||
}
|
}
|
||||||
return m.Cmd("config", SAVE, m.Prefix("json"), arg)
|
return m.Cmd(CONFIG, SAVE, m.Prefix(JSON), arg)
|
||||||
}
|
}
|
||||||
func (m *Message) Load(arg ...string) *Message {
|
func (m *Message) Load(arg ...string) *Message {
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
@ -63,7 +62,7 @@ func (m *Message) Load(arg ...string) *Message {
|
|||||||
for i, k := range arg {
|
for i, k := range arg {
|
||||||
arg[i] = m.Prefix(k)
|
arg[i] = m.Prefix(k)
|
||||||
}
|
}
|
||||||
return m.Cmd("config", LOAD, m.Prefix("json"), arg)
|
return m.Cmd(CONFIG, LOAD, m.Prefix(JSON), arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Message) Richs(prefix string, chain interface{}, raw interface{}, cb interface{}) (res map[string]interface{}) {
|
func (m *Message) Richs(prefix string, chain interface{}, raw interface{}, cb interface{}) (res map[string]interface{}) {
|
||||||
@ -113,7 +112,7 @@ func (m *Message) Grows(prefix string, chain interface{}, match string, value st
|
|||||||
|
|
||||||
limit := kit.Int(m.Option(CACHE_LIMIT))
|
limit := kit.Int(m.Option(CACHE_LIMIT))
|
||||||
if begin := kit.Int(m.Option(CACHE_BEGIN)); begin != 0 && limit > 0 {
|
if begin := kit.Int(m.Option(CACHE_BEGIN)); begin != 0 && limit > 0 {
|
||||||
count := kit.Int(m.Option(CACHE_COUNT, kit.Int(kit.Value(cache, kit.Keym(kit.MDB_COUNT)))))
|
count := kit.Int(m.Option(CACHE_COUNT, kit.Int(kit.Value(cache, kit.Keym("count")))))
|
||||||
if begin > 0 {
|
if begin > 0 {
|
||||||
m.Option(CACHE_OFFEND, count-begin-limit)
|
m.Option(CACHE_OFFEND, count-begin-limit)
|
||||||
} else {
|
} else {
|
||||||
|
14
exec.go
14
exec.go
@ -87,7 +87,7 @@ func (m *Message) Done(ok bool) bool {
|
|||||||
func (m *Message) Call(sync bool, cb func(*Message) *Message) *Message {
|
func (m *Message) Call(sync bool, cb func(*Message) *Message) *Message {
|
||||||
wait := make(chan bool, 2)
|
wait := make(chan bool, 2)
|
||||||
|
|
||||||
p := kit.Select("10s", m.Option(kit.MDB_TIMEOUT))
|
p := kit.Select("10s", m.Option("timeout"))
|
||||||
t := time.AfterFunc(kit.Duration(p), func() {
|
t := time.AfterFunc(kit.Duration(p), func() {
|
||||||
m.Warn(true, ErrTimeout, m.Detailv())
|
m.Warn(true, ErrTimeout, m.Detailv())
|
||||||
m.Back(nil)
|
m.Back(nil)
|
||||||
@ -136,11 +136,11 @@ func (m *Message) Watch(key string, arg ...string) *Message {
|
|||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
arg = append(arg, m.Prefix(AUTO))
|
arg = append(arg, m.Prefix(AUTO))
|
||||||
}
|
}
|
||||||
m.Cmd("event", "action", "listen", "event", key, CMD, kit.Join(arg, SP))
|
m.Cmd("event", ACTION, "listen", "event", key, CMD, kit.Join(arg, SP))
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
func (m *Message) Event(key string, arg ...string) *Message {
|
func (m *Message) Event(key string, arg ...string) *Message {
|
||||||
m.Cmd("event", "action", "action", "event", key, arg)
|
m.Cmd("event", ACTION, "action", "event", key, arg)
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
func (m *Message) Right(arg ...interface{}) bool {
|
func (m *Message) Right(arg ...interface{}) bool {
|
||||||
@ -152,15 +152,15 @@ func (m *Message) Space(arg interface{}) []string {
|
|||||||
if arg == nil || arg == "" || kit.Format(arg) == m.Conf("runtime", "node.name") {
|
if arg == nil || arg == "" || kit.Format(arg) == m.Conf("runtime", "node.name") {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return []string{"space", kit.Format(arg)}
|
return []string{SPACE, kit.Format(arg)}
|
||||||
}
|
}
|
||||||
func (m *Message) PodCmd(arg ...interface{}) bool {
|
func (m *Message) PodCmd(arg ...interface{}) bool {
|
||||||
if pod := m.Option(POD); pod != "" {
|
if pod := m.Option(POD); pod != "" {
|
||||||
if m.Option(POD, ""); m.Option(MSG_UPLOAD) != "" {
|
if m.Option(POD, ""); m.Option(MSG_UPLOAD) != "" {
|
||||||
msg := m.Cmd("cache", "upload")
|
msg := m.Cmd(CACHE, "upload")
|
||||||
m.Option(MSG_UPLOAD, msg.Append(kit.MDB_HASH), msg.Append(kit.MDB_NAME), msg.Append(kit.MDB_SIZE))
|
m.Option(MSG_UPLOAD, msg.Append(HASH), msg.Append(NAME), msg.Append("size"))
|
||||||
}
|
}
|
||||||
m.Cmdy(append(kit.List("space", pod), arg...))
|
m.Cmdy(append(kit.List(SPACE, pod), arg...))
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
2
init.go
2
init.go
@ -107,7 +107,7 @@ func Run(arg ...string) string {
|
|||||||
|
|
||||||
Index.root, Pulse.root = Index, Pulse
|
Index.root, Pulse.root = Index, Pulse
|
||||||
switch Index.Merge(Index).Begin(Pulse.Spawn(), arg...); kit.Select("", arg, 0) {
|
switch Index.Merge(Index).Begin(Pulse.Spawn(), arg...); kit.Select("", arg, 0) {
|
||||||
case "serve", "space":
|
case SERVE, SPACE:
|
||||||
if log.LogDisable = false; Index.Start(Pulse, arg...) {
|
if log.LogDisable = false; Index.Start(Pulse, arg...) {
|
||||||
Pulse.TryCatch(Pulse, true, func(Pulse *Message) { Index.wg.Wait() })
|
Pulse.TryCatch(Pulse, true, func(Pulse *Message) { Index.wg.Wait() })
|
||||||
os.Exit(kit.Int(Pulse.Option(EXIT)))
|
os.Exit(kit.Int(Pulse.Option(EXIT)))
|
||||||
|
60
meta.go
60
meta.go
@ -15,16 +15,16 @@ func (m *Message) Set(key string, arg ...string) *Message {
|
|||||||
case MSG_OPTION, MSG_APPEND:
|
case MSG_OPTION, MSG_APPEND:
|
||||||
if m.FieldsIsDetail() {
|
if m.FieldsIsDetail() {
|
||||||
if len(arg) > 0 {
|
if len(arg) > 0 {
|
||||||
for i := 0; i < len(m.meta[kit.MDB_KEY]); i++ {
|
for i := 0; i < len(m.meta[KEY]); i++ {
|
||||||
if m.meta[kit.MDB_KEY][i] == arg[0] {
|
if m.meta[KEY][i] == arg[0] {
|
||||||
m.meta[kit.MDB_KEY][i] = ""
|
m.meta[KEY][i] = ""
|
||||||
m.meta[kit.MDB_VALUE][i] = ""
|
m.meta[VALUE][i] = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
delete(m.meta, kit.MDB_KEY)
|
delete(m.meta, KEY)
|
||||||
delete(m.meta, kit.MDB_VALUE)
|
delete(m.meta, VALUE)
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
if len(arg) > 0 {
|
if len(arg) > 0 {
|
||||||
@ -43,18 +43,18 @@ func (m *Message) Set(key string, arg ...string) *Message {
|
|||||||
delete(m.meta, k)
|
delete(m.meta, k)
|
||||||
}
|
}
|
||||||
if m.FieldsIsDetail() {
|
if m.FieldsIsDetail() {
|
||||||
for i := 0; i < len(m.meta[kit.MDB_KEY]); i++ {
|
for i := 0; i < len(m.meta[KEY]); i++ {
|
||||||
if m.meta[kit.MDB_KEY][i] == key {
|
if m.meta[KEY][i] == key {
|
||||||
if len(arg) > 0 {
|
if len(arg) > 0 {
|
||||||
m.meta[kit.MDB_VALUE][i] = arg[0]
|
m.meta[VALUE][i] = arg[0]
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
for ; i < len(m.meta[kit.MDB_KEY])-1; i++ {
|
for ; i < len(m.meta[KEY])-1; i++ {
|
||||||
m.meta[kit.MDB_KEY][i] = m.meta[kit.MDB_KEY][i+1]
|
m.meta[KEY][i] = m.meta[KEY][i+1]
|
||||||
m.meta[kit.MDB_VALUE][i] = m.meta[kit.MDB_VALUE][i+1]
|
m.meta[VALUE][i] = m.meta[VALUE][i+1]
|
||||||
}
|
}
|
||||||
m.meta[kit.MDB_KEY] = kit.Slice(m.meta[kit.MDB_KEY], 0, -1)
|
m.meta[KEY] = kit.Slice(m.meta[KEY], 0, -1)
|
||||||
m.meta[kit.MDB_VALUE] = kit.Slice(m.meta[kit.MDB_VALUE], 0, -1)
|
m.meta[VALUE] = kit.Slice(m.meta[VALUE], 0, -1)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -115,7 +115,7 @@ func (m *Message) Push(key string, value interface{}, arg ...interface{}) *Messa
|
|||||||
// 查找数据
|
// 查找数据
|
||||||
var v interface{}
|
var v interface{}
|
||||||
switch k {
|
switch k {
|
||||||
case kit.MDB_KEY, kit.MDB_HASH:
|
case KEY, HASH:
|
||||||
if key != "" && key != "detail" {
|
if key != "" && key != "detail" {
|
||||||
v = key
|
v = key
|
||||||
break
|
break
|
||||||
@ -134,8 +134,8 @@ func (m *Message) Push(key string, value interface{}, arg ...interface{}) *Messa
|
|||||||
// 追加数据
|
// 追加数据
|
||||||
switch v := kit.Format(v); key {
|
switch v := kit.Format(v); key {
|
||||||
case "detail":
|
case "detail":
|
||||||
m.Add(MSG_APPEND, kit.MDB_KEY, k)
|
m.Add(MSG_APPEND, KEY, k)
|
||||||
m.Add(MSG_APPEND, kit.MDB_VALUE, v)
|
m.Add(MSG_APPEND, VALUE, v)
|
||||||
default:
|
default:
|
||||||
m.Add(MSG_APPEND, k, v)
|
m.Add(MSG_APPEND, k, v)
|
||||||
}
|
}
|
||||||
@ -158,9 +158,9 @@ func (m *Message) Push(key string, value interface{}, arg ...interface{}) *Messa
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
if m.FieldsIsDetail() {
|
if m.FieldsIsDetail() {
|
||||||
if key != kit.MDB_KEY || key != kit.MDB_VALUE {
|
if key != KEY || key != VALUE {
|
||||||
m.Add(MSG_APPEND, kit.MDB_KEY, key)
|
m.Add(MSG_APPEND, KEY, key)
|
||||||
m.Add(MSG_APPEND, kit.MDB_VALUE, kit.Format(value))
|
m.Add(MSG_APPEND, VALUE, kit.Format(value))
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -200,7 +200,7 @@ func (m *Message) Copy(msg *Message, arg ...string) *Message {
|
|||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
func (m *Message) Sort(key string, arg ...string) *Message {
|
func (m *Message) Sort(key string, arg ...string) *Message {
|
||||||
if m.FieldsIsDetail() && key != kit.MDB_KEY {
|
if m.FieldsIsDetail() && key != KEY {
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
// 排序方法
|
// 排序方法
|
||||||
@ -276,10 +276,10 @@ func (m *Message) Table(cbs ...func(index int, value map[string]string, head []s
|
|||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
line := map[string]string{}
|
line := map[string]string{}
|
||||||
for i, k := range m.meta[kit.MDB_KEY] {
|
for i, k := range m.meta[KEY] {
|
||||||
line[k] = kit.Select("", m.meta[kit.MDB_VALUE], i)
|
line[k] = kit.Select("", m.meta[VALUE], i)
|
||||||
}
|
}
|
||||||
cbs[0](0, line, m.meta[kit.MDB_KEY])
|
cbs[0](0, line, m.meta[KEY])
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,18 +401,18 @@ func (m *Message) Appendv(key string, arg ...interface{}) []string {
|
|||||||
return m.meta[key]
|
return m.meta[key]
|
||||||
}
|
}
|
||||||
|
|
||||||
if m.FieldsIsDetail() && key != kit.MDB_KEY {
|
if m.FieldsIsDetail() && key != KEY {
|
||||||
for i, k := range m.meta[kit.MDB_KEY] {
|
for i, k := range m.meta[KEY] {
|
||||||
if k == key {
|
if k == key {
|
||||||
if len(arg) > 0 {
|
if len(arg) > 0 {
|
||||||
m.meta[kit.MDB_VALUE][i] = kit.Format(arg[0])
|
m.meta[VALUE][i] = kit.Format(arg[0])
|
||||||
}
|
}
|
||||||
return []string{kit.Select("", m.meta[kit.MDB_VALUE], i)}
|
return []string{kit.Select("", m.meta[VALUE], i)}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(arg) > 0 {
|
if len(arg) > 0 {
|
||||||
m.Add(MSG_APPEND, kit.MDB_KEY, key)
|
m.Add(MSG_APPEND, KEY, key)
|
||||||
m.Add(MSG_APPEND, kit.MDB_VALUE, kit.Format(arg[0]))
|
m.Add(MSG_APPEND, VALUE, kit.Format(arg[0]))
|
||||||
return []string{kit.Format(arg[0])}
|
return []string{kit.Format(arg[0])}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
42
misc.go
42
misc.go
@ -88,7 +88,7 @@ func (m *Message) FieldsIsDetail() bool {
|
|||||||
if m.OptionFields() == "detail" {
|
if m.OptionFields() == "detail" {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if len(m.meta[MSG_APPEND]) == 2 && m.meta[MSG_APPEND][0] == kit.MDB_KEY && m.meta[MSG_APPEND][1] == kit.MDB_VALUE {
|
if len(m.meta[MSG_APPEND]) == 2 && m.meta[MSG_APPEND][0] == KEY && m.meta[MSG_APPEND][1] == VALUE {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@ -105,12 +105,12 @@ func (m *Message) OptionCB(key string, cb ...interface{}) interface{} {
|
|||||||
func (m *Message) OptionUserWeb() *url.URL {
|
func (m *Message) OptionUserWeb() *url.URL {
|
||||||
return kit.ParseURL(m.Option(MSG_USERWEB))
|
return kit.ParseURL(m.Option(MSG_USERWEB))
|
||||||
}
|
}
|
||||||
func (m *Message) SetAppend(arg ...string) *Message {
|
|
||||||
return m.Set(MSG_APPEND, arg...)
|
|
||||||
}
|
|
||||||
func (m *Message) SetResult(arg ...string) *Message {
|
func (m *Message) SetResult(arg ...string) *Message {
|
||||||
return m.Set(MSG_RESULT, arg...)
|
return m.Set(MSG_RESULT, arg...)
|
||||||
}
|
}
|
||||||
|
func (m *Message) SetAppend(arg ...string) *Message {
|
||||||
|
return m.Set(MSG_APPEND, arg...)
|
||||||
|
}
|
||||||
func (m *Message) RenameAppend(from, to string) *Message {
|
func (m *Message) RenameAppend(from, to string) *Message {
|
||||||
for i, v := range m.meta[MSG_APPEND] {
|
for i, v := range m.meta[MSG_APPEND] {
|
||||||
if v == from {
|
if v == from {
|
||||||
@ -124,7 +124,7 @@ func (m *Message) RenameAppend(from, to string) *Message {
|
|||||||
func (m *Message) AppendSimple(key ...string) (res []string) {
|
func (m *Message) AppendSimple(key ...string) (res []string) {
|
||||||
if len(key) == 0 {
|
if len(key) == 0 {
|
||||||
if m.FieldsIsDetail() {
|
if m.FieldsIsDetail() {
|
||||||
key = append(key, m.Appendv(kit.MDB_KEY)...)
|
key = append(key, m.Appendv(KEY)...)
|
||||||
} else {
|
} else {
|
||||||
key = append(key, m.Appendv(MSG_APPEND)...)
|
key = append(key, m.Appendv(MSG_APPEND)...)
|
||||||
}
|
}
|
||||||
@ -261,8 +261,8 @@ func (c *Context) _cmd(m *Message, cmd *Command, key string, sub string, h *Acti
|
|||||||
if m._sub = sub; len(h.List) > 0 && sub != "search" {
|
if m._sub = sub; len(h.List) > 0 && sub != "search" {
|
||||||
order := false
|
order := false
|
||||||
for i, v := range h.List {
|
for i, v := range h.List {
|
||||||
name := kit.Format(kit.Value(v, kit.MDB_NAME))
|
name := kit.Format(kit.Value(v, NAME))
|
||||||
value := kit.Format(kit.Value(v, kit.MDB_VALUE))
|
value := kit.Format(kit.Value(v, VALUE))
|
||||||
|
|
||||||
if i == 0 && len(arg) > 0 && arg[0] != name {
|
if i == 0 && len(arg) > 0 && arg[0] != name {
|
||||||
order = true
|
order = true
|
||||||
@ -298,23 +298,23 @@ func (c *Context) split(name string) (list []interface{}) {
|
|||||||
for i := 1; i < len(ls); i++ {
|
for i := 1; i < len(ls); i++ {
|
||||||
switch ls[i] {
|
switch ls[i] {
|
||||||
case "run":
|
case "run":
|
||||||
item = kit.Dict(kit.MDB_TYPE, BUTTON, kit.MDB_NAME, "run")
|
item = kit.Dict(TYPE, BUTTON, NAME, "run")
|
||||||
list = append(list, item)
|
list = append(list, item)
|
||||||
case "text":
|
case "text":
|
||||||
item = kit.Dict(kit.MDB_TYPE, TEXTAREA, kit.MDB_NAME, "text")
|
item = kit.Dict(TYPE, TEXTAREA, NAME, "text")
|
||||||
list = append(list, item)
|
list = append(list, item)
|
||||||
case "auto":
|
case "auto":
|
||||||
list = append(list, kit.List(kit.MDB_TYPE, BUTTON, kit.MDB_NAME, "list", kit.MDB_ACTION, AUTO)...)
|
list = append(list, kit.List(TYPE, BUTTON, NAME, "list", ACTION, AUTO)...)
|
||||||
list = append(list, kit.List(kit.MDB_TYPE, BUTTON, kit.MDB_NAME, "back")...)
|
list = append(list, kit.List(TYPE, BUTTON, NAME, "back")...)
|
||||||
button = true
|
button = true
|
||||||
case "page":
|
case "page":
|
||||||
list = append(list, kit.List(kit.MDB_TYPE, TEXT, kit.MDB_NAME, "limit")...)
|
list = append(list, kit.List(TYPE, TEXT, NAME, "limit")...)
|
||||||
list = append(list, kit.List(kit.MDB_TYPE, TEXT, kit.MDB_NAME, "offend")...)
|
list = append(list, kit.List(TYPE, TEXT, NAME, "offend")...)
|
||||||
list = append(list, kit.List(kit.MDB_TYPE, BUTTON, kit.MDB_NAME, "prev")...)
|
list = append(list, kit.List(TYPE, BUTTON, NAME, "prev")...)
|
||||||
list = append(list, kit.List(kit.MDB_TYPE, BUTTON, kit.MDB_NAME, "next")...)
|
list = append(list, kit.List(TYPE, BUTTON, NAME, "next")...)
|
||||||
|
|
||||||
case ":":
|
case ":":
|
||||||
if item[kit.MDB_TYPE] = kit.Select("", ls, i+1); item[kit.MDB_TYPE] == BUTTON {
|
if item[TYPE] = kit.Select("", ls, i+1); item[TYPE] == BUTTON {
|
||||||
button = true
|
button = true
|
||||||
}
|
}
|
||||||
i++
|
i++
|
||||||
@ -326,18 +326,18 @@ func (c *Context) split(name string) (list []interface{}) {
|
|||||||
} else {
|
} else {
|
||||||
item["values"] = vs
|
item["values"] = vs
|
||||||
}
|
}
|
||||||
item[kit.MDB_VALUE] = vs[0]
|
item[VALUE] = vs[0]
|
||||||
item[kit.MDB_TYPE] = SELECT
|
item[TYPE] = SELECT
|
||||||
} else {
|
} else {
|
||||||
item[kit.MDB_VALUE] = value
|
item[VALUE] = value
|
||||||
}
|
}
|
||||||
i++
|
i++
|
||||||
case "@":
|
case "@":
|
||||||
item[kit.MDB_ACTION] = kit.Select("", ls, i+1)
|
item[ACTION] = kit.Select("", ls, i+1)
|
||||||
i++
|
i++
|
||||||
|
|
||||||
default:
|
default:
|
||||||
item = kit.Dict(kit.MDB_TYPE, kit.Select(TEXT, BUTTON, button), kit.MDB_NAME, ls[i])
|
item = kit.Dict(TYPE, kit.Select(TEXT, BUTTON, button), NAME, ls[i])
|
||||||
list = append(list, item)
|
list = append(list, item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
name += "的" + kit.Select("应用列表", arg, 2)
|
name += "的" + kit.Select("应用列表", arg, 2)
|
||||||
|
|
||||||
text, link, list := kit.Select("", arg, 3), kit.MergeURL2(m.Conf(web.SHARE, kit.Keym(kit.MDB_DOMAIN)), "/chat/lark/sso"), []string{}
|
text, link, list := kit.Select("", arg, 3), kit.MergeURL2(m.Conf(web.SHARE, kit.Keym("domain")), "/chat/lark/sso"), []string{}
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
m.Cmd("web.chat./river").Table(func(index int, val map[string]string, head []string) {
|
m.Cmd("web.chat./river").Table(func(index int, val map[string]string, head []string) {
|
||||||
m.Cmd("web.chat./river", val[mdb.HASH], chat.STORM).Table(func(index int, value map[string]string, head []string) {
|
m.Cmd("web.chat./river", val[mdb.HASH], chat.STORM).Table(func(index int, value map[string]string, head []string) {
|
||||||
|
@ -3,6 +3,7 @@ package lark
|
|||||||
import (
|
import (
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/aaa"
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
|
"shylinux.com/x/icebergs/base/cli"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
@ -20,9 +21,9 @@ func init() {
|
|||||||
|
|
||||||
appid := m.Cmd(APP).Append(APPID)
|
appid := m.Cmd(APP).Append(APPID)
|
||||||
home := m.MergeURL2("/chat/lark/sso")
|
home := m.MergeURL2("/chat/lark/sso")
|
||||||
if m.Option(kit.MDB_CODE) != "" { // 登录成功
|
if m.Option(cli.CODE) != "" { // 登录成功
|
||||||
msg := m.Cmd(web.SPIDE, LARK, "/open-apis/authen/v1/access_token", "grant_type", "authorization_code",
|
msg := m.Cmd(web.SPIDE, LARK, "/open-apis/authen/v1/access_token", "grant_type", "authorization_code",
|
||||||
kit.MDB_CODE, m.Option(kit.MDB_CODE), "app_access_token", m.Cmdx(APP, TOKEN, appid))
|
cli.CODE, m.Option(cli.CODE), "app_access_token", m.Cmdx(APP, TOKEN, appid))
|
||||||
|
|
||||||
// 更新用户
|
// 更新用户
|
||||||
m.Option(aaa.USERNAME, msg.Append("data.open_id"))
|
m.Option(aaa.USERNAME, msg.Append("data.open_id"))
|
||||||
@ -36,13 +37,13 @@ func init() {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// 创建会话
|
// 创建会话
|
||||||
web.RenderCookie(m, aaa.SessCreate(m, m.Option(aaa.USERNAME)), web.CookieName(m.Option(kit.MDB_BACK)))
|
web.RenderCookie(m, aaa.SessCreate(m, m.Option(aaa.USERNAME)), web.CookieName(m.Option(cli.BACK)))
|
||||||
m.RenderRedirect(kit.Select(home, m.Option(kit.MDB_BACK)))
|
m.RenderRedirect(kit.Select(home, m.Option(cli.BACK)))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if back := m.R.Header.Get("Referer"); back != "" {
|
if back := m.R.Header.Get("Referer"); back != "" {
|
||||||
home = kit.MergeURL(home, kit.MDB_BACK, back)
|
home = kit.MergeURL(home, cli.BACK, back)
|
||||||
}
|
}
|
||||||
// 登录页面
|
// 登录页面
|
||||||
m.RenderRedirect(kit.MergeURL2(m.Cmd(web.SPIDE, LARK).Append("client.url"), "/open-apis/authen/v1/index"),
|
m.RenderRedirect(kit.MergeURL2(m.Cmd(web.SPIDE, LARK).Append("client.url"), "/open-apis/authen/v1/index"),
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/aaa"
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
|
"shylinux.com/x/icebergs/base/cli"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/tcp"
|
"shylinux.com/x/icebergs/base/tcp"
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
@ -40,7 +41,7 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
aaa.SESS: {Name: "sess code", Help: "会话", Hand: func(m *ice.Message, arg ...string) {
|
aaa.SESS: {Name: "sess code", Help: "会话", Hand: func(m *ice.Message, arg ...string) {
|
||||||
msg := m.Cmd(web.SPIDE, MP, web.SPIDE_GET, "/sns/jscode2session?grant_type=authorization_code",
|
msg := m.Cmd(web.SPIDE, MP, web.SPIDE_GET, "/sns/jscode2session?grant_type=authorization_code",
|
||||||
"js_code", m.Option(kit.MDB_CODE), APPID, m.Config(APPID), "secret", m.Config(APPMM))
|
"js_code", m.Option(cli.CODE), APPID, m.Config(APPID), "secret", m.Config(APPMM))
|
||||||
|
|
||||||
// 用户登录
|
// 用户登录
|
||||||
m.Option(ice.MSG_USERZONE, MP)
|
m.Option(ice.MSG_USERZONE, MP)
|
||||||
|
@ -1,17 +1,19 @@
|
|||||||
package pi
|
package pi
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"shylinux.com/x/icebergs"
|
|
||||||
"shylinux.com/x/icebergs/core/chat"
|
|
||||||
"shylinux.com/x/toolkits"
|
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
|
||||||
|
ice "shylinux.com/x/icebergs"
|
||||||
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
|
"shylinux.com/x/icebergs/core/chat"
|
||||||
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
var Index = &ice.Context{Name: "pi", Help: "开发板",
|
var Index = &ice.Context{Name: "pi", Help: "开发板",
|
||||||
Caches: map[string]*ice.Cache{},
|
Caches: map[string]*ice.Cache{},
|
||||||
Configs: map[string]*ice.Config{
|
Configs: map[string]*ice.Config{
|
||||||
"pi": {Name: "pi", Help: "pi", Value: kit.Data(kit.MDB_SHORT, "name")},
|
"pi": {Name: "pi", Help: "pi", Value: kit.Data(mdb.SHORT, "name")},
|
||||||
},
|
},
|
||||||
Commands: map[string]*ice.Command{
|
Commands: map[string]*ice.Command{
|
||||||
"GPIO": {Name: "GPIO", Help: "GPIO", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
"GPIO": {Name: "GPIO", Help: "GPIO", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
|
@ -25,7 +25,7 @@ func init() {
|
|||||||
if arg[0] = strings.TrimSpace(arg[0]); strings.HasPrefix(arg[0], "ice ") {
|
if arg[0] = strings.TrimSpace(arg[0]); strings.HasPrefix(arg[0], "ice ") {
|
||||||
switch list := kit.Split(arg[0]); list[1] {
|
switch list := kit.Split(arg[0]); list[1] {
|
||||||
case "add": // ice add 想你 shwq [person [9999]]
|
case "add": // ice add 想你 shwq [person [9999]]
|
||||||
m.Cmd("web.code.input.wubi", mdb.INSERT, mdb.TEXT, list[2], kit.MDB_CODE, list[3],
|
m.Cmd("web.code.input.wubi", mdb.INSERT, mdb.TEXT, list[2], cli.CODE, list[3],
|
||||||
mdb.ZONE, kit.Select("person", list, 4), mdb.VALUE, kit.Select("999999", list, 5),
|
mdb.ZONE, kit.Select("person", list, 4), mdb.VALUE, kit.Select("999999", list, 5),
|
||||||
)
|
)
|
||||||
arg[0] = list[3]
|
arg[0] = list[3]
|
||||||
|
32
option.go
32
option.go
@ -15,7 +15,7 @@ type Option struct {
|
|||||||
Value interface{}
|
Value interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func OptionHash(arg string) Option { return Option{kit.MDB_HASH, arg} }
|
func OptionHash(arg string) Option { return Option{HASH, arg} }
|
||||||
func OptionFields(arg ...string) Option { return Option{MSG_FIELDS, kit.Join(arg)} }
|
func OptionFields(arg ...string) Option { return Option{MSG_FIELDS, kit.Join(arg)} }
|
||||||
|
|
||||||
func (m *Message) OptionFields(arg ...string) string {
|
func (m *Message) OptionFields(arg ...string) string {
|
||||||
@ -59,20 +59,20 @@ func (m *Message) OptionSimple(key ...string) (res []string) {
|
|||||||
}
|
}
|
||||||
func (m *Message) OptionTemplate() string {
|
func (m *Message) OptionTemplate() string {
|
||||||
res := []string{`class="story"`}
|
res := []string{`class="story"`}
|
||||||
for _, key := range kit.Split(kit.MDB_STYLE) {
|
for _, key := range kit.Split(STYLE) {
|
||||||
if m.Option(key) != "" {
|
if m.Option(key) != "" {
|
||||||
res = append(res, kit.Format(`s="%s"`, key, m.Option(key)))
|
res = append(res, kit.Format(`s="%s"`, key, m.Option(key)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, key := range kit.Split("type,name,text") {
|
for _, key := range kit.Split("type,name,text") {
|
||||||
if key == "text" && m.Option("type") == "spark" {
|
if key == TEXT && m.Option(TYPE) == "spark" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if m.Option(key) != "" {
|
if m.Option(key) != "" {
|
||||||
res = append(res, kit.Format(`data-%s="%s"`, key, m.Option(key)))
|
res = append(res, kit.Format(`data-%s="%s"`, key, m.Option(key)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
kit.Fetch(m.Optionv(kit.MDB_EXTRA), func(key string, value string) {
|
kit.Fetch(m.Optionv("extra"), func(key string, value string) {
|
||||||
if value != "" {
|
if value != "" {
|
||||||
res = append(res, kit.Format(`data-%s="%s"`, key, value))
|
res = append(res, kit.Format(`data-%s="%s"`, key, value))
|
||||||
}
|
}
|
||||||
@ -86,14 +86,14 @@ func (m *Message) Fields(length int, fields ...string) string {
|
|||||||
func (m *Message) Upload(dir string) {
|
func (m *Message) Upload(dir string) {
|
||||||
up := kit.Simple(m.Optionv(MSG_UPLOAD))
|
up := kit.Simple(m.Optionv(MSG_UPLOAD))
|
||||||
if len(up) < 2 {
|
if len(up) < 2 {
|
||||||
msg := m.Cmd("cache", "upload")
|
msg := m.Cmd(CACHE, "upload")
|
||||||
up = kit.Simple(msg.Append(kit.MDB_HASH), msg.Append(kit.MDB_NAME), msg.Append(kit.MDB_SIZE))
|
up = kit.Simple(msg.Append(HASH), msg.Append(NAME), msg.Append("size"))
|
||||||
}
|
}
|
||||||
|
|
||||||
if p := path.Join(dir, up[1]); m.Option(MSG_USERPOD) == "" {
|
if p := path.Join(dir, up[1]); m.Option(MSG_USERPOD) == "" {
|
||||||
m.Cmdy("cache", "watch", up[0], p) // 本机文件
|
m.Cmdy(CACHE, "watch", up[0], p) // 本机文件
|
||||||
} else { // 下发文件
|
} else { // 下发文件
|
||||||
m.Cmdy("spide", DEV, SAVE, p, "GET", m.MergeURL2(path.Join("/share/cache", up[0])))
|
m.Cmdy(SPIDE, DEV, SAVE, p, "GET", m.MergeURL2(path.Join("/share/cache", up[0])))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *Message) Action(arg ...interface{}) {
|
func (m *Message) Action(arg ...interface{}) {
|
||||||
@ -110,22 +110,22 @@ func (m *Message) Status(arg ...interface{}) {
|
|||||||
list := kit.List()
|
list := kit.List()
|
||||||
args := kit.Simple(arg)
|
args := kit.Simple(arg)
|
||||||
for i := 0; i < len(args)-1; i += 2 {
|
for i := 0; i < len(args)-1; i += 2 {
|
||||||
list = append(list, kit.Dict(kit.MDB_NAME, args[i], kit.MDB_VALUE, args[i+1]))
|
list = append(list, kit.Dict(NAME, args[i], VALUE, args[i+1]))
|
||||||
}
|
}
|
||||||
m.Option(MSG_STATUS, kit.Format(list))
|
m.Option(MSG_STATUS, kit.Format(list))
|
||||||
}
|
}
|
||||||
func (m *Message) StatusTime(arg ...interface{}) {
|
func (m *Message) StatusTime(arg ...interface{}) {
|
||||||
m.Status(kit.MDB_TIME, m.Time(), arg, kit.MDB_COST, m.FormatCost())
|
m.Status(TIME, m.Time(), arg, kit.MDB_COST, m.FormatCost())
|
||||||
}
|
}
|
||||||
func (m *Message) StatusTimeCount(arg ...interface{}) {
|
func (m *Message) StatusTimeCount(arg ...interface{}) {
|
||||||
m.Status(kit.MDB_TIME, m.Time(), kit.MDB_COUNT, kit.Split(m.FormatSize())[0], arg, kit.MDB_COST, m.FormatCost())
|
m.Status(TIME, m.Time(), kit.MDB_COUNT, kit.Split(m.FormatSize())[0], arg, kit.MDB_COST, m.FormatCost())
|
||||||
}
|
}
|
||||||
func (m *Message) StatusTimeCountTotal(arg ...interface{}) {
|
func (m *Message) StatusTimeCountTotal(arg ...interface{}) {
|
||||||
m.Status(kit.MDB_TIME, m.Time(), kit.MDB_COUNT, kit.Split(m.FormatSize())[0], kit.MDB_TOTAL, arg, kit.MDB_COST, m.FormatCost())
|
m.Status(TIME, m.Time(), kit.MDB_COUNT, kit.Split(m.FormatSize())[0], kit.MDB_TOTAL, arg, kit.MDB_COST, m.FormatCost())
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Message) Confirm(text string) string {
|
func (m *Message) Confirm(text string) string {
|
||||||
return m.Cmdx("space", m.Option(MSG_DAEMON), "confirm", text)
|
return m.Cmdx(SPACE, m.Option(MSG_DAEMON), "confirm", text)
|
||||||
}
|
}
|
||||||
func (m *Message) ToastSuccess(arg ...interface{}) {
|
func (m *Message) ToastSuccess(arg ...interface{}) {
|
||||||
m.Toast(SUCCESS, arg...)
|
m.Toast(SUCCESS, arg...)
|
||||||
@ -144,9 +144,9 @@ func (m *Message) Toast(text string, arg ...interface{}) { // [title [duration [
|
|||||||
}
|
}
|
||||||
func (m *Message) PushNotice(arg ...interface{}) {
|
func (m *Message) PushNotice(arg ...interface{}) {
|
||||||
if m.Option(MSG_USERPOD) == "" {
|
if m.Option(MSG_USERPOD) == "" {
|
||||||
m.Cmd("space", m.Option(MSG_DAEMON), arg)
|
m.Cmd(SPACE, m.Option(MSG_DAEMON), arg)
|
||||||
} else {
|
} else {
|
||||||
m.Cmd("web.spide", "dev", m.MergeURL2("/share/toast/"), kit.Format(kit.Dict("pod", m.Option(MSG_DAEMON), "cmds", kit.Simple(arg...))))
|
m.Cmd(SPIDE, DEV, m.MergeURL2("/share/toast/"), kit.Format(kit.Dict(POD, m.Option(MSG_DAEMON), "cmds", kit.Simple(arg...))))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *Message) PushNoticeGrow(arg ...interface{}) {
|
func (m *Message) PushNoticeGrow(arg ...interface{}) {
|
||||||
@ -204,7 +204,7 @@ func (m *Message) ProcessCommand(cmd string, val []string, arg ...string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
m.Cmdy("command", cmd)
|
m.Cmdy(COMMAND, cmd)
|
||||||
m.ProcessField(cmd, RUN)
|
m.ProcessField(cmd, RUN)
|
||||||
m.Push(ARG, kit.Format(val))
|
m.Push(ARG, kit.Format(val))
|
||||||
}
|
}
|
||||||
|
32
render.go
32
render.go
@ -18,7 +18,7 @@ func Render(m *Message, cmd string, args ...interface{}) string {
|
|||||||
switch arg := kit.Simple(args...); cmd {
|
switch arg := kit.Simple(args...); cmd {
|
||||||
case RENDER_ANCHOR: // [name] link
|
case RENDER_ANCHOR: // [name] link
|
||||||
p := kit.Select(arg[0], arg, 1)
|
p := kit.Select(arg[0], arg, 1)
|
||||||
if !strings.HasPrefix(p, "http") {
|
if !strings.HasPrefix(p, HTTP) {
|
||||||
p = m.MergeURL2(p)
|
p = m.MergeURL2(p)
|
||||||
}
|
}
|
||||||
return kit.Format(`<a href="%s" target="_blank">%s</a>`, p, arg[0])
|
return kit.Format(`<a href="%s" target="_blank">%s</a>`, p, arg[0])
|
||||||
@ -76,15 +76,15 @@ func (m *Message) RenderDownload(args ...interface{}) *Message {
|
|||||||
return m.Render(RENDER_DOWNLOAD, args...)
|
return m.Render(RENDER_DOWNLOAD, args...)
|
||||||
}
|
}
|
||||||
func (m *Message) RenderIndex(serve, repos string, file ...string) *Message {
|
func (m *Message) RenderIndex(serve, repos string, file ...string) *Message {
|
||||||
return m.RenderDownload(path.Join(m.Conf(serve, kit.Keym(repos, kit.MDB_PATH)), kit.Select(m.Conf(serve, kit.Keym(repos, kit.MDB_INDEX)), path.Join(file...))))
|
return m.RenderDownload(path.Join(m.Conf(serve, kit.Keym(repos, "path")), kit.Select(m.Conf(serve, kit.Keym(repos, INDEX)), path.Join(file...))))
|
||||||
}
|
}
|
||||||
func (m *Message) RenderCmd(index string, args ...interface{}) {
|
func (m *Message) RenderCmd(index string, args ...interface{}) {
|
||||||
list := index
|
list := index
|
||||||
if index != "" {
|
if index != "" {
|
||||||
msg := m.Cmd("command", index)
|
msg := m.Cmd(COMMAND, index)
|
||||||
list = kit.Format(kit.List(kit.Dict(
|
list = kit.Format(kit.List(kit.Dict(
|
||||||
kit.MDB_INDEX, index, kit.MDB_ARGS, kit.Simple(args),
|
INDEX, index, ARGS, kit.Simple(args),
|
||||||
msg.AppendSimple(kit.MDB_NAME, kit.MDB_HELP),
|
msg.AppendSimple(NAME, "help"),
|
||||||
"feature", kit.UnMarshal(msg.Append("meta")),
|
"feature", kit.UnMarshal(msg.Append("meta")),
|
||||||
"inputs", kit.UnMarshal(msg.Append("list")),
|
"inputs", kit.UnMarshal(msg.Append("list")),
|
||||||
)))
|
)))
|
||||||
@ -110,17 +110,17 @@ func (m *Message) IsCliUA() bool {
|
|||||||
}
|
}
|
||||||
func (m *Message) PushAnchor(arg ...interface{}) { // [name] link
|
func (m *Message) PushAnchor(arg ...interface{}) { // [name] link
|
||||||
if !m.IsCliUA() {
|
if !m.IsCliUA() {
|
||||||
m.Push(kit.MDB_LINK, Render(m, RENDER_ANCHOR, arg...))
|
m.Push("link", Render(m, RENDER_ANCHOR, arg...))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *Message) PushButton(arg ...interface{}) { // name...
|
func (m *Message) PushButton(arg ...interface{}) { // name...
|
||||||
if !m.IsCliUA() {
|
if !m.IsCliUA() {
|
||||||
m.Push(kit.MDB_ACTION, Render(m, RENDER_BUTTON, arg...))
|
m.Push(ACTION, Render(m, RENDER_BUTTON, arg...))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *Message) PushScript(arg ...string) { // [type] text...
|
func (m *Message) PushScript(arg ...string) { // [type] text...
|
||||||
if !m.IsCliUA() {
|
if !m.IsCliUA() {
|
||||||
m.Push(kit.MDB_SCRIPT, Render(m, RENDER_SCRIPT, arg))
|
m.Push("script", Render(m, RENDER_SCRIPT, arg))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *Message) PushQRCode(key string, src string, arg ...string) { // key src [size]
|
func (m *Message) PushQRCode(key string, src string, arg ...string) { // key src [size]
|
||||||
@ -150,7 +150,7 @@ func (m *Message) PushDownload(key string, arg ...interface{}) { // [name] file
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *Message) PushAction(list ...interface{}) {
|
func (m *Message) PushAction(list ...interface{}) {
|
||||||
m.Set(MSG_APPEND, "action")
|
m.Set(MSG_APPEND, ACTION)
|
||||||
m.Table(func(index int, value map[string]string, head []string) {
|
m.Table(func(index int, value map[string]string, head []string) {
|
||||||
m.PushButton(list...)
|
m.PushButton(list...)
|
||||||
})
|
})
|
||||||
@ -162,14 +162,14 @@ func (m *Message) PushPodCmd(cmd string, arg ...string) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
m.Cmd("space").Table(func(index int, value map[string]string, head []string) {
|
m.Cmd(SPACE).Table(func(index int, value map[string]string, head []string) {
|
||||||
switch value[kit.MDB_TYPE] {
|
switch value[TYPE] {
|
||||||
case "server", "worker":
|
case "server", "worker":
|
||||||
if value[kit.MDB_NAME] == Info.HostName {
|
if value[NAME] == Info.HostName {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
m.Cmd("space", value[kit.MDB_NAME], m.Prefix(cmd), arg).Table(func(index int, val map[string]string, head []string) {
|
m.Cmd(SPACE, value[NAME], m.Prefix(cmd), arg).Table(func(index int, val map[string]string, head []string) {
|
||||||
val[POD] = kit.Keys(value[kit.MDB_NAME], val[POD])
|
val[POD] = kit.Keys(value[NAME], val[POD])
|
||||||
m.Push("", val, head)
|
m.Push("", val, head)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -185,7 +185,7 @@ func (m *Message) PushSearch(args ...interface{}) {
|
|||||||
m.Push(k, kit.Select(m.Prefix(), data[k]))
|
m.Push(k, kit.Select(m.Prefix(), data[k]))
|
||||||
case CMD:
|
case CMD:
|
||||||
m.Push(k, kit.Select(m.CommandKey(), data[k]))
|
m.Push(k, kit.Select(m.CommandKey(), data[k]))
|
||||||
case kit.MDB_TIME:
|
case TIME:
|
||||||
m.Push(k, kit.Select(m.Time(), data[k]))
|
m.Push(k, kit.Select(m.Time(), data[k]))
|
||||||
default:
|
default:
|
||||||
m.Push(k, kit.Select("", data[k]))
|
m.Push(k, kit.Select("", data[k]))
|
||||||
@ -243,7 +243,7 @@ func (m *Message) Display(file string, arg ...interface{}) *Message {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func DisplayBase(file string, arg ...string) map[string]string {
|
func DisplayBase(file string, arg ...string) map[string]string {
|
||||||
return map[string]string{DISPLAY: file, kit.MDB_STYLE: kit.Join(arg, SP)}
|
return map[string]string{DISPLAY: file, STYLE: kit.Join(arg, SP)}
|
||||||
}
|
}
|
||||||
func DisplayLocal(file string, arg ...string) map[string]string {
|
func DisplayLocal(file string, arg ...string) map[string]string {
|
||||||
if file == "" {
|
if file == "" {
|
||||||
|
18
type.go
18
type.go
@ -154,7 +154,7 @@ func (c *Context) Merge(s *Context) *Context {
|
|||||||
help = strings.SplitN(help[0], ":", 2)
|
help = strings.SplitN(help[0], ":", 2)
|
||||||
}
|
}
|
||||||
if kit.Value(cmd.Meta, kit.Keys("_trans", strings.TrimPrefix(k, "_")), help[0]); len(help) > 1 {
|
if kit.Value(cmd.Meta, kit.Keys("_trans", strings.TrimPrefix(k, "_")), help[0]); len(help) > 1 {
|
||||||
kit.Value(cmd.Meta, kit.Keys(kit.MDB_TITLE, k), help[1])
|
kit.Value(cmd.Meta, kit.Keys("title", k), help[1])
|
||||||
}
|
}
|
||||||
if a.Hand == nil {
|
if a.Hand == nil {
|
||||||
continue // alias cmd
|
continue // alias cmd
|
||||||
@ -374,7 +374,7 @@ func (m *Message) Search(key string, cb interface{}) *Message {
|
|||||||
|
|
||||||
// 查找模块
|
// 查找模块
|
||||||
p := m.target.root
|
p := m.target.root
|
||||||
if key = strings.TrimPrefix(key, "ice."); key == "." {
|
if key = strings.TrimPrefix(key, "ice."); key == PT {
|
||||||
p, key = m.target, ""
|
p, key = m.target, ""
|
||||||
} else if key == ".." {
|
} else if key == ".." {
|
||||||
p, key = m.target.context, ""
|
p, key = m.target.context, ""
|
||||||
@ -460,17 +460,17 @@ func (m *Message) Search(key string, cb interface{}) *Message {
|
|||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Message) Cmdy(arg ...interface{}) *Message {
|
func (m *Message) Cmd(arg ...interface{}) *Message {
|
||||||
return m.Copy(m.cmd(arg...))
|
return m.cmd(arg...)
|
||||||
}
|
|
||||||
func (m *Message) Cmdx(arg ...interface{}) string {
|
|
||||||
return kit.Select("", m.cmd(arg...).meta[MSG_RESULT], 0)
|
|
||||||
}
|
}
|
||||||
func (m *Message) Cmds(arg ...interface{}) *Message {
|
func (m *Message) Cmds(arg ...interface{}) *Message {
|
||||||
return m.Go(func() { m.cmd(arg...) })
|
return m.Go(func() { m.cmd(arg...) })
|
||||||
}
|
}
|
||||||
func (m *Message) Cmd(arg ...interface{}) *Message {
|
func (m *Message) Cmdx(arg ...interface{}) string {
|
||||||
return m.cmd(arg...)
|
return kit.Select("", m.cmd(arg...).meta[MSG_RESULT], 0)
|
||||||
|
}
|
||||||
|
func (m *Message) Cmdy(arg ...interface{}) *Message {
|
||||||
|
return m.Copy(m.cmd(arg...))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Message) Confi(key string, sub string) int {
|
func (m *Message) Confi(key string, sub string) int {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user