1
0
forked from x/icebergs
This commit is contained in:
shaoying 2020-03-25 15:23:53 +08:00
parent 4ee5877e16
commit e33557a3e2
5 changed files with 25 additions and 9 deletions

View File

@ -249,7 +249,9 @@ func (f *Frame) Start(m *ice.Message, arg ...string) bool {
if m.Option(ice.MSG_PROMPT, m.Confv("prompt", "meta.PS1")); f.out == os.Stdout {
f.printf(m, "\033[0m")
}
if m.Cap(ice.CTX_STREAM) == "stdio" {
m.Cmd(ice.WEB_FAVOR, "cmd.history", "cmd", kit.Select("stdio", arg, 0), line)
}
// 解析命令
f.parse(m, line)
@ -265,7 +267,7 @@ func (f *Frame) Close(m *ice.Message, arg ...string) bool {
var Index = &ice.Context{Name: "ssh", Help: "终端模块",
Caches: map[string]*ice.Cache{},
Configs: map[string]*ice.Config{
"history": {Name: "history", Help: "history", Value: kit.Data()},
"history": {Name: "history", Help: "history", Value: kit.Data("limit", "200", "least", "100")},
"prompt": {Name: "prompt", Help: "prompt", Value: kit.Data(
"PS1", []interface{}{"\033[33;44m", "count", "[", "time", "]", "\033[5m", "target", "\033[0m", "\033[44m", ">", "\033[0m ", "\033[?25h", "\033[32m"},
"PS2", []interface{}{"count", " ", "target", "> "},

View File

@ -770,6 +770,7 @@ var Index = &ice.Context{Name: "web", Help: "网络模块",
// 空间列表
m.Richs(ice.WEB_SPACE, nil, "*", func(key string, value map[string]interface{}) {
m.Push(key, value, []string{"time", "type", "name", "text"})
m.Push("link", fmt.Sprintf(`<a target="_blank" href="%s?pod=%s">%s</a>`, m.Conf(ice.WEB_SHARE, "meta.domain"), value["name"], value["name"]))
})
m.Sort("name")
return
@ -829,6 +830,8 @@ var Index = &ice.Context{Name: "web", Help: "网络模块",
// 空间详情
m.Richs(ice.WEB_SPACE, nil, arg[0], func(key string, value map[string]interface{}) {
m.Push("detail", value)
m.Push("key", "link")
m.Push("value", fmt.Sprintf(`<a target="_blank" href="%s?pod=%s">%s</a>`, m.Conf(ice.WEB_SHARE, "meta.domain"), value["name"], value["name"]))
})
break
}
@ -1627,9 +1630,9 @@ var Index = &ice.Context{Name: "web", Help: "网络模块",
), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if len(arg) == 0 {
// 共享列表
m.Grows(ice.WEB_SHARE, nil, "", "", func(key int, value map[string]interface{}) {
m.Push(kit.Format(key), value, []string{kit.MDB_TIME, "share", kit.MDB_TYPE, kit.MDB_NAME, kit.MDB_TEXT})
m.Push("value", fmt.Sprintf(m.Conf(ice.WEB_SHARE, "meta.template.link"), value["share"], value["share"]))
m.Grows(ice.WEB_SHARE, nil, "", "", func(index int, value map[string]interface{}) {
m.Push("", value, []string{kit.MDB_TIME, "share", kit.MDB_TYPE, kit.MDB_NAME, kit.MDB_TEXT})
m.Push("value", fmt.Sprintf(m.Conf(ice.WEB_SHARE, "meta.template.link"), m.Conf(ice.WEB_SHARE, "meta.domain"), value["share"], value["share"]))
})
return
}

2
go.mod
View File

@ -5,6 +5,6 @@ go 1.13
require (
github.com/gomarkdown/markdown v0.0.0-20200127000047-1813ea067497
github.com/gorilla/websocket v1.4.1
github.com/shylinux/toolkits v0.1.3
github.com/shylinux/toolkits v0.1.4
github.com/skip2/go-qrcode v0.0.0-20191027152451-9434209cb086
)

View File

@ -16,7 +16,7 @@ func add(m *ice.Message, n string, p string) {
ls := strings.SplitN(strings.Trim(m.Cmdx(ice.CLI_SYSTEM, "git", "log", "-n1", `--pretty=format:"%ad %s"`, "--date=iso"), "\""), " ", 4)
m.Rich("repos", nil, kit.Data(
"name", n, "path", p,
"last", ls[3], "time", strings.Join(ls[:2], " "),
"last", kit.Select("", ls, 3), "time", strings.Join(ls[:2], " "),
"branch", strings.TrimSpace(m.Cmdx(ice.CLI_SYSTEM, "git", "branch")),
"remote", strings.TrimSpace(m.Cmdx(ice.CLI_SYSTEM, "git", "remote", "-v")),
))

View File

@ -8,10 +8,21 @@ local_shy="etc/local.shy"
exit_shy="etc/exit.shy"
main_go="src/main.go"
readme="README.md"
shy="hi.shy"
prepare() {
[ -f ${readme} ] || cat >> ${readme} <<END
hello ice world
[ -f ${shy} ] || cat >> ${shy} <<END
title "${ice_mod}"
field "自动化" favor
field "启动流程" favor args `[ 启动流程 ]`
field "请求响应" favor args `[ 请求响应 ]`
field "服务集群" favor args `[ 服务集群 ]`
field "数据结构" favor args `[ 数据结构 ]`
field "系统架构" favor args `[ 系统架构 ]`
field "编译原理" favor args `[ 编译原理 ]`
END
[ -d src ] || mkdir src