1
0
forked from x/icebergs
This commit is contained in:
harveyshao 2021-11-24 11:14:31 +08:00
parent 8a87f1b41f
commit 9245526096
8 changed files with 29 additions and 10 deletions

View File

@ -103,7 +103,7 @@ type Buffer struct {
} }
func (b *Buffer) Write(buf []byte) (int, error) { func (b *Buffer) Write(buf []byte) (int, error) {
b.m.Cmd(SPACE, b.n, "grow", string(buf)) b.m.PushNoticeGrow(string(buf))
return len(buf), nil return len(buf), nil
} }
func (b *Buffer) Close() error { return nil } func (b *Buffer) Close() error { return nil }

View File

@ -158,6 +158,10 @@ func init() {
m.RenderIndex(SERVE, ice.VOLCANOS) m.RenderIndex(SERVE, ice.VOLCANOS)
}}, }},
"/share/toast/": {Name: "/share/toast/", Help: "推送流", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
m.Cmdy(SPACE, m.Option("pod"), m.Optionv("cmds"))
}},
"/share/repos/": {Name: "/share/repos/", Help: "代码库", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { "/share/repos/": {Name: "/share/repos/", Help: "代码库", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
_share_repos(m, path.Join(arg[0], arg[1], arg[2]), arg[3:]...) _share_repos(m, path.Join(arg[0], arg[1], arg[2]), arg[3:]...)
}}, }},

View File

@ -81,6 +81,7 @@ const ( // DIR
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_PUBLISH = "usr/publish" USR_PUBLISH = "usr/publish"

View File

@ -90,7 +90,7 @@ func _install_build(m *ice.Message, arg ...string) {
m.Toast(ice.SUCCESS, cli.BUILD) m.Toast(ice.SUCCESS, cli.BUILD)
} }
func _install_order(m *ice.Message, arg ...string) { func _install_order(m *ice.Message, arg ...string) {
p := kit.Path(m.Config(kit.MDB_PATH), kit.TrimExt(m.Option(kit.MDB_LINK)), m.Option(kit.MDB_PATH)+ice.NL) p := path.Join(m.Config(kit.MDB_PATH), kit.TrimExt(m.Option(kit.MDB_LINK)), m.Option(kit.MDB_PATH)+ice.NL)
if !strings.Contains(m.Cmdx(nfs.CAT, ice.ETC_PATH), p) { if !strings.Contains(m.Cmdx(nfs.CAT, ice.ETC_PATH), p) {
m.Cmd(nfs.PUSH, ice.ETC_PATH, p) m.Cmd(nfs.PUSH, ice.ETC_PATH, p)
} }

View File

@ -52,6 +52,7 @@ func init() {
BINPACK: {Name: "binpack", Help: "打包", Hand: func(m *ice.Message, arg ...string) { BINPACK: {Name: "binpack", Help: "打包", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(AUTOGEN, BINPACK) m.Cmdy(AUTOGEN, BINPACK)
m.Cmd(nfs.COPY, ice.GO_MOD, path.Join(ice.SRC_RELEASE, ice.GO_MOD)) m.Cmd(nfs.COPY, ice.GO_MOD, path.Join(ice.SRC_RELEASE, ice.GO_MOD))
m.Cmd(nfs.COPY, path.Join(ice.USR_RELEASE, "conf.go"), path.Join(ice.USR_ICEBERGS, "conf.go"))
m.ProcessInner() m.ProcessInner()
}}, }},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {

View File

@ -50,7 +50,9 @@ func _plan_list(m *ice.Message, begin_time, end_time time.Time) *ice.Message {
m.Push(key, value, fields, val) m.Push(key, value, fields, val)
m.PushButton(_task_action(m, value[STATUS], mdb.PLUGIN)) m.PushButton(_task_action(m, value[STATUS], mdb.PLUGIN))
}) })
m.Cmd(mdb.SELECT, TASK, "", mdb.ZONE, kit.MDB_FOREACH) m.Debug("what %v", 123)
m.Cmd(mdb.SELECT, m.Prefix(TASK), "", mdb.ZONE, kit.MDB_FOREACH)
m.Debug("what %v", 123)
return m return m
} }

View File

@ -127,12 +127,21 @@ func (m *Message) Toast(text string, arg ...interface{}) { // [title [duration [
} }
} }
m.PushNoticeToast("", text, arg)
}
func (m *Message) PushNotice(arg ...interface{}) {
if m.Option(MSG_USERPOD) == "" { if m.Option(MSG_USERPOD) == "" {
m.Cmd("space", m.Option(MSG_DAEMON), "toast", "", text, arg) m.Cmd("space", m.Option(MSG_DAEMON), arg)
} else { } else {
m.Option(MSG_TOAST, kit.Simple(text, arg)) m.Cmd("web.spide", "dev", kit.MergeURL2(m.Option(MSG_USERWEB), "/share/toast/"), kit.Format(kit.Dict("pod", m.Option(MSG_DAEMON), "cmds", kit.Simple(arg...))))
} }
} }
func (m *Message) PushNoticeGrow(arg ...interface{}) {
m.PushNotice(kit.List("grow", arg)...)
}
func (m *Message) PushNoticeToast(arg ...interface{}) {
m.PushNotice(kit.List("toast", arg)...)
}
func (m *Message) Toast3s(text string, arg ...interface{}) { func (m *Message) Toast3s(text string, arg ...interface{}) {
m.Toast(text, kit.List(kit.Select("", arg, 0), kit.Select("3s", arg, 1))...) m.Toast(text, kit.List(kit.Select("", arg, 0), kit.Select("3s", arg, 1))...)
} }

View File

@ -18,7 +18,8 @@ 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
return kit.Format(`<a href="%s" target="_blank">%s</a>`, kit.Select(arg[0], arg, 1), arg[0]) p := kit.MergeURL2(m.Option(MSG_USERWEB), kit.Select(arg[0], arg, 1))
return kit.Format(`<a href="%s" target="_blank">%s</a>`, p, arg[0])
case RENDER_BUTTON: // name... case RENDER_BUTTON: // name...
if m._cmd == nil || m._cmd.Meta == nil { if m._cmd == nil || m._cmd.Meta == nil {
@ -146,10 +147,11 @@ func (m *Message) PushAction(list ...interface{}) {
}) })
} }
func (m *Message) PushPodCmd(cmd string, arg ...string) { func (m *Message) PushPodCmd(cmd string, arg ...string) {
if m.Length() > 0 && len(m.Appendv(POD)) == 0 {
m.Table(func(index int, value map[string]string, head []string) { m.Table(func(index int, value map[string]string, head []string) {
m.Push(POD, m.Option(MSG_USERPOD)) m.Push(POD, m.Option(MSG_USERPOD))
}) })
m.Debug(m.FormatMeta()) }
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[kit.MDB_TYPE] {