1
0
forked from x/icebergs

opt git.status

This commit is contained in:
shylinux 2020-02-19 12:37:56 +08:00
parent 42dd8221de
commit 1ba034d9e3
3 changed files with 26 additions and 9 deletions

View File

@ -1446,6 +1446,8 @@ var Index = &ice.Context{Name: "web", Help: "网络模块",
if len(arg) == 1 { if len(arg) == 1 {
m.Richs(ice.WEB_SHARE, nil, arg[0], func(key string, value map[string]interface{}) { m.Richs(ice.WEB_SHARE, nil, arg[0], func(key string, value map[string]interface{}) {
m.Push("detail", value) m.Push("detail", value)
m.Push("key", "qrcode")
m.Push("value", kit.Format(`<img src="/share/%s/qrcode">`, key))
}) })
return return
} }
@ -1493,6 +1495,13 @@ var Index = &ice.Context{Name: "web", Help: "网络模块",
default: default:
m.Richs(ice.WEB_SHARE, nil, arg[0], func(key string, value map[string]interface{}) { m.Richs(ice.WEB_SHARE, nil, arg[0], func(key string, value map[string]interface{}) {
switch kit.Select("", arg, 1) {
case "qrcode":
m.Push("_output", "qrcode")
m.Echo("%s/%s/", m.Conf(ice.WEB_SHARE, "meta.domain"), key)
return
}
m.Info("share %s %v", arg, kit.Format(value)) m.Info("share %s %v", arg, kit.Format(value))
switch value["type"] { switch value["type"] {
case ice.TYPE_STORY: case ice.TYPE_STORY:
@ -1533,6 +1542,7 @@ var Index = &ice.Context{Name: "web", Help: "网络模块",
} }
if len(arg) == 2 { if len(arg) == 2 {
value["count"] = kit.Int(value["count"]) + 1
kit.Fetch(kit.Value(value, "extra.tool"), func(index int, value map[string]interface{}) { kit.Fetch(kit.Value(value, "extra.tool"), func(index int, value map[string]interface{}) {
m.Push("river", arg[0]) m.Push("river", arg[0])
m.Push("storm", arg[1]) m.Push("storm", arg[1])

View File

@ -290,7 +290,7 @@ var Index = &ice.Context{Name: "team", Help: "团队中心",
case "week": case "week":
// 周计划 // 周计划
first = first.Add(-time.Duration((first.Hour()*int(time.Hour) + first.Minute()*int(time.Minute) + first.Second()*int(time.Second)))) first = first.Add(-time.Duration((int64(first.Hour())*int64(time.Hour) + int64(first.Minute())*int64(time.Minute) + int64(first.Second())*int64(time.Second))))
one := first.AddDate(0, 0, -int(first.Weekday())) one := first.AddDate(0, 0, -int(first.Weekday()))
end := first.AddDate(0, 0, 7-int(first.Weekday())) end := first.AddDate(0, 0, 7-int(first.Weekday()))

View File

@ -81,16 +81,23 @@ var Index = &ice.Context{Name: "git", Help: "代码管理",
}) })
m.Sort("repos") m.Sort("repos")
}}, }},
"status": {Name: "status", Help: "状态", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { "status": {Name: "status name", Help: "状态", List: kit.List(
prefix := []string{ice.CLI_SYSTEM, "git", "status"} kit.MDB_INPUT, "text", "name", "repos", "action", "auto",
kit.MDB_INPUT, "button", "name", "查看", "action", "auto",
kit.MDB_INPUT, "button", "name", "返回", "cb", "Last", "action", "auto",
), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
prefix := []string{ice.CLI_SYSTEM, "git"}
m.Richs("repos", nil, kit.Select("*", arg, 0), func(key string, value map[string]interface{}) { m.Richs("repos", nil, kit.Select("*", arg, 0), func(key string, value map[string]interface{}) {
m.Option("cmd_dir", kit.Value(value, "meta.path")) if m.Option("cmd_dir", kit.Value(value, "meta.path")); len(arg) > 0 {
for _, v := range strings.Split(strings.TrimSpace(m.Cmdx(prefix, "-sb")), "\n") { m.Echo(m.Cmdx(prefix, "diff"))
} else {
for _, v := range strings.Split(strings.TrimSpace(m.Cmdx(prefix, "status", "-sb")), "\n") {
vs := strings.SplitN(strings.TrimSpace(v), " ", 2) vs := strings.SplitN(strings.TrimSpace(v), " ", 2)
m.Push("repos", kit.Value(value, "meta.name")) m.Push("repos", kit.Value(value, "meta.name"))
m.Push("tags", vs[0]) m.Push("tags", vs[0])
m.Push("file", vs[1]) m.Push("file", vs[1])
} }
}
}) })
}}, }},
"total": {Name: "total", Help: "统计", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { "total": {Name: "total", Help: "统计", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {