1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-25 16:58:06 +08:00

add ssh.tool.option

This commit is contained in:
shaoying 2019-11-19 11:01:43 +08:00
parent de04fa3bee
commit 9a43ee0e40
3 changed files with 10 additions and 1 deletions

View File

@ -64,7 +64,7 @@ main() {
trap HUP hup
log "\nstarting..."
while true; do
date && ${ctx_bin} "$@" 2>${ctx_err} && break
date && ${ctx_bin} "$@" 2>>${ctx_err} && break
log "\n\nrestarting..." && sleep 1
done
}

View File

@ -147,6 +147,9 @@ func (m *Message) Detail(arg ...interface{}) string {
return m.Insert("detail", index, arg...)
}
func (m *Message) Option(key string, arg ...interface{}) string {
if m == nil {
return ""
}
if len(arg) > 0 {
m.Insert(key, 0, arg...)
if _, ok := m.Meta[key]; ok {

View File

@ -350,6 +350,12 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
msg.Option("river", arg[3])
msg.Option("storm", arg[1])
kit.Map(tool["inputs"], "", func(index int, value map[string]interface{}) {
if name := kit.Format(value["name"]); name != "" {
m.Log("info", "%v: %v", name, m.Option(name))
msg.Option(name, m.Option(name))
}
})
arg = arg[4:]
if len(prefix) > 0 && prefix[1] == "_" {