forked from x/icebergs
opt some
This commit is contained in:
parent
4ee5877e16
commit
e33557a3e2
@ -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 {
|
if m.Option(ice.MSG_PROMPT, m.Confv("prompt", "meta.PS1")); f.out == os.Stdout {
|
||||||
f.printf(m, "\033[0m")
|
f.printf(m, "\033[0m")
|
||||||
}
|
}
|
||||||
m.Cmd(ice.WEB_FAVOR, "cmd.history", "cmd", kit.Select("stdio", arg, 0), line)
|
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)
|
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: "终端模块",
|
var Index = &ice.Context{Name: "ssh", Help: "终端模块",
|
||||||
Caches: map[string]*ice.Cache{},
|
Caches: map[string]*ice.Cache{},
|
||||||
Configs: map[string]*ice.Config{
|
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(
|
"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"},
|
"PS1", []interface{}{"\033[33;44m", "count", "[", "time", "]", "\033[5m", "target", "\033[0m", "\033[44m", ">", "\033[0m ", "\033[?25h", "\033[32m"},
|
||||||
"PS2", []interface{}{"count", " ", "target", "> "},
|
"PS2", []interface{}{"count", " ", "target", "> "},
|
||||||
|
@ -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.Richs(ice.WEB_SPACE, nil, "*", func(key string, value map[string]interface{}) {
|
||||||
m.Push(key, value, []string{"time", "type", "name", "text"})
|
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")
|
m.Sort("name")
|
||||||
return
|
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.Richs(ice.WEB_SPACE, nil, arg[0], func(key string, value map[string]interface{}) {
|
||||||
m.Push("detail", value)
|
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
|
break
|
||||||
}
|
}
|
||||||
@ -1627,9 +1630,9 @@ var Index = &ice.Context{Name: "web", Help: "网络模块",
|
|||||||
), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
// 共享列表
|
// 共享列表
|
||||||
m.Grows(ice.WEB_SHARE, nil, "", "", func(key int, value map[string]interface{}) {
|
m.Grows(ice.WEB_SHARE, nil, "", "", func(index 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, []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.Push("value", fmt.Sprintf(m.Conf(ice.WEB_SHARE, "meta.template.link"), m.Conf(ice.WEB_SHARE, "meta.domain"), value["share"], value["share"]))
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
2
go.mod
2
go.mod
@ -5,6 +5,6 @@ go 1.13
|
|||||||
require (
|
require (
|
||||||
github.com/gomarkdown/markdown v0.0.0-20200127000047-1813ea067497
|
github.com/gomarkdown/markdown v0.0.0-20200127000047-1813ea067497
|
||||||
github.com/gorilla/websocket v1.4.1
|
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
|
github.com/skip2/go-qrcode v0.0.0-20191027152451-9434209cb086
|
||||||
)
|
)
|
||||||
|
@ -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)
|
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(
|
m.Rich("repos", nil, kit.Data(
|
||||||
"name", n, "path", p,
|
"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")),
|
"branch", strings.TrimSpace(m.Cmdx(ice.CLI_SYSTEM, "git", "branch")),
|
||||||
"remote", strings.TrimSpace(m.Cmdx(ice.CLI_SYSTEM, "git", "remote", "-v")),
|
"remote", strings.TrimSpace(m.Cmdx(ice.CLI_SYSTEM, "git", "remote", "-v")),
|
||||||
))
|
))
|
||||||
|
15
template.sh
15
template.sh
@ -8,10 +8,21 @@ local_shy="etc/local.shy"
|
|||||||
exit_shy="etc/exit.shy"
|
exit_shy="etc/exit.shy"
|
||||||
main_go="src/main.go"
|
main_go="src/main.go"
|
||||||
readme="README.md"
|
readme="README.md"
|
||||||
|
shy="hi.shy"
|
||||||
|
|
||||||
prepare() {
|
prepare() {
|
||||||
[ -f ${readme} ] || cat >> ${readme} <<END
|
[ -f ${shy} ] || cat >> ${shy} <<END
|
||||||
hello ice world
|
title "${ice_mod}"
|
||||||
|
|
||||||
|
field "自动化" favor
|
||||||
|
|
||||||
|
field "启动流程" favor args `[ 启动流程 ]`
|
||||||
|
field "请求响应" favor args `[ 请求响应 ]`
|
||||||
|
field "服务集群" favor args `[ 服务集群 ]`
|
||||||
|
|
||||||
|
field "数据结构" favor args `[ 数据结构 ]`
|
||||||
|
field "系统架构" favor args `[ 系统架构 ]`
|
||||||
|
field "编译原理" favor args `[ 编译原理 ]`
|
||||||
END
|
END
|
||||||
|
|
||||||
[ -d src ] || mkdir src
|
[ -d src ] || mkdir src
|
||||||
|
Loading…
x
Reference in New Issue
Block a user