forked from x/icebergs
add some
This commit is contained in:
parent
1f0f42db7d
commit
4e8b1cf68d
@ -288,6 +288,15 @@ func init() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func HostPort(m *ice.Message, host, port string, arg ...string) string {
|
||||||
|
if port == "443" {
|
||||||
|
return kit.Format("https://%s", host)
|
||||||
|
} else if port == "80" {
|
||||||
|
return kit.Format("http://%s", host)
|
||||||
|
} else {
|
||||||
|
return kit.Format("http://%s:%s", host, port)
|
||||||
|
}
|
||||||
|
}
|
||||||
func SpideGet(m *ice.Message, arg ...ice.Any) ice.Any {
|
func SpideGet(m *ice.Message, arg ...ice.Any) ice.Any {
|
||||||
return kit.UnMarshal(m.Cmdx(http.MethodGet, arg))
|
return kit.UnMarshal(m.Cmdx(http.MethodGet, arg))
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,8 @@ func init() {
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
TEMPLATE: {Hand: func(m *ice.Message, arg ...string) {
|
TEMPLATE: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Echo(nfs.Template(m, "demo.shy"), path.Base(path.Dir(path.Join(arg[2], arg[1]))))
|
m.Option(mdb.NAME, path.Base(path.Dir(path.Join(arg[2], arg[1]))))
|
||||||
|
m.Echo(nfs.Template(m, "demo.shy"))
|
||||||
}},
|
}},
|
||||||
COMPLETE: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy("web.wiki.word", COMPLETE, arg) }},
|
COMPLETE: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy("web.wiki.word", COMPLETE, arg) }},
|
||||||
}, PlugAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, PlugAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
9
type.go
9
type.go
@ -283,8 +283,8 @@ func (m *Message) Start(key string, arg ...string) *Message {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
func (m *Message) Travel(cb Any) *Message {
|
func (m *Message) Travel(cb Any) *Message {
|
||||||
target := m.target
|
target, cmd, key := m.target, m._cmd, m._key
|
||||||
defer func() { m.target = target }()
|
defer func() { m.target, m._cmd, m._key = target, cmd, key }()
|
||||||
list := []*Context{m.root.target}
|
list := []*Context{m.root.target}
|
||||||
for i := 0; i < len(list); i++ {
|
for i := 0; i < len(list); i++ {
|
||||||
switch cb := cb.(type) {
|
switch cb := cb.(type) {
|
||||||
@ -292,7 +292,10 @@ func (m *Message) Travel(cb Any) *Message {
|
|||||||
cb(list[i].context, list[i])
|
cb(list[i].context, list[i])
|
||||||
case func(*Context, *Context, string, *Command):
|
case func(*Context, *Context, string, *Command):
|
||||||
m.target = list[i]
|
m.target = list[i]
|
||||||
kit.For(kit.SortedKey(list[i].Commands), func(k string) { cb(list[i].context, list[i], k, list[i].Commands[k]) })
|
kit.For(kit.SortedKey(list[i].Commands), func(k string) {
|
||||||
|
m._cmd, m._key = list[i].Commands[k], k
|
||||||
|
cb(list[i].context, list[i], k, list[i].Commands[k])
|
||||||
|
})
|
||||||
case func(*Context, *Context, string, *Config):
|
case func(*Context, *Context, string, *Config):
|
||||||
m.target = list[i]
|
m.target = list[i]
|
||||||
kit.For(kit.SortedKey(list[i].Configs), func(k string) { cb(list[i].context, list[i], k, list[i].Configs[k]) })
|
kit.For(kit.SortedKey(list[i].Configs), func(k string) { cb(list[i].context, list[i], k, list[i].Configs[k]) })
|
||||||
|
Loading…
x
Reference in New Issue
Block a user