forked from x/ContextOS
add ssh.tool.option
This commit is contained in:
parent
de04fa3bee
commit
9a43ee0e40
@ -64,7 +64,7 @@ main() {
|
|||||||
trap HUP hup
|
trap HUP hup
|
||||||
log "\nstarting..."
|
log "\nstarting..."
|
||||||
while true; do
|
while true; do
|
||||||
date && ${ctx_bin} "$@" 2>${ctx_err} && break
|
date && ${ctx_bin} "$@" 2>>${ctx_err} && break
|
||||||
log "\n\nrestarting..." && sleep 1
|
log "\n\nrestarting..." && sleep 1
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
@ -147,6 +147,9 @@ func (m *Message) Detail(arg ...interface{}) string {
|
|||||||
return m.Insert("detail", index, arg...)
|
return m.Insert("detail", index, arg...)
|
||||||
}
|
}
|
||||||
func (m *Message) Option(key string, arg ...interface{}) string {
|
func (m *Message) Option(key string, arg ...interface{}) string {
|
||||||
|
if m == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
if len(arg) > 0 {
|
if len(arg) > 0 {
|
||||||
m.Insert(key, 0, arg...)
|
m.Insert(key, 0, arg...)
|
||||||
if _, ok := m.Meta[key]; ok {
|
if _, ok := m.Meta[key]; ok {
|
||||||
|
@ -350,6 +350,12 @@ var Index = &ctx.Context{Name: "ssh", Help: "集群中心",
|
|||||||
|
|
||||||
msg.Option("river", arg[3])
|
msg.Option("river", arg[3])
|
||||||
msg.Option("storm", arg[1])
|
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:]
|
arg = arg[4:]
|
||||||
if len(prefix) > 0 && prefix[1] == "_" {
|
if len(prefix) > 0 && prefix[1] == "_" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user