1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 01:24:05 +08:00
This commit is contained in:
shylinux@163.com 2022-08-29 09:14:48 +08:00
parent 4c981b2236
commit cab4df37b9
3 changed files with 5 additions and 6 deletions

View File

@ -113,7 +113,6 @@ func _system_exec(m *ice.Message, cmd *exec.Cmd) {
if e := cmd.Run(); !m.Warn(e, ice.ErrNotFound, cmd.Args) {
m.Cost(CODE, cmd.ProcessState.ExitCode(), ctx.ARGS, cmd.Args)
}
m.Push(mdb.TIME, m.Time()).Push(CODE, int(cmd.ProcessState.ExitCode()))
}

View File

@ -90,11 +90,13 @@ func GoToast(m *ice.Message, title string, cb func(toast func(string, int, int))
})
})
}
func PushStream(m *ice.Message) {
func PushStream(m *ice.Message, cmds ...ice.Any) *ice.Message {
m.Option(cli.CMD_OUTPUT, file.NewWriteCloser(func(buf []byte) (int, error) {
PushNoticeGrow(m, string(buf))
return len(buf), nil
}, func() error { PushNoticeToast(m, "done"); return nil }))
m.ProcessHold()
return m.Cmd(cmds...)
}
func PushPodCmd(m *ice.Message, cmd string, arg ...string) {
if m.Length() > 0 && len(m.Appendv(ice.POD)) == 0 {

View File

@ -236,9 +236,7 @@ func init() {
_status_each(m, PULL, cli.SYSTEM, GIT, PULL)
}},
MAKE: {Name: "make", Help: "编译", Hand: func(m *ice.Message, arg ...string) {
web.PushStream(m)
m.Cmdy(cli.SYSTEM, MAKE)
web.ToastSuccess(m)
web.PushStream(m, cli.SYSTEM, MAKE)
}},
PUSH: {Name: "push", Help: "上传", Hand: func(m *ice.Message, arg ...string) {
if m.Option(REPOS) == "" {
@ -324,7 +322,7 @@ func init() {
if len(arg) == 0 {
m.Action(PULL, MAKE, PUSH, TAGS, PIE, code.PUBLISH)
files, adds, dels, last := _status_list(m)
m.Status("files", files, "adds", adds, "dels", dels, "last", last.Format(ice.MOD_TIME))
m.Status("repos", m.Length(), "files", files, "adds", adds, "dels", dels, "last", last.Format(ice.MOD_TIME))
web.Toast3s(m, kit.Format("files: %d, adds: %d, dels: %d", files, adds, dels), ice.CONTEXTS)
return
}