forked from x/icebergs
opt some
This commit is contained in:
parent
e076a59eec
commit
aeea2a4bad
@ -253,7 +253,7 @@ func init() {
|
||||
m.Echo("%v", string(buf))
|
||||
}},
|
||||
"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")
|
||||
} else {
|
||||
m.Cmdy("web.code.upgrade")
|
||||
|
@ -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.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))
|
||||
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.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))
|
||||
@ -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_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) {
|
||||
mdb.Config(m, html.BUTTON, kit.Join(arg))
|
||||
}},
|
||||
html.BUTTON: {Hand: func(m *ice.Message, arg ...string) { mdb.Config(m, html.BUTTON, kit.Join(arg)) }},
|
||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
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) })
|
||||
@ -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) {
|
||||
m.Options(ctx.DISPLAY, PLUGIN_XTERM, cli.CMD_OUTPUT, nfs.NewWriteCloser(func(buf []byte) (int, error) {
|
||||
m.Option(ice.MSG_COUNT, "0")
|
||||
PushNoticeGrow(m, strings.ReplaceAll(string(buf), lex.NL, "\r\n"))
|
||||
PushNoticeGrow(m.Options(ice.MSG_COUNT, "0"), strings.ReplaceAll(string(buf), lex.NL, "\r\n"))
|
||||
return len(buf), nil
|
||||
}, func() error { return nil }))
|
||||
msg := mdb.HashSelects(m.Spawn(), m.Option(mdb.NAME))
|
||||
@ -278,7 +276,7 @@ func init() {
|
||||
}).StatusTimeCount(m.OptionSimple(nfs.FILE))
|
||||
}},
|
||||
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))
|
||||
}},
|
||||
cli.STOP: {Hand: func(m *ice.Message, arg ...string) {
|
||||
|
@ -418,7 +418,8 @@ func SpideDelete(m *ice.Message, arg ...ice.Any) ice.Any {
|
||||
return kit.UnMarshal(m.Cmdx(http.MethodDelete, arg))
|
||||
}
|
||||
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 {
|
||||
return m.Cmd(Prefix(SPIDE), ice.DEV, SPIDE_CACHE, http.MethodGet, link)
|
||||
|
1
conf.go
1
conf.go
@ -38,6 +38,7 @@ const (
|
||||
|
||||
SHY = "shy"
|
||||
DEV = "dev"
|
||||
DEV_IP = "dev_ip"
|
||||
OPS = "ops"
|
||||
|
||||
ICE = "ice"
|
||||
|
@ -4,6 +4,7 @@ import (
|
||||
"path"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
@ -16,7 +17,7 @@ const APPLICATIONS = "applications"
|
||||
|
||||
func init() {
|
||||
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()) }},
|
||||
code.INSTALL: {Hand: func(m *ice.Message, arg ...string) { AppInstall(m, arg[0], arg[1]) }},
|
||||
mdb.CREATE: {Name: "create space index args name icon"},
|
||||
|
@ -44,12 +44,8 @@ func init() {
|
||||
Notify(m, "Infomation.png", cli.RUNTIME, "系统启动成功", ctx.INDEX, cli.RUNTIME)
|
||||
}},
|
||||
DESKTOP: {Help: "应用桌面", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.PushButton(kit.Dict(m.CommandKey(), "桌面"))
|
||||
}},
|
||||
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) {
|
||||
web.DreamProcess(m, nil, arg...)
|
||||
}},
|
||||
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) { m.PushButton(kit.Dict(m.CommandKey(), "桌面")) }},
|
||||
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, nil, arg...) }},
|
||||
}, PodCmdAction(), CmdHashAction(), mdb.ExportHashAction())},
|
||||
})
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ func Prefix(arg ...string) string { return chat.Prefix(MACOS, kit.Keys(arg)) }
|
||||
|
||||
func disableApp(m *ice.Message) *ice.Message {
|
||||
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:
|
||||
if ice.Info.NodeType == web.WORKER {
|
||||
m.Push(mdb.STATUS, mdb.DISABLE)
|
||||
@ -41,6 +41,9 @@ func disableApp(m *ice.Message) *ice.Message {
|
||||
m.Push(mdb.STATUS, mdb.DISABLE)
|
||||
return
|
||||
}
|
||||
default:
|
||||
m.Push(mdb.STATUS, kit.Select(mdb.DISABLE, mdb.ENABLE, aaa.Right(m.Spawn(), index)))
|
||||
return
|
||||
}
|
||||
m.Push(mdb.STATUS, mdb.ENABLE)
|
||||
})
|
||||
|
@ -4,7 +4,6 @@ import (
|
||||
"path"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/lex"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
@ -14,7 +13,7 @@ const DRAW = "draw"
|
||||
|
||||
func init() {
|
||||
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) {
|
||||
m.Cmd(mdb.RENDER, mdb.CREATE, mdb.Config(m, lex.REGEXP), m.PrefixKey())
|
||||
}},
|
||||
|
@ -29,10 +29,8 @@ func init() {
|
||||
)
|
||||
const SEARCH = "search"
|
||||
Index.MergeCommands(ice.Commands{
|
||||
SEARCH: {Name: "search keyword auto", Help: "源码库", Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||
macos.AppInstall(m, "App Store.png", m.PrefixKey())
|
||||
}},
|
||||
SEARCH: {Name: "search keyword auto", Help: "源码库", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { 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)) }},
|
||||
HTML_URL: {Help: "源码", Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen(m.Option(HTML_URL)) }},
|
||||
|
Loading…
x
Reference in New Issue
Block a user