forked from x/icebergs
add ssh.target
This commit is contained in:
parent
2fd224205f
commit
25a84a9d1e
@ -59,6 +59,7 @@ func Render(msg *ice.Message, cmd string, args ...interface{}) {
|
|||||||
|
|
||||||
func (f *Frame) prompt(m *ice.Message) *Frame {
|
func (f *Frame) prompt(m *ice.Message) *Frame {
|
||||||
if f.out == os.Stdout {
|
if f.out == os.Stdout {
|
||||||
|
fmt.Fprintf(f.out, "\r")
|
||||||
for _, v := range kit.Simple(m.Optionv(ice.MSG_PROMPT)) {
|
for _, v := range kit.Simple(m.Optionv(ice.MSG_PROMPT)) {
|
||||||
switch v {
|
switch v {
|
||||||
case "count":
|
case "count":
|
||||||
@ -315,6 +316,13 @@ var Index = &ice.Context{Name: "ssh", Help: "终端模块",
|
|||||||
f := m.Target().Server().(*Frame)
|
f := m.Target().Server().(*Frame)
|
||||||
f.exit = true
|
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) {
|
"source": {Name: "source file", Help: "解析", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
buf := bytes.NewBuffer(make([]byte, 0, 4096))
|
buf := bytes.NewBuffer(make([]byte, 0, 4096))
|
||||||
m.Optionv(ice.MSG_STDOUT, buf)
|
m.Optionv(ice.MSG_STDOUT, buf)
|
||||||
|
@ -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.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"]))
|
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")
|
m.Sort("name")
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user