1
0
forked from x/icebergs
This commit is contained in:
shaoying 2020-01-03 21:18:24 +08:00
parent daee4f8811
commit 2f6d5932f9
4 changed files with 40 additions and 17 deletions

View File

@ -154,6 +154,7 @@ const ( // FAVOR
FAVOR_TMUX = "tmux.init"
FAVOR_RIVER = "river.init"
FAVOR_START = "favor.start"
FAVOR_MISS = "miss"
)
const ( // STORY
STORY_CATCH = "catch"

View File

@ -1,12 +1,12 @@
package code
import (
"github.com/shylinux/toolkits"
"github.com/shylinux/icebergs"
_ "github.com/shylinux/icebergs/base"
"github.com/shylinux/icebergs/base/web"
"github.com/shylinux/toolkits"
"io/ioutil"
"os"
"os/exec"
"path"
@ -175,6 +175,13 @@ var Index = &ice.Context{Name: "code", Help: "编程模块",
}
}},
"/zsh": {Name: "/zsh", Help: "命令行", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if f, _, e := m.R.FormFile("sub"); e == nil {
defer f.Close()
if b, e := ioutil.ReadAll(f); e == nil {
m.Option("sub", string(b))
}
}
m.Option("you", "")
m.Richs("login", nil, m.Option("sid"), func(key string, value map[string]interface{}) {
m.Option("you", value["you"])
@ -234,6 +241,13 @@ var Index = &ice.Context{Name: "code", Help: "编程模块",
}
}},
"/vim": {Name: "/vim", Help: "编辑器", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if f, _, e := m.R.FormFile("sub"); e == nil {
defer f.Close()
if b, e := ioutil.ReadAll(f); e == nil {
m.Option("sub", string(b))
}
}
m.Option("you", "")
m.Richs("login", nil, m.Option("sid"), func(key string, value map[string]interface{}) {
m.Option("you", value["you"])
@ -248,20 +262,20 @@ var Index = &ice.Context{Name: "code", Help: "编程模块",
m.Cmdy("login", "exit")
case "read", "write", "exec":
m.Cmd(ice.WEB_SPACE, m.Option("you"), ice.WEB_FAVOR, "vim.history", "vimrc", m.Option("cmd"), m.Option("arg"),
m.Cmd(ice.WEB_FAVOR, "vim.history", "vimrc", m.Option("cmd"), m.Option("arg"),
"sid", m.Option("sid"), "pwd", m.Option("pwd"))
case "tasklet":
m.Cmd(ice.WEB_SPACE, m.Option("you"), ice.APP_MISS, "add", m.Option("tab"), m.Option("note"), m.Option("arg"))
m.Cmd(ice.APP_MISS, m.Option("arg"), m.Option("sub"))
case "favor":
if m.Options("arg") {
m.Cmd(ice.WEB_SPACE, m.Option("you"), ice.WEB_FAVOR, m.Option("tab"), "vimrc", m.Option("note"), m.Option("arg"),
m.Cmd(ice.WEB_FAVOR, m.Option("tab"), "vimrc", m.Option("note"), m.Option("arg"),
"buf", m.Option("buf"), "line", m.Option("line"), "col", m.Option("col"),
)
break
}
m.Cmd(ice.WEB_SPACE, m.Option("you"), ice.WEB_FAVOR, m.Option("tab"), "extra", "buf line col").Table(func(index int, value map[string]string, head []string) {
m.Cmd(ice.WEB_FAVOR, m.Option("tab"), "extra", "buf line col").Table(func(index int, value map[string]string, head []string) {
switch value["type"] {
case ice.TYPE_VIMRC:
m.Echo("%v\n", m.Option("tab")).Echo("%v:%v:%v:(%v): %v\n",

View File

@ -32,12 +32,15 @@ var Index = &ice.Context{Name: "team", Help: "团队模块",
m.Cmd(ice.CTX_CONFIG, "save", "team.json", "web.team.miss")
}},
ice.APP_MISS: {Name: "miss", Help: "任务", Hand: func(m *ice.Message, c *ice.Context, key string, arg ...string) {
ice.APP_MISS: {Name: "miss", Help: "任务", Meta: kit.Dict(
"remote", "you",
), Hand: func(m *ice.Message, c *ice.Context, key string, arg ...string) {
hot := kit.Select(ice.FAVOR_MISS, m.Option("hot"))
if len(arg) > 1 {
switch arg[1] {
case "modify":
// 修改任务
m.Richs(ice.WEB_FAVOR, nil, m.Option("hot"), func(key string, value map[string]interface{}) {
m.Richs(ice.WEB_FAVOR, nil, hot, func(key string, value map[string]interface{}) {
m.Grows(ice.WEB_FAVOR, kit.Keys("hash", key), "id", arg[0], func(index int, value map[string]interface{}) {
m.Log(ice.LOG_MODIFY, "%s: %s->%s", arg[2], arg[4], arg[3])
kit.Value(value, arg[2], arg[3])
@ -49,7 +52,7 @@ var Index = &ice.Context{Name: "team", Help: "团队模块",
if len(arg) == 0 {
// 任务列表
m.Richs(ice.WEB_FAVOR, nil, m.Option("hot"), func(key string, value map[string]interface{}) {
m.Richs(ice.WEB_FAVOR, nil, hot, func(key string, value map[string]interface{}) {
m.Grows(ice.WEB_FAVOR, kit.Keys("hash", key), "", "", func(index int, value map[string]interface{}) {
m.Push(kit.Format(index), value, []string{"extra.begin_time", "extra.close_time", "extra.status", "id", "type", "name", "text"})
})
@ -58,7 +61,7 @@ var Index = &ice.Context{Name: "team", Help: "团队模块",
}
// 添加任务
m.Cmdy(ice.WEB_FAVOR, kit.Select("miss", m.Option("hot")), ice.TYPE_DRIVE, arg[0], arg[1],
m.Cmdy(ice.WEB_FAVOR, hot, ice.TYPE_DRIVE, arg[0], arg[1],
"begin_time", m.Time(), "close_time", m.Time(),
"status", kit.Select("准备中", arg, 3),
)
@ -113,11 +116,16 @@ var Index = &ice.Context{Name: "team", Help: "团队模块",
m.Push("year", 1000)
}},
"progress": {Name: "progress", Help: "进度", Meta: kit.Dict(
"remote", "you",
"display", "github.com/shylinux/icebergs/core/team/miss",
"detail", []string{"回退", "前进", "取消", "完成"},
), List: kit.List(
kit.MDB_INPUT, "text", "value", "",
kit.MDB_INPUT, "button", "value", "查看", "action", "auto",
), Hand: func(m *ice.Message, c *ice.Context, key string, arg ...string) {
hot := kit.Select(ice.FAVOR_MISS, m.Option("hot"))
if len(arg) > 0 {
m.Richs(ice.WEB_FAVOR, nil, m.Option("hot"), func(key string, value map[string]interface{}) {
m.Richs(ice.WEB_FAVOR, nil, hot, func(key string, value map[string]interface{}) {
m.Grows(ice.WEB_FAVOR, kit.Keys("hash", key), "id", arg[0], func(index int, value map[string]interface{}) {
switch value = value["extra"].(map[string]interface{}); arg[1] {
case "前进":
@ -149,7 +157,7 @@ var Index = &ice.Context{Name: "team", Help: "团队模块",
m.Confm(ice.APP_MISS, "meta.mis", func(index int, value string) {
m.Push(value, "")
})
m.Richs(ice.WEB_FAVOR, nil, m.Option("hot"), func(key string, value map[string]interface{}) {
m.Richs(ice.WEB_FAVOR, nil, hot, func(key string, value map[string]interface{}) {
m.Grows(ice.WEB_FAVOR, kit.Keys("hash", key), "", "", func(index int, value map[string]interface{}) {
m.Push(kit.Format(kit.Value(value, "extra.status")),
kit.Format(`<span title="%v" data-id="%v">%v</span>`,

View File

@ -18,7 +18,7 @@ var Index = &ice.Context{Name: "wiki", Help: "文档模块",
Configs: map[string]*ice.Config{
"note": {Name: "note", Help: "笔记", Value: kit.Data(
"temp", "var/tmp/file",
"path", "usr/local/wiki",
"path", "",
"head", "time size line path",
"alias", map[string]interface{}{
"block": []interface{}{"chart", "block"},
@ -161,10 +161,10 @@ var Index = &ice.Context{Name: "wiki", Help: "文档模块",
m.Cmdy("nfs.dir", m.Conf("note", "meta.path"),
kit.Select("", arg, 0), m.Conf("note", "meta.head"))
}},
"note": {Name: "note file", Help: "笔记", Meta: map[string]interface{}{
"remote": "you", "display": "inner",
"detail": []string{"add", "commit", "history", "share", "favor"},
}, List: kit.List(
"note": {Name: "note file", Help: "笔记", Meta: kit.Dict(
"remote", "you", "display", "inner",
"detail", []string{"add", "commit", "history", "share", "favor"},
), List: kit.List(
kit.MDB_INPUT, "text", "value", "miss.md", "name", "path",
kit.MDB_INPUT, "button", "value", "执行", "action", "auto",
kit.MDB_INPUT, "button", "value", "返回", "cb", "Last",