forked from x/icebergs
add some
This commit is contained in:
parent
d33f38d7e7
commit
a63f5600b7
@ -28,27 +28,29 @@ func _process_args(m *ice.Message, args ice.Any) []string {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func ProcessField(m *ice.Message, cmd string, args ice.Any, arg ...string) *ice.Message {
|
func ProcessField(m *ice.Message, cmd string, args ice.Any, arg ...string) *ice.Message {
|
||||||
if cmd = kit.Select(m.ActionKey(), cmd); !kit.HasPrefixList(arg, RUN) {
|
if cmd = kit.Select(m.ActionKey(), cmd); kit.HasPrefixList(arg, RUN) {
|
||||||
defer kit.If(m.IsMetaKey(), func() { m.Push(STYLE, html.FLOAT) })
|
if !PodCmd(m, cmd, arg[1:]) && aaa.Right(m, cmd, arg[1:]) {
|
||||||
defer m.Push(ARGS, kit.Format(_process_args(m, args)))
|
m.Cmdy(cmd, arg[1:])
|
||||||
defer m.ProcessField(ACTION, m.ActionKey(), RUN)
|
|
||||||
defer m.Options(ice.MSG_INDEX, m.PrefixKey())
|
|
||||||
if PodCmd(m, COMMAND, cmd) {
|
|
||||||
m.Push(ice.SPACE, m.Option(ice.MSG_USERPOD))
|
|
||||||
} else {
|
|
||||||
m.Cmdy(COMMAND, cmd)
|
|
||||||
}
|
}
|
||||||
} else if !PodCmd(m, cmd, arg[1:]) && aaa.Right(m, cmd, arg[1:]) {
|
return m
|
||||||
m.Cmdy(cmd, arg[1:])
|
|
||||||
}
|
}
|
||||||
|
args = kit.Format(_process_args(m, args))
|
||||||
|
if PodCmd(m, COMMAND, cmd) {
|
||||||
|
m.Push(ice.SPACE, m.Option(ice.MSG_USERPOD))
|
||||||
|
} else {
|
||||||
|
m.Cmdy(COMMAND, cmd)
|
||||||
|
}
|
||||||
|
if m.Push(ARGS, args); m.IsMetaKey() {
|
||||||
|
m.Push(STYLE, html.FLOAT)
|
||||||
|
}
|
||||||
|
m.ProcessField(ACTION, m.ActionKey(), RUN)
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
func ProcessFloat(m *ice.Message, cmd string, args ice.Any, arg ...string) *ice.Message {
|
func ProcessFloat(m *ice.Message, cmd string, args ice.Any, arg ...string) *ice.Message {
|
||||||
if m.IsMetaKey() {
|
if m.IsMetaKey() {
|
||||||
m.ProcessOpen(path.Join("/c/", cmd, path.Join(_process_args(m, args)...)))
|
m.ProcessOpen(path.Join("/c/", cmd, path.Join(_process_args(m, args)...)))
|
||||||
return m
|
return m
|
||||||
}
|
} else if !kit.HasPrefixList(arg, RUN) {
|
||||||
if !kit.HasPrefixList(arg, RUN) {
|
|
||||||
defer m.Push(STYLE, html.FLOAT)
|
defer m.Push(STYLE, html.FLOAT)
|
||||||
}
|
}
|
||||||
return ProcessField(m, cmd, args, arg...)
|
return ProcessField(m, cmd, args, arg...)
|
||||||
|
@ -96,8 +96,6 @@ func _dir_list(m *ice.Message, root string, dir string, level int, deep bool, di
|
|||||||
case mdb.LINK:
|
case mdb.LINK:
|
||||||
if isDir {
|
if isDir {
|
||||||
m.Push(mdb.LINK, "")
|
m.Push(mdb.LINK, "")
|
||||||
} else if strings.Contains(p, "ice.windows.") {
|
|
||||||
m.PushDownload(mdb.LINK, "ice.exe", p)
|
|
||||||
} else {
|
} else {
|
||||||
m.PushDownload(mdb.LINK, p)
|
m.PushDownload(mdb.LINK, p)
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ import (
|
|||||||
|
|
||||||
func _dream_list(m *ice.Message, simple bool) *ice.Message {
|
func _dream_list(m *ice.Message, simple bool) *ice.Message {
|
||||||
list := m.CmdMap(SPACE, mdb.NAME)
|
list := m.CmdMap(SPACE, mdb.NAME)
|
||||||
mdb.HashSelect(m).Table(func(value ice.Maps) {
|
mdb.HashSelects(m).Table(func(value ice.Maps) {
|
||||||
if space, ok := list[value[mdb.NAME]]; ok {
|
if space, ok := list[value[mdb.NAME]]; ok {
|
||||||
if m.IsCliUA() || simple {
|
if m.IsCliUA() || simple {
|
||||||
m.Push(mdb.TYPE, space[mdb.TYPE]).Push(cli.STATUS, cli.START)
|
m.Push(mdb.TYPE, space[mdb.TYPE]).Push(cli.STATUS, cli.START)
|
||||||
@ -128,7 +128,7 @@ func _dream_start(m *ice.Message, name string) {
|
|||||||
cli.CTX_OPS, HostPort(m, tcp.LOCALHOST, m.Cmdv(SERVE, tcp.PORT)), cli.CTX_LOG, ice.VAR_LOG_BOOT_LOG, cli.CTX_PID, ice.VAR_LOG_ICE_PID,
|
cli.CTX_OPS, HostPort(m, tcp.LOCALHOST, m.Cmdv(SERVE, tcp.PORT)), cli.CTX_LOG, ice.VAR_LOG_BOOT_LOG, cli.CTX_PID, ice.VAR_LOG_ICE_PID,
|
||||||
cli.CTX_ROOT, kit.Path(""), cli.PATH, cli.BinPath(p, ""), cli.USER, ice.Info.Username,
|
cli.CTX_ROOT, kit.Path(""), cli.PATH, cli.BinPath(p, ""), cli.USER, ice.Info.Username,
|
||||||
)...), cli.CMD_OUTPUT, path.Join(p, ice.VAR_LOG_BOOT_LOG), mdb.CACHE_CLEAR_ONEXIT, ice.TRUE)
|
)...), cli.CMD_OUTPUT, path.Join(p, ice.VAR_LOG_BOOT_LOG), mdb.CACHE_CLEAR_ONEXIT, ice.TRUE)
|
||||||
kit.If(m.Option(nfs.BINARY) == "" && cli.SystemFind(m, "go") == "", func(p string) { m.Option(nfs.BINARY, SpideOrigin(m, ice.DEV_IP)+S(name)) })
|
kit.If(m.Option(nfs.BINARY) == "" && !cli.SystemFindGo(m), func(p string) { m.Option(nfs.BINARY, S(name)) })
|
||||||
kit.If(m.Option(nfs.BINARY), func(p string) { _dream_binary(m, p) })
|
kit.If(m.Option(nfs.BINARY), func(p string) { _dream_binary(m, p) })
|
||||||
kit.If(m.Option(nfs.TEMPLATE), func(p string) { _dream_template(m, p) })
|
kit.If(m.Option(nfs.TEMPLATE), func(p string) { _dream_template(m, p) })
|
||||||
bin := kit.Select(kit.Path(os.Args[0]), cli.SystemFind(m, ice.ICE_BIN, nfs.PWD+path.Join(p, ice.BIN), nfs.PWD+ice.BIN))
|
bin := kit.Select(kit.Path(os.Args[0]), cli.SystemFind(m, ice.ICE_BIN, nfs.PWD+path.Join(p, ice.BIN), nfs.PWD+ice.BIN))
|
||||||
@ -341,9 +341,9 @@ func init() {
|
|||||||
if cb, ok := m.OptionCB("").(func(string) bool); ok && cb(p) {
|
if cb, ok := m.OptionCB("").(func(string) bool); ok && cb(p) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
defer PushNoticeGrow(m, "\r\n\r\n\r\n")
|
||||||
PushNoticeGrow(m, kit.Format("[%s]%s$ %s\r\n", time.Now().Format(ice.MOD_TIME_ONLY), name, m.Option(ice.CMD)))
|
PushNoticeGrow(m, kit.Format("[%s]%s$ %s\r\n", time.Now().Format(ice.MOD_TIME_ONLY), name, m.Option(ice.CMD)))
|
||||||
m.Cmd(cli.SYSTEM, kit.Split(m.Option(ice.CMD)), kit.Dict(cli.CMD_DIR, p)).Sleep300ms()
|
m.Cmd(cli.SYSTEM, kit.Split(m.Option(ice.CMD)), kit.Dict(cli.CMD_DIR, p)).Sleep300ms()
|
||||||
PushNoticeGrow(m, "\r\n\r\n\r\n")
|
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
ctx.CMDS: {Name: "cmds name cmds*", Help: "命令", Icon: "bi bi-terminal", Hand: func(m *ice.Message, arg ...string) {
|
ctx.CMDS: {Name: "cmds name cmds*", Help: "命令", Icon: "bi bi-terminal", Hand: func(m *ice.Message, arg ...string) {
|
||||||
@ -399,12 +399,12 @@ func init() {
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
STATS_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
STATS_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if msg := _dream_list(m, true); msg.Length() > 0 {
|
if msg := _dream_list(m.Spawn(), true); msg.Length() > 0 {
|
||||||
stat := map[string]int{}
|
stat := map[string]int{}
|
||||||
msg.Table(func(value ice.Maps) { stat[value[mdb.TYPE]]++; stat[value[mdb.STATUS]]++ })
|
msg.Table(func(value ice.Maps) { stat[value[mdb.TYPE]]++; stat[value[mdb.STATUS]]++ })
|
||||||
PushStats(m, kit.Keys(m.CommandKey(), MASTER), stat[MASTER], "", "已连接服务")
|
|
||||||
PushStats(m, kit.Keys(m.CommandKey(), SERVER), stat[SERVER], "", "已连接机器")
|
|
||||||
PushStats(m, kit.Keys(m.CommandKey(), cli.START), stat[cli.START], "", "已启动空间")
|
PushStats(m, kit.Keys(m.CommandKey(), cli.START), stat[cli.START], "", "已启动空间")
|
||||||
|
PushStats(m, kit.Keys(m.CommandKey(), SERVER), stat[SERVER], "", "已连接机器")
|
||||||
|
PushStats(m, kit.Keys(m.CommandKey(), MASTER), stat[MASTER], "", "已连接服务")
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
}, StatsAction(), DreamAction(), DreamTablesAction(), mdb.ImportantHashAction(
|
}, StatsAction(), DreamAction(), DreamTablesAction(), mdb.ImportantHashAction(
|
||||||
@ -440,9 +440,11 @@ func init() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func DreamTablesAction() ice.Actions {
|
func DreamTablesAction(arg ...string) ice.Actions {
|
||||||
return ice.Actions{ice.CTX_INIT: {Hand: DreamWhiteHandle},
|
return ice.Actions{ice.CTX_INIT: {Hand: DreamWhiteHandle},
|
||||||
DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) { m.PushButton(kit.Dict(m.CommandKey(), m.Commands("").Help)) }},
|
DREAM_TABLES: {Hand: func(m *ice.Message, _ ...string) {
|
||||||
|
m.PushButton(kit.Dict(m.CommandKey(), kit.Select(m.Commands("").Help, arg, 0)))
|
||||||
|
}},
|
||||||
DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { DreamProcess(m, "", nil, arg...) }},
|
DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { DreamProcess(m, "", nil, arg...) }},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -481,7 +483,7 @@ func DreamEach(m *ice.Message, name string, status string, cb func(string)) *ice
|
|||||||
}
|
}
|
||||||
msg := m.Spawn()
|
msg := m.Spawn()
|
||||||
m.Cmds(DREAM).Table(func(value ice.Maps) {
|
m.Cmds(DREAM).Table(func(value ice.Maps) {
|
||||||
if value[mdb.STATUS] == kit.Select(cli.START, status) && (value[mdb.NAME] == name || reg.MatchString(kit.Format("%s:%s=%s@%d", value[mdb.NAME], value[mdb.TYPE], value[nfs.MODULE], value[nfs.VERSION]))) {
|
if value[mdb.STATUS] == kit.Select(cli.START, status) && value[mdb.TYPE] == WORKER && (value[mdb.NAME] == name || reg.MatchString(kit.Format("%s:%s=%s@%d", value[mdb.NAME], value[mdb.TYPE], value[nfs.MODULE], value[nfs.VERSION]))) {
|
||||||
msg.Push(mdb.NAME, value[mdb.NAME])
|
msg.Push(mdb.NAME, value[mdb.NAME])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -11,8 +11,7 @@ func ProcessIframe(m *ice.Message, title, link string, arg ...string) *ice.Messa
|
|||||||
if m.IsMetaKey() {
|
if m.IsMetaKey() {
|
||||||
m.ProcessOpen(link)
|
m.ProcessOpen(link)
|
||||||
return m
|
return m
|
||||||
}
|
} else if !kit.HasPrefixList(arg, ctx.RUN) {
|
||||||
if !kit.HasPrefixList(arg, ctx.RUN) {
|
|
||||||
defer m.Push(TITLE, title)
|
defer m.Push(TITLE, title)
|
||||||
}
|
}
|
||||||
return ctx.ProcessFloat(m, CHAT_IFRAME, link, arg...)
|
return ctx.ProcessFloat(m, CHAT_IFRAME, link, arg...)
|
||||||
|
@ -381,14 +381,12 @@ func init() {
|
|||||||
ice.Info.AdminCmd = AdminCmd
|
ice.Info.AdminCmd = AdminCmd
|
||||||
ctx.PodCmd = func(m *ice.Message, arg ...ice.Any) bool {
|
ctx.PodCmd = func(m *ice.Message, arg ...ice.Any) bool {
|
||||||
Upload(m)
|
Upload(m)
|
||||||
for _, key := range []string{ice.POD} {
|
if pod := m.Option(ice.POD); pod != "" {
|
||||||
if pod := m.Option(key); pod != "" {
|
if ls := kit.Simple(m.Optionv(ice.MSG_UPLOAD)); len(ls) > 1 {
|
||||||
if ls := kit.Simple(m.Optionv(ice.MSG_UPLOAD)); len(ls) > 1 {
|
m.Cmd(SPACE, pod, SPIDE, ice.DEV, CACHE, SHARE_CACHE+ls[0])
|
||||||
m.Cmd(SPACE, pod, SPIDE, ice.DEV, CACHE, SHARE_CACHE+ls[0])
|
|
||||||
}
|
|
||||||
m.Options(key, []string{}, ice.MSG_USERPOD, pod).Cmdy(append(kit.List(ice.SPACE, pod), arg...)...)
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
m.Options(ice.POD, []string{}, ice.MSG_USERPOD, pod).Cmdy(append(kit.List(ice.SPACE, pod), arg...)...)
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -97,13 +97,13 @@ func GoToast(m *ice.Message, cb func(toast func(name string, count, total int))
|
|||||||
icon = Icons[ice.FAILURE]
|
icon = Icons[ice.FAILURE]
|
||||||
m.Option(ice.TOAST_DURATION, cli.TIME_30s)
|
m.Option(ice.TOAST_DURATION, cli.TIME_30s)
|
||||||
toast(kit.JoinWord(list...), len(list), _total)
|
toast(kit.JoinWord(list...), len(list), _total)
|
||||||
|
m.Sleep(m.Option(ice.TOAST_DURATION))
|
||||||
} else {
|
} else {
|
||||||
icon = Icons[ice.SUCCESS]
|
icon = Icons[ice.SUCCESS]
|
||||||
m.Option(ice.TOAST_DURATION, cli.TIME_3s)
|
m.Option(ice.TOAST_DURATION, cli.TIME_3s)
|
||||||
toast(ice.SUCCESS, _total, _total)
|
toast(ice.SUCCESS, _total, _total)
|
||||||
}
|
}
|
||||||
Count(m, kit.FuncName(1), toastTitle(m), kit.FmtDuration(time.Now().Sub(begin)))
|
Count(m, kit.FuncName(1), toastTitle(m), kit.FmtDuration(time.Now().Sub(begin)))
|
||||||
m.Sleep(m.Option(ice.TOAST_DURATION))
|
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
func Toast(m *ice.Message, text string, arg ...ice.Any) *ice.Message { // [title [duration [progress [hash]]]]
|
func Toast(m *ice.Message, text string, arg ...ice.Any) *ice.Message { // [title [duration [progress [hash]]]]
|
||||||
|
@ -132,7 +132,7 @@ func FavorPreview(m *ice.Message, arg ...string) {
|
|||||||
case ctx.INDEX:
|
case ctx.INDEX:
|
||||||
index = msg.Append(mdb.NAME)
|
index = msg.Append(mdb.NAME)
|
||||||
case nfs.SHY:
|
case nfs.SHY:
|
||||||
index = web.WIKI_WORD
|
index = web.WORD
|
||||||
}
|
}
|
||||||
web.ProcessPodCmd(m, m.Option(web.SPACE), index, args, arg...)
|
web.ProcessPodCmd(m, m.Option(web.SPACE), index, args, arg...)
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ const COMPILE = "compile"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
COMPILE: {Name: "compile arch=amd64,386,arm,arm64,mipsle os=linux,darwin,windows src=src/main.go@key run binpack webpack devpack install", Help: "构建", Icon: "go.png", Actions: ice.MergeActions(ice.Actions{
|
COMPILE: {Name: "compile arch=amd64,386,arm,arm64,mipsle os=linux,darwin,windows file=src/main.go@key run binpack webpack devpack install", Help: "构建", Icon: "go.png", Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { cli.IsAlpine(m, GO, "go git") }},
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { cli.IsAlpine(m, GO, "go git") }},
|
||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
|
@ -28,7 +28,7 @@ func _publish_list(m *ice.Message, arg ...string) *ice.Message {
|
|||||||
m.Option(nfs.DIR_REG, kit.Select("", arg, 0))
|
m.Option(nfs.DIR_REG, kit.Select("", arg, 0))
|
||||||
defer m.Table(func(value ice.Maps) {
|
defer m.Table(func(value ice.Maps) {
|
||||||
if p := value[nfs.PATH]; strings.Contains(p, "ice.windows.") {
|
if p := value[nfs.PATH]; strings.Contains(p, "ice.windows.") {
|
||||||
m.PushDownload(mdb.LINK, "ice.exe", p)
|
m.PushDownload(mdb.LINK, "ice.exe", "/publish/"+p)
|
||||||
} else {
|
} else {
|
||||||
m.Push(mdb.LINK, kit.MergeURL2(web.UserHost(m), "/publish/"+p))
|
m.Push(mdb.LINK, kit.MergeURL2(web.UserHost(m), "/publish/"+p))
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
VIMER: {Name: "vimer path=src/ file=main.go line=1 list", Help: "编程", Icon: "vimer.png", Role: aaa.VOID, Meta: kit.Dict(
|
VIMER: {Name: "vimer path=src/ file=main.go line=1 list", Help: "编辑器", Icon: "vimer.png", Role: aaa.VOID, Meta: kit.Dict(
|
||||||
ctx.STYLE, INNER, ice.CTX_TRANS, kit.Dict(html.INPUT, kit.Dict(cli.MAIN, "程序")),
|
ctx.STYLE, INNER, ice.CTX_TRANS, kit.Dict(html.INPUT, kit.Dict(cli.MAIN, "程序")),
|
||||||
), Actions: ice.MergeActions(ice.Actions{
|
), Actions: ice.MergeActions(ice.Actions{
|
||||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
@ -207,10 +207,12 @@ func init() {
|
|||||||
chat.FAVOR_ACTION: {Hand: func(m *ice.Message, arg ...string) {
|
chat.FAVOR_ACTION: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
kit.If(m.Option(mdb.TYPE) == nfs.FILE, func() { ctx.ProcessField(m, m.PrefixKey(), nfs.SplitPath(m, m.Option(mdb.TEXT))) })
|
kit.If(m.Option(mdb.TYPE) == nfs.FILE, func() { ctx.ProcessField(m, m.PrefixKey(), nfs.SplitPath(m, m.Option(mdb.TEXT))) })
|
||||||
}},
|
}},
|
||||||
}, ctx.ConfAction(ctx.TOOLS, "xterm,compile,runtime"), chat.FavorAction(), web.DreamTablesAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, ctx.ConfAction(ctx.TOOLS, "xterm,compile,runtime"), chat.FavorAction(), web.DreamTablesAction("编程")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Cmdy(INNER, arg); arg[0] != ctx.ACTION {
|
if m.Cmdy(INNER, arg); arg[0] != ctx.ACTION {
|
||||||
if web.IsLocalHost(m) {
|
if web.IsLocalHost(m) {
|
||||||
m.Action(nfs.SAVE, COMPILE, mdb.SHOW, ice.APP)
|
m.Action(nfs.SAVE, COMPILE, mdb.SHOW, ice.APP)
|
||||||
|
} else if m.IsMobileUA() {
|
||||||
|
m.Action(nfs.SAVE, COMPILE)
|
||||||
} else {
|
} else {
|
||||||
m.Action(nfs.SAVE, COMPILE, mdb.SHOW)
|
m.Action(nfs.SAVE, COMPILE, mdb.SHOW)
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ const WORD = "word"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
WORD: {Name: "word path=src/main.shy@key auto play favor", Help: "文档", Icon: "Books.png", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
WORD: {Name: "word path=src/main.shy@key auto play favor", Help: "上下文", Icon: "Books.png", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
WordAlias(m, NAVMENU, TITLE, NAVMENU)
|
WordAlias(m, NAVMENU, TITLE, NAVMENU)
|
||||||
WordAlias(m, PREMENU, TITLE, PREMENU)
|
WordAlias(m, PREMENU, TITLE, PREMENU)
|
||||||
@ -68,12 +68,11 @@ func init() {
|
|||||||
code.COMPLETE: {Hand: func(m *ice.Message, arg ...string) {
|
code.COMPLETE: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
kit.If(kit.IsIn(kit.Split(m.Option(mdb.TEXT))[0], IMAGE, VIDEO, AUDIO), func() { m.Cmdy(FEEL).CutTo(nfs.PATH, mdb.NAME) })
|
kit.If(kit.IsIn(kit.Split(m.Option(mdb.TEXT))[0], IMAGE, VIDEO, AUDIO), func() { m.Cmdy(FEEL).CutTo(nfs.PATH, mdb.NAME) })
|
||||||
}},
|
}},
|
||||||
// "favor": {Help: "收藏", Icon: "bi bi-star", Hand: func(m *ice.Message, arg ...string) {
|
"favor": {Hand: func(m *ice.Message, arg ...string) {
|
||||||
"favor": {Help: "收藏", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
m.Cmd(web.CHAT_FAVOR, mdb.CREATE, mdb.TYPE, nfs.SHY, mdb.NAME, path.Base(arg[0]), mdb.TEXT, arg[0])
|
m.Cmd(web.CHAT_FAVOR, mdb.CREATE, mdb.TYPE, nfs.SHY, mdb.NAME, path.Base(arg[0]), mdb.TEXT, arg[0])
|
||||||
m.ProcessHold("favor success")
|
m.ProcessHold("favor success")
|
||||||
}},
|
}},
|
||||||
}, WikiAction("", nfs.SHY), web.DreamTablesAction(), mdb.HashAction(mdb.SHORT, nfs.PATH, mdb.FIELD, "time,path")), Hand: func(m *ice.Message, arg ...string) {
|
}, WikiAction("", nfs.SHY), web.DreamTablesAction("文档"), mdb.HashAction(mdb.SHORT, nfs.PATH, mdb.FIELD, "time,path")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) > 0 && !strings.HasPrefix(arg[0], nfs.USR_LEARNING_PORTAL) {
|
if len(arg) > 0 && !strings.HasPrefix(arg[0], nfs.USR_LEARNING_PORTAL) {
|
||||||
mdb.HashCreate(m.Spawn(), nfs.PATH, arg[0])
|
mdb.HashCreate(m.Spawn(), nfs.PATH, arg[0])
|
||||||
}
|
}
|
||||||
|
9
logs.go
9
logs.go
@ -153,13 +153,14 @@ func (m *Message) WarnAlreadyExists(err Any, arg ...Any) bool {
|
|||||||
return m.Warn(err, ErrAlreadyExists, kit.Simple(arg...), logs.FileLineMeta(2))
|
return m.Warn(err, ErrAlreadyExists, kit.Simple(arg...), logs.FileLineMeta(2))
|
||||||
}
|
}
|
||||||
func (m *Message) ErrorNotImplement(arg ...Any) *Message {
|
func (m *Message) ErrorNotImplement(arg ...Any) *Message {
|
||||||
m.Error(true, append(kit.List(ErrNotImplement), arg...)...)
|
m.Error(true, append(kit.List(ErrNotImplement), append(arg, logs.FileLineMeta(2)))...)
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
func (m *Message) Error(err bool, arg ...Any) bool {
|
func (m *Message) Error(err bool, arg ...Any) bool {
|
||||||
if err {
|
if m.Warn(err, arg...) {
|
||||||
str, meta := m.join(arg...)
|
str, _ := m.join(arg...)
|
||||||
m.log(LOG_ERROR, m.FormatChain()).log(LOG_ERROR, str, meta).log(LOG_ERROR, m.FormatStack(2, 100)).error(arg...)
|
m.error(arg...)
|
||||||
|
panic(str)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
|
@ -31,7 +31,7 @@ const STATUS = "status"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
STATUS: {Name: "status repos:text auto", Help: "源码", Icon: "git.png", Role: aaa.VOID, Meta: kit.Dict(
|
STATUS: {Name: "status repos:text auto", Help: "源代码", Icon: "git.png", Role: aaa.VOID, Meta: kit.Dict(
|
||||||
ice.CTX_TRANS, kit.Dict(html.INPUT, kit.Dict("actions", "操作", "message", "信息", "remote", "远程库")),
|
ice.CTX_TRANS, kit.Dict(html.INPUT, kit.Dict("actions", "操作", "message", "信息", "remote", "远程库")),
|
||||||
), Actions: ice.MergeActions(ice.Actions{
|
), Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: web.DreamWhiteHandle},
|
ice.CTX_INIT: {Hand: web.DreamWhiteHandle},
|
||||||
@ -57,7 +57,7 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if !nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME), _GIT)) {
|
if !nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME), _GIT)) {
|
||||||
m.Push(mdb.TEXT, "").PushButton(kit.Dict(m.CommandKey(), m.Commands("").Help))
|
m.Push(mdb.TEXT, "").PushButton(kit.Dict(m.CommandKey(), "源码"))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
text := []string{}
|
text := []string{}
|
||||||
@ -94,7 +94,12 @@ func init() {
|
|||||||
m.EchoInfoButton(nfs.Template(m, "init.html"), INIT)
|
m.EchoInfoButton(nfs.Template(m, "init.html"), INIT)
|
||||||
} else if len(arg) == 0 {
|
} else if len(arg) == 0 {
|
||||||
kit.If(config != nil, func() { m.Option(aaa.EMAIL, kit.Select(mdb.Config(m, aaa.EMAIL), config.User.Email)) })
|
kit.If(config != nil, func() { m.Option(aaa.EMAIL, kit.Select(mdb.Config(m, aaa.EMAIL), config.User.Email)) })
|
||||||
m.Cmdy(REPOS, STATUS).Action(PULL, PUSH, INSTEADOF, mdb.DEV_REQUEST, ctx.CONFIG, STASH)
|
m.Cmdy(REPOS, STATUS)
|
||||||
|
if m.IsMobileUA() {
|
||||||
|
m.Action(PULL, PUSH)
|
||||||
|
} else {
|
||||||
|
m.Action(PULL, PUSH, INSTEADOF, mdb.DEV_REQUEST, ctx.CONFIG, STASH)
|
||||||
|
}
|
||||||
kit.If(!m.IsCliUA(), func() { m.Cmdy(code.PUBLISH, ice.CONTEXTS, ice.DEV) })
|
kit.If(!m.IsCliUA(), func() { m.Cmdy(code.PUBLISH, ice.CONTEXTS, ice.DEV) })
|
||||||
ctx.Toolkit(m)
|
ctx.Toolkit(m)
|
||||||
} else {
|
} else {
|
||||||
|
@ -64,10 +64,10 @@ type relay struct {
|
|||||||
field string `data:"time,machine,username,host,port,portal,dream,module,version,commitTime,compileTime,bootTime,go,git,package,shell,kernel,arch,ncpu,vcpu,mhz,mem,disk,network,listen,socket,proc,vendor"`
|
field string `data:"time,machine,username,host,port,portal,dream,module,version,commitTime,compileTime,bootTime,go,git,package,shell,kernel,arch,ncpu,vcpu,mhz,mem,disk,network,listen,socket,proc,vendor"`
|
||||||
statsTables string `name:"statsTables" event:"stats.tables"`
|
statsTables string `name:"statsTables" event:"stats.tables"`
|
||||||
create string `name:"create machine* username* host* port*=22"`
|
create string `name:"create machine* username* host* port*=22"`
|
||||||
stats string `name:"stats machine" help:"采集" icon:"bi bi-pc-display"`
|
stats string `name:"stats machine" help:"采集" icon:"bi bi-card-list"`
|
||||||
dream string `name:"dream" help:"空间" icon:"bi bi-grid-3x3-gap"`
|
dream string `name:"dream" help:"空间" icon:"bi bi-grid-3x3-gap"`
|
||||||
forEach string `name:"forEach machine cmd*:textarea=pwd" help:"遍历" icon:"bi bi-card-list"`
|
forEach string `name:"forEach machine cmd*:textarea=pwd"`
|
||||||
forFlow string `name:"forFlow machine cmd*:textarea=pwd" help:"流程" icon:"bi bi-terminal"`
|
forFlow string `name:"forFlow machine cmd*:textarea=pwd"`
|
||||||
pubkey string `name:"pubkey" help:"公钥" icon:"bi bi-person-vcard"`
|
pubkey string `name:"pubkey" help:"公钥" icon:"bi bi-person-vcard"`
|
||||||
publish string `name:"publish" help:"发布" icon:"bi bi-send-check"`
|
publish string `name:"publish" help:"发布" icon:"bi bi-send-check"`
|
||||||
list string `name:"list machine auto" help:"机器" icon:"relay.png"`
|
list string `name:"list machine auto" help:"机器" icon:"relay.png"`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user