diff --git a/base/cli/cli.go b/base/cli/cli.go index 48e9f74b..c992a115 100644 --- a/base/cli/cli.go +++ b/base/cli/cli.go @@ -1,13 +1,12 @@ package cli import ( - "bytes" - ice "github.com/shylinux/icebergs" "github.com/shylinux/icebergs/base/ctx" "github.com/shylinux/icebergs/base/mdb" kit "github.com/shylinux/toolkits" + "bytes" "io/ioutil" "os" "os/user" @@ -95,6 +94,27 @@ var Index = &ice.Context{Name: "cli", Help: "命令模块", m.Save(RUNTIME, SYSTEM, DAEMON) }}, + "proc": {Name: "proc name=auto PID=auto auto", Help: "进程管理", Action: map[string]*ice.Action{ + "kill": {Name: "kill", Help: "结束", Hand: func(m *ice.Message, arg ...string) { + if p, e := os.FindProcess(kit.Int(m.Option("PID"))); m.Assert(e) { + m.Assert(p.Kill()) + } + }}, + }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + msg := m.Spawn() + msg.Split(m.Cmdx(SYSTEM, "ps", "aux"), "", " ", "\n") + msg.Table(func(index int, value map[string]string, head []string) { + if m.Appendv(ice.MSG_APPEND, "action", head); len(arg) == 2 && value["PID"] == arg[1] { + m.Push("action", m.Cmdx(mdb.RENDER, "button", "结束")) + m.Push("", value) + return + } + if len(arg) == 0 || len(arg) == 1 && strings.Contains(value["COMMAND"], arg[0]) { + m.Push("action", m.Cmdx(mdb.RENDER, "button", "结束")) + m.Push("", value) + } + }) + }}, RUNTIME: {Name: "runtime name auto", Help: "运行环境", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { switch kit.Select("", arg, 0) { case "procinfo": diff --git a/core/chat/header.go b/core/chat/header.go index 594642d8..caca3805 100644 --- a/core/chat/header.go +++ b/core/chat/header.go @@ -58,6 +58,7 @@ func init() { f.WriteString(`Volcanos.meta.pack = ` + kit.Formats(kit.UnMarshal(m.Option("content")))) } + m.Option(nfs.DIR_ROOT, "") if f, p, e := kit.Create("usr/publish/webpack/" + m.Option("name") + ".html"); m.Assert(e) { f.WriteString(fmt.Sprintf(_pack, m.Cmdx(nfs.CAT, "usr/volcanos/cache.css"), diff --git a/core/code/c.go b/core/code/c.go index 545288b2..5a459828 100644 --- a/core/code/c.go +++ b/core/code/c.go @@ -78,6 +78,7 @@ func _c_help(m *ice.Message, section, key string) string { return string(res) } +const CC = "cc" const C = "c" const H = "h" const MAN1 = "man1" @@ -96,6 +97,10 @@ func init() { Index.Register(&ice.Context{Name: C, Help: "c", Commands: map[string]*ice.Command{ ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + m.Cmd(mdb.SEARCH, mdb.CREATE, CC, C, c.Cap(ice.CTX_FOLLOW)) + m.Cmd(mdb.PLUGIN, mdb.CREATE, CC, C, c.Cap(ice.CTX_FOLLOW)) + m.Cmd(mdb.RENDER, mdb.CREATE, CC, C, c.Cap(ice.CTX_FOLLOW)) + m.Cmd(mdb.SEARCH, mdb.CREATE, C, C, c.Cap(ice.CTX_FOLLOW)) m.Cmd(mdb.PLUGIN, mdb.CREATE, C, C, c.Cap(ice.CTX_FOLLOW)) m.Cmd(mdb.RENDER, mdb.CREATE, C, C, c.Cap(ice.CTX_FOLLOW)) diff --git a/core/code/install.go b/core/code/install.go index 537a071b..ccb57cf9 100644 --- a/core/code/install.go +++ b/core/code/install.go @@ -40,8 +40,11 @@ func init() { m.Cmd(mdb.INSERT, m.Prefix(INSTALL), "", mdb.HASH, kit.MDB_NAME, name, kit.MDB_LINK, arg[0]) m.Richs(INSTALL, "", name, func(key string, value map[string]interface{}) { m.Optionv("progress", func(size int, total int) { - value["progress"], value["size"], value["total"] = size*100/total, size, total - m.Log_IMPORT(kit.MDB_FILE, name, "per", size*100/total, kit.MDB_SIZE, kit.FmtSize(int64(size)), "total", kit.FmtSize(int64(total))) + p := size * 100 / total + if p != kit.Int(value["progress"]) && p%10 == 0 { + m.Log_IMPORT(kit.MDB_FILE, name, "per", size*100/total, kit.MDB_SIZE, kit.FmtSize(int64(size)), "total", kit.FmtSize(int64(total))) + } + value["progress"], value["size"], value["total"] = p, size, total }) }) diff --git a/misc/git/git.go b/misc/git/git.go index b98b6180..f53abe7e 100644 --- a/misc/git/git.go +++ b/misc/git/git.go @@ -179,13 +179,10 @@ var Index = &ice.Context{Name: GIT, Help: "代码库", del = dels[0] // } else if adds[1] == "insertions(+)" { } else if strings.Contains(adds[1], "insertion") { - m.Debug("what %v", fs) add = adds[0] } else { - m.Debug("what %v", adds[1]) del = adds[0] } - m.Debug("what %v", fs) } if total {