forked from x/icebergs
opt some
This commit is contained in:
parent
46cee7a64e
commit
169888c834
@ -65,8 +65,7 @@ const (
|
||||
const INNER = "inner"
|
||||
|
||||
func init() {
|
||||
Index.Merge(&ice.Context{
|
||||
Commands: map[string]*ice.Command{
|
||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
||||
INNER: {Name: "inner path=src/ file=main.go line=1 auto", Help: "源代码", Meta: kit.Dict(
|
||||
ice.Display("/plugin/local/code/inner.js", "editor"),
|
||||
), Action: map[string]*ice.Action{
|
||||
@ -98,8 +97,7 @@ func init() {
|
||||
}
|
||||
_inner_list(m, kit.Ext(arg[1]), arg[1], arg[0])
|
||||
}},
|
||||
},
|
||||
Configs: map[string]*ice.Config{
|
||||
}, Configs: map[string]*ice.Config{
|
||||
INNER: {Name: "inner", Help: "源代码", Value: kit.Data(
|
||||
cli.SOURCE, kit.Dict(
|
||||
"s", ice.TRUE, "S", ice.TRUE,
|
||||
|
@ -16,13 +16,19 @@ func _spark_show(m *ice.Message, name, text string, arg ...string) {
|
||||
|
||||
prompt := kit.Select(name+"> ", m.Conf(SPARK, kit.Keym(ssh.PROMPT, name)))
|
||||
m.Echo(`<div class="story" data-type="spark" data-name="%s">`, name)
|
||||
defer m.Echo("</div>")
|
||||
|
||||
if name == "inner" {
|
||||
m.Echo(text)
|
||||
return
|
||||
}
|
||||
|
||||
for _, l := range strings.Split(text, "\n") {
|
||||
m.Echo("<div>")
|
||||
m.Echo("<label>").Echo(prompt).Echo("</label>")
|
||||
m.Echo("<span>").Echo(l).Echo("</span>")
|
||||
m.Echo("</div>")
|
||||
}
|
||||
m.Echo("</div>")
|
||||
}
|
||||
|
||||
const (
|
||||
|
@ -2,6 +2,7 @@ package ice
|
||||
|
||||
import (
|
||||
"path"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
kit "shylinux.com/x/toolkits"
|
||||
@ -75,6 +76,12 @@ func (m *Message) PushVideos(key, src string, arg ...string) { // key src [size]
|
||||
m.Push(key, Render(m, RENDER_VIDEOS, src, arg))
|
||||
}
|
||||
func (m *Message) PushAction(list ...interface{}) {
|
||||
for i, item := range list {
|
||||
if t := reflect.TypeOf(item); t.Kind() == reflect.Func {
|
||||
list[i] = kit.FuncName(item)
|
||||
}
|
||||
}
|
||||
|
||||
m.Table(func(index int, value map[string]string, head []string) {
|
||||
m.PushButton(kit.Simple(list...)...)
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user