1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-01-16 22:09:32 +08:00
parent e076a59eec
commit aeea2a4bad
9 changed files with 27 additions and 30 deletions

View File

@ -253,7 +253,7 @@ func init() {
m.Echo("%v", string(buf)) m.Echo("%v", string(buf))
}}, }},
"upgrade": {Help: "升级", Hand: func(m *ice.Message, arg ...string) { "upgrade": {Help: "升级", Hand: func(m *ice.Message, arg ...string) {
if nfs.Exists(m, ".git") { if nfs.Exists(m, ".git") && SystemFind(m, "go") != "" {
m.Cmdy("web.code.compile") m.Cmdy("web.code.compile")
} else { } else {
m.Cmdy("web.code.upgrade") m.Cmdy("web.code.upgrade")

View File

@ -71,7 +71,7 @@ func _dream_start(m *ice.Message, name string) {
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)
gdb.Event(m, DREAM_CREATE, m.OptionSimple(mdb.NAME, mdb.TYPE, cli.CMD_DIR)) gdb.Event(m, DREAM_CREATE, m.OptionSimple(mdb.NAME, mdb.TYPE, cli.CMD_DIR))
kit.If(m.Option(nfs.BINARY) == "", func(p string) { m.Option(nfs.BINARY, SpideOrigin(m, ice.DEV)+S(name)) }) 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), 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))
@ -156,10 +156,9 @@ func init() {
m.Cmd(gdb.EVENT, gdb.LISTEN, gdb.EVENT, DREAM_TABLES, ice.CMD, cmd) m.Cmd(gdb.EVENT, gdb.LISTEN, gdb.EVENT, DREAM_TABLES, ice.CMD, cmd)
m.Cmd(gdb.EVENT, gdb.LISTEN, gdb.EVENT, DREAM_ACTION, ice.CMD, cmd) m.Cmd(gdb.EVENT, gdb.LISTEN, gdb.EVENT, DREAM_ACTION, ice.CMD, cmd)
} }
aaa.White(m, kit.Keys(m.PrefixKey(), ctx.ACTION, DREAM_ACTION, ctx.RUN))
}}, }},
html.BUTTON: {Hand: func(m *ice.Message, arg ...string) { html.BUTTON: {Hand: func(m *ice.Message, arg ...string) { mdb.Config(m, html.BUTTON, kit.Join(arg)) }},
mdb.Config(m, html.BUTTON, kit.Join(arg))
}},
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) { mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
if mdb.IsSearchPreview(m, arg) { if mdb.IsSearchPreview(m, arg) {
mdb.HashSelects(m.Spawn()).Table(func(value ice.Maps) { m.PushSearch(mdb.TYPE, WORKER, mdb.TEXT, m.MergePod(value[mdb.NAME]), value) }) mdb.HashSelects(m.Spawn()).Table(func(value ice.Maps) { m.PushSearch(mdb.TYPE, WORKER, mdb.TEXT, m.MergePod(value[mdb.NAME]), value) })
@ -251,8 +250,7 @@ func init() {
}}, }},
FOR_FLOW: {Name: "forFlow name cmd*='sh etc/miss.sh'", Help: "流程", Icon: "bi bi-terminal", Hand: func(m *ice.Message, arg ...string) { FOR_FLOW: {Name: "forFlow name cmd*='sh etc/miss.sh'", Help: "流程", Icon: "bi bi-terminal", Hand: func(m *ice.Message, arg ...string) {
m.Options(ctx.DISPLAY, PLUGIN_XTERM, cli.CMD_OUTPUT, nfs.NewWriteCloser(func(buf []byte) (int, error) { m.Options(ctx.DISPLAY, PLUGIN_XTERM, cli.CMD_OUTPUT, nfs.NewWriteCloser(func(buf []byte) (int, error) {
m.Option(ice.MSG_COUNT, "0") PushNoticeGrow(m.Options(ice.MSG_COUNT, "0"), strings.ReplaceAll(string(buf), lex.NL, "\r\n"))
PushNoticeGrow(m, strings.ReplaceAll(string(buf), lex.NL, "\r\n"))
return len(buf), nil return len(buf), nil
}, func() error { return nil })) }, func() error { return nil }))
msg := mdb.HashSelects(m.Spawn(), m.Option(mdb.NAME)) msg := mdb.HashSelects(m.Spawn(), m.Option(mdb.NAME))
@ -278,7 +276,7 @@ func init() {
}).StatusTimeCount(m.OptionSimple(nfs.FILE)) }).StatusTimeCount(m.OptionSimple(nfs.FILE))
}}, }},
cli.START: {Hand: func(m *ice.Message, arg ...string) { cli.START: {Hand: func(m *ice.Message, arg ...string) {
gdb.Event(m, DREAM_START, arg) defer gdb.Event(m, DREAM_START, arg)
_dream_start(m, m.Option(mdb.NAME)) _dream_start(m, m.Option(mdb.NAME))
}}, }},
cli.STOP: {Hand: func(m *ice.Message, arg ...string) { cli.STOP: {Hand: func(m *ice.Message, arg ...string) {

View File

@ -418,7 +418,8 @@ func SpideDelete(m *ice.Message, arg ...ice.Any) ice.Any {
return kit.UnMarshal(m.Cmdx(http.MethodDelete, arg)) return kit.UnMarshal(m.Cmdx(http.MethodDelete, arg))
} }
func SpideSave(m *ice.Message, file, link string, cb func(count, total, value int)) *ice.Message { func SpideSave(m *ice.Message, file, link string, cb func(count, total, value int)) *ice.Message {
return m.Cmd(Prefix(SPIDE), ice.DEV, SPIDE_SAVE, file, http.MethodGet, link, cb) return m.Cmd(Prefix(SPIDE), ice.DEV_IP, SPIDE_SAVE, file, http.MethodGet, link, cb)
// return m.Cmd(Prefix(SPIDE), ice.DEV, SPIDE_SAVE, file, http.MethodGet, link, cb)
} }
func SpideCache(m *ice.Message, link string) *ice.Message { func SpideCache(m *ice.Message, link string) *ice.Message {
return m.Cmd(Prefix(SPIDE), ice.DEV, SPIDE_CACHE, http.MethodGet, link) return m.Cmd(Prefix(SPIDE), ice.DEV, SPIDE_CACHE, http.MethodGet, link)

View File

@ -36,9 +36,10 @@ const (
CORE = "core" CORE = "core"
MISC = "misc" MISC = "misc"
SHY = "shy" SHY = "shy"
DEV = "dev" DEV = "dev"
OPS = "ops" DEV_IP = "dev_ip"
OPS = "ops"
ICE = "ice" ICE = "ice"
CAN = "can" CAN = "can"

View File

@ -4,6 +4,7 @@ import (
"path" "path"
ice "shylinux.com/x/icebergs" ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/ctx" "shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/mdb" "shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs" "shylinux.com/x/icebergs/base/nfs"
@ -16,7 +17,7 @@ const APPLICATIONS = "applications"
func init() { func init() {
Index.MergeCommands(ice.Commands{ Index.MergeCommands(ice.Commands{
APPLICATIONS: {Help: "应用", Actions: ice.MergeActions(ice.Actions{ APPLICATIONS: {Help: "应用", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { FinderAppend(m, APPLICATIONS, m.PrefixKey()) }}, ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { FinderAppend(m, APPLICATIONS, m.PrefixKey()) }},
code.INSTALL: {Hand: func(m *ice.Message, arg ...string) { AppInstall(m, arg[0], arg[1]) }}, code.INSTALL: {Hand: func(m *ice.Message, arg ...string) { AppInstall(m, arg[0], arg[1]) }},
mdb.CREATE: {Name: "create space index args name icon"}, mdb.CREATE: {Name: "create space index args name icon"},

View File

@ -44,12 +44,8 @@ func init() {
Notify(m, "Infomation.png", cli.RUNTIME, "系统启动成功", ctx.INDEX, cli.RUNTIME) Notify(m, "Infomation.png", cli.RUNTIME, "系统启动成功", ctx.INDEX, cli.RUNTIME)
}}, }},
DESKTOP: {Help: "应用桌面", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{ DESKTOP: {Help: "应用桌面", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) { web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) { m.PushButton(kit.Dict(m.CommandKey(), "桌面")) }},
m.PushButton(kit.Dict(m.CommandKey(), "桌面")) web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, nil, arg...) }},
}},
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) {
web.DreamProcess(m, nil, arg...)
}},
}, PodCmdAction(), CmdHashAction(), mdb.ExportHashAction())}, }, PodCmdAction(), CmdHashAction(), mdb.ExportHashAction())},
}) })
} }

