1
0
forked from x/icebergs

add ssh.target

This commit is contained in:
shaoying 2020-03-31 11:35:13 +08:00
parent 2fd224205f
commit 25a84a9d1e
2 changed files with 11 additions and 1 deletions

View File

@ -59,6 +59,7 @@ func Render(msg *ice.Message, cmd string, args ...interface{}) {
func (f *Frame) prompt(m *ice.Message) *Frame {
if f.out == os.Stdout {
fmt.Fprintf(f.out, "\r")
for _, v := range kit.Simple(m.Optionv(ice.MSG_PROMPT)) {
switch v {
case "count":
@ -315,6 +316,13 @@ var Index = &ice.Context{Name: "ssh", Help: "终端模块",
f := m.Target().Server().(*Frame)
f.exit = true
}},
"target": {Name: "target", Help: "目标", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
f := m.Target().Server().(*Frame)
m.Search(arg[0], func(p *ice.Context, s *ice.Context, key string) {
f.target = s
})
f.prompt(m)
}},
"source": {Name: "source file", Help: "解析", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
buf := bytes.NewBuffer(make([]byte, 0, 4096))
m.Optionv(ice.MSG_STDOUT, buf)

View File

@ -775,7 +775,9 @@ 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"})
if m.W != nil {
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