From f0b3a573954b0268cf5fc9ee4cb35418be14d559 Mon Sep 17 00:00:00 2001 From: shylinux Date: Wed, 17 Nov 2021 10:48:37 +0800 Subject: [PATCH] add pie.go --- core/chat/header.go | 2 ++ core/code/vimer.go | 5 +++++ init.go | 2 +- misc.go | 4 ++++ misc/git/total.go | 14 +++++++++++++- 5 files changed, 25 insertions(+), 2 deletions(-) diff --git a/core/chat/header.go b/core/chat/header.go index 040cec5f..f49bbae2 100644 --- a/core/chat/header.go +++ b/core/chat/header.go @@ -86,6 +86,8 @@ func init() { }, Commands: map[string]*ice.Command{ web.WEB_LOGIN: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { switch arg[0] { + case "/pod/": + return // 免登录 case "/header": switch kit.Select("", arg, 1) { case AGENT, CHECK, aaa.LOGIN: diff --git a/core/code/vimer.go b/core/code/vimer.go index 9142d649..5089e6de 100644 --- a/core/code/vimer.go +++ b/core/code/vimer.go @@ -20,6 +20,11 @@ func init() { nfs.SAVE: {Name: "save type file path", Help: "保存", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(nfs.SAVE, path.Join(m.Option(kit.MDB_PATH), m.Option(kit.MDB_FILE))) }}, + ice.RUN: {Name: "run", Help: "运行", Hand: func(m *ice.Message, arg ...string) { + m.Cmdy(cli.SYSTEM, GO, ice.RUN, path.Join(kit.Slice(arg, 0, 2)...)) + m.Set(ice.MSG_APPEND) + m.ProcessInner() + }}, mdb.ENGINE: {Name: "engine", Help: "运行", Hand: func(m *ice.Message, arg ...string) { if m.Cmdy(mdb.ENGINE, arg); len(m.Resultv()) > 0 || m.Length() > 0 { return diff --git a/init.go b/init.go index 80901d3a..516ba568 100644 --- a/init.go +++ b/init.go @@ -118,7 +118,7 @@ func Run(arg ...string) string { if Pulse.Cmdy(arg); Pulse.Result() == "" { Pulse.Table() } - Pulse.Sleep("10ms") + Pulse.Sleep30ms() } return Pulse.Result() diff --git a/misc.go b/misc.go index af90c0b0..b113be88 100644 --- a/misc.go +++ b/misc.go @@ -78,6 +78,10 @@ func (m *Message) Split(str string, field string, sp string, nl string) *Message return m } +func (m *Message) Display(plugin string) *Message { + m.Option(MSG_DISPLAY, Display0(2, plugin)["display"]) + return m +} func (m *Message) FieldsIsDetail() bool { if m.OptionFields() == "detail" { return true diff --git a/misc/git/total.go b/misc/git/total.go index 685d7776..d00d0e7c 100644 --- a/misc/git/total.go +++ b/misc/git/total.go @@ -25,7 +25,19 @@ func init() { ), )}, }, Commands: map[string]*ice.Command{ - TOTAL: {Name: "total name auto", Help: "统计量", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + TOTAL: {Name: "total name auto pie", Help: "统计量", Action: map[string]*ice.Action{ + "pie": {Name: "pie", Help: "饼图", Hand: func(m *ice.Message, arg ...string) { + m.Cmd(TOTAL).Table(func(index int, value map[string]string, head []string) { + if value["name"] == "total" { + return + } + m.Push("name", value["name"]) + m.Push("value", value["rest"]) + }) + m.Display("/plugin/story/pie.js") + m.StatusTimeCount("name", "total", "value", "1") + }}, + }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { if len(arg) > 0 { // 提交详情 m.Cmd(REPOS, ice.OptionFields("name,path")).Table(func(index int, value map[string]string, head []string) { if value[kit.MDB_NAME] == arg[0] {