View File

@ -24,7 +24,7 @@ func Prefix(arg ...string) string { return chat.Prefix(MACOS, kit.Keys(arg)) }
func disableApp(m *ice.Message) *ice.Message { func disableApp(m *ice.Message) *ice.Message {
m.Table(func(value ice.Maps) { m.Table(func(value ice.Maps) {
switch ctx.ShortCmd(value[ctx.INDEX]) { switch index := ctx.ShortCmd(value[ctx.INDEX]); index {
case web.DREAM, web.CODE_GIT_SEARCH: case web.DREAM, web.CODE_GIT_SEARCH:
if ice.Info.NodeType == web.WORKER { if ice.Info.NodeType == web.WORKER {
m.Push(mdb.STATUS, mdb.DISABLE) m.Push(mdb.STATUS, mdb.DISABLE)
@ -41,6 +41,9 @@ func disableApp(m *ice.Message) *ice.Message {
m.Push(mdb.STATUS, mdb.DISABLE) m.Push(mdb.STATUS, mdb.DISABLE)
return return
} }
default:
m.Push(mdb.STATUS, kit.Select(mdb.DISABLE, mdb.ENABLE, aaa.Right(m.Spawn(), index)))
return
} }
m.Push(mdb.STATUS, mdb.ENABLE) m.Push(mdb.STATUS, mdb.ENABLE)
}) })

View File

@ -4,7 +4,6 @@ import (
"path" "path"
ice "shylinux.com/x/icebergs" ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/lex" "shylinux.com/x/icebergs/base/lex"
"shylinux.com/x/icebergs/base/mdb" "shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs" "shylinux.com/x/icebergs/base/nfs"
@ -14,7 +13,7 @@ const DRAW = "draw"
func init() { func init() {
Index.MergeCommands(ice.Commands{ Index.MergeCommands(ice.Commands{
DRAW: {Name: "draw path=src/main.svg pid list save actions", Help: "思维导图", Icon: "Grapher.png", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{ DRAW: {Name: "draw path=src/main.svg pid list save actions", Help: "思维导图", Icon: "Grapher.png", 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) {
m.Cmd(mdb.RENDER, mdb.CREATE, mdb.Config(m, lex.REGEXP), m.PrefixKey()) m.Cmd(mdb.RENDER, mdb.CREATE, mdb.Config(m, lex.REGEXP), m.PrefixKey())
}}, }},

View File

@ -29,14 +29,12 @@ func init() {
) )
const SEARCH = "search" const SEARCH = "search"
Index.MergeCommands(ice.Commands{ Index.MergeCommands(ice.Commands{
SEARCH: {Name: "search keyword auto", Help: "源码库", Actions: ice.MergeActions(ice.Actions{ SEARCH: {Name: "search keyword auto", Help: "源码库", 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) { macos.AppInstall(m, "App Store.png", m.PrefixKey()) }},
macos.AppInstall(m, "App Store.png", m.PrefixKey()) cli.START: {Name: "start name*", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(web.DREAM, mdb.CREATE); m.Cmdy(web.DREAM, cli.START) }},
}}, CLONE: {Name: "clone name*", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(REPOS, CLONE, m.Option(REPOS)) }},
cli.START: {Name: "start name*", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(web.DREAM, mdb.CREATE); m.Cmdy(web.DREAM, cli.START) }}, HTML_URL: {Help: "源码", Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(m.Option(HTML_URL)) }},
CLONE: {Name: "clone name*", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(REPOS, CLONE, m.Option(REPOS)) }}, WEBSITE: {Help: "官网", Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(m.Option(WEBSITE)) }},
HTML_URL: {Help: "源码", Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(m.Option(HTML_URL)) }},
WEBSITE: {Help: "官网", Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(m.Option(WEBSITE)) }},
ORIGIN: {Help: "平台", Icon: "bi bi-box-arrow-up-right", Hand: func(m *ice.Message, arg ...string) { ORIGIN: {Help: "平台", Icon: "bi bi-box-arrow-up-right", Hand: func(m *ice.Message, arg ...string) {
m.ProcessOpen(web.SpideOrigin(m, REPOS) + EXPLORE_REPOS) m.ProcessOpen(web.SpideOrigin(m, REPOS) + EXPLORE_REPOS)
}}, }},