1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-06-27 02:17:31 +08:00

opt nfs.git.sum

This commit is contained in:
shaoying 2019-07-15 09:26:24 +08:00
parent 13520059c7
commit 685988f310
4 changed files with 26 additions and 5 deletions

View File

@ -4,5 +4,5 @@ var version = struct {
host string host string
self int self int
}{ }{
"2019-07-15 02:05:42", "com.mac", 169, "2019-07-15 09:24:05", "com.mac", 179,
} }

View File

@ -1318,12 +1318,18 @@ var Index = &ctx.Context{Name: "nfs", Help: "存储中心",
return return
}}, }},
"git": &ctx.Command{Name: "git sum", Help: "版本控制", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) { "git": &ctx.Command{Name: "git sum", Help: "版本控制", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) {
if len(arg) > 0 && arg[0] == "sum" { if len(arg) > 0 && arg[0] == "sum" || len(arg) > 1 && arg[1] == "sum" {
if out, e := exec.Command("git", "log", "--reverse", "--shortstat", "--pretty=commit: %ad", "--date=format:%Y-%m-%d").CombinedOutput(); m.Assert(e) { args := []string{"log"}
if len(arg) > 1 && arg[1] == "sum" && arg[0] != "" {
args = append(args, "-C", arg[0])
}
args = append(args, "--reverse", "--shortstat", "--pretty=commit: %ad", "--date=format:%Y-%m-%d %H:%M")
if out, e := exec.Command("git", args...).CombinedOutput(); m.Assert(e) {
for _, v := range strings.Split(string(out), "commit: ") { for _, v := range strings.Split(string(out), "commit: ") {
if l := strings.Split(v, "\n"); len(l) > 2 { if l := strings.Split(v, "\n"); len(l) > 2 {
fs := strings.Split(strings.TrimSpace(l[2]), ", ") fs := strings.Split(strings.TrimSpace(l[2]), ", ")
m.Add("append", "date", l[0]) hs := strings.Split(l[0], " ")
m.Add("append", "date", hs[0])
if adds := strings.Split(fs[1], " "); len(fs) > 2 { if adds := strings.Split(fs[1], " "); len(fs) > 2 {
dels := strings.Split(fs[2], " ") dels := strings.Split(fs[2], " ")
@ -1336,6 +1342,13 @@ var Index = &ctx.Context{Name: "nfs", Help: "存储中心",
m.Add("append", "adds", "0") m.Add("append", "adds", "0")
m.Add("append", "dels", adds[0]) m.Add("append", "dels", adds[0])
} }
m.Add("append", "time", hs[1])
} else if len(l[0]) > 0 {
hs := strings.Split(l[0], " ")
m.Add("append", "date", hs[0])
m.Add("append", "adds", 0)
m.Add("append", "dels", 0)
m.Add("append", "time", hs[1])
} }
} }
m.Table() m.Table()

View File

@ -309,7 +309,7 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
"componet_args": []interface{}{}, "inputs": []interface{}{ "componet_args": []interface{}{}, "inputs": []interface{}{
map[string]interface{}{"type": "text", "name": "dir", "view": "long"}, map[string]interface{}{"type": "text", "name": "dir", "view": "long"},
map[string]interface{}{"type": "select", "name": "cmd", "values": []interface{}{ map[string]interface{}{"type": "select", "name": "cmd", "values": []interface{}{
"branch", "status", "diff", "log", "push", "update", "branch", "status", "diff", "log", "sum", "push", "update",
}}, }},
map[string]interface{}{"type": "button", "value": "执行"}, map[string]interface{}{"type": "button", "value": "执行"},
}, },

View File

@ -1140,6 +1140,14 @@ function Canvas(plugin, output, width, height, space, msg) {
data["end"].push(end) data["end"].push(end)
sum = end sum = end
} }
msg.append.push("sum")
msg.sum = data.sum
msg.append.push("max")
msg.max = data.max
msg.append.push("min")
msg.min = data.min
msg.append.push("end")
msg.end = data.end
} }
for (var i = 0; i < nrow; i++) { for (var i = 0; i < nrow; i++) {