forked from x/icebergs
opt some
This commit is contained in:
parent
8a87f1b41f
commit
9245526096
@ -103,7 +103,7 @@ type Buffer struct {
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
func (b *Buffer) Close() error { return nil }
|
||||
|
@ -158,6 +158,10 @@ func init() {
|
||||
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(m, path.Join(arg[0], arg[1], arg[2]), arg[3:]...)
|
||||
}},
|
||||
|
1
conf.go
1
conf.go
@ -81,6 +81,7 @@ const ( // DIR
|
||||
USR_ICEBERGS = "usr/icebergs"
|
||||
USR_TOOLKITS = "usr/toolkits"
|
||||
USR_INTSHELL = "usr/intshell"
|
||||
USR_RELEASE = "usr/release"
|
||||
USR_INSTALL = "usr/install"
|
||||
USR_PUBLISH = "usr/publish"
|
||||
|
||||
|
@ -90,7 +90,7 @@ func _install_build(m *ice.Message, arg ...string) {
|
||||
m.Toast(ice.SUCCESS, cli.BUILD)
|
||||
}
|
||||
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) {
|
||||
m.Cmd(nfs.PUSH, ice.ETC_PATH, p)
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ func init() {
|
||||
BINPACK: {Name: "binpack", Help: "打包", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(AUTOGEN, BINPACK)
|
||||
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()
|
||||
}},
|
||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
|
@ -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.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
|
||||
}
|
||||
|
||||
|
13
option.go
13
option.go
@ -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) == "" {
|
||||
m.Cmd("space", m.Option(MSG_DAEMON), "toast", "", text, arg)
|
||||
m.Cmd("space", m.Option(MSG_DAEMON), arg)
|
||||
} 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{}) {
|
||||
m.Toast(text, kit.List(kit.Select("", arg, 0), kit.Select("3s", arg, 1))...)
|
||||
}
|
||||
|
12
render.go
12
render.go
@ -18,7 +18,8 @@ func Render(m *Message, cmd string, args ...interface{}) string {
|
||||
|
||||
switch arg := kit.Simple(args...); cmd {
|
||||
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...
|
||||
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) {
|
||||
m.Table(func(index int, value map[string]string, head []string) {
|
||||
m.Push(POD, m.Option(MSG_USERPOD))
|
||||
})
|
||||
m.Debug(m.FormatMeta())
|
||||
if m.Length() > 0 && len(m.Appendv(POD)) == 0 {
|
||||
m.Table(func(index int, value map[string]string, head []string) {
|
||||
m.Push(POD, m.Option(MSG_USERPOD))
|
||||
})
|
||||
}
|
||||
|
||||
m.Cmd("space").Table(func(index int, value map[string]string, head []string) {
|
||||
switch value[kit.MDB_TYPE] {
|
||||
|
Loading…
x
Reference in New Issue
Block a user