diff --git a/base/web/web.go b/base/web/web.go index c75aa47b..b951af66 100644 --- a/base/web/web.go +++ b/base/web/web.go @@ -896,7 +896,7 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", m.Push("favor", kit.Value(value, "meta.name")) m.Push("count", kit.Value(value, "meta.count")) }) - m.Sort("time", "time_r") + m.Sort("favor") return } diff --git a/core/code/auto.vim b/core/code/auto.vim index 2f57e90e..68e62887 100644 --- a/core/code/auto.vim +++ b/core/code/auto.vim @@ -83,7 +83,7 @@ endfun fun! ShyGrep(word) if !exists("g:grep_dir") | let g:grep_dir = "./" | endif let g:grep_dir = input("dir: ", g:grep_dir, "file") - execute "grep -rn --exclude tags --exclude '*.tags' " . a:word . " " . g:grep_dir + execute "grep -rn --exclude tags --exclude '*.tags' '\<" . a:word . "\>' " . g:grep_dir endfun fun! ShyTag(word) execute "tag " . a:word diff --git a/core/code/code.go b/core/code/code.go index 864af01b..2073ab62 100644 --- a/core/code/code.go +++ b/core/code/code.go @@ -49,6 +49,14 @@ var Index = &ice.Context{Name: "code", Help: "编程中心", m.Cmd(ice.CTX_CONFIG, "load", "code.json") m.Watch(ice.SYSTEM_INIT, "compile", "linux") m.Watch(ice.SYSTEM_INIT, "publish", "bin/ice.sh") + + if m.Richs(ice.WEB_FAVOR, nil, "auto.init", nil) == nil { + m.Cmd(ice.WEB_FAVOR, "auto.init", ice.TYPE_SHELL, "下载脚本", `curl -s "$ctx_dev/publish/auto.sh" -o auto.sh`) + m.Cmd(ice.WEB_FAVOR, "auto.init", ice.TYPE_SHELL, "加载脚本", `source auto.sh`) + } + if m.Richs(ice.WEB_FAVOR, nil, "ice.init", nil) == nil { + m.Cmd(ice.WEB_FAVOR, "ice.init", ice.TYPE_SHELL, "一键启动", `curl -s "$ctx_dev/publish/ice.sh" |sh`) + } }}, ice.ICE_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Cmd(ice.CTX_CONFIG, "save", "code.json", "web.code.login") @@ -71,6 +79,7 @@ var Index = &ice.Context{Name: "code", Help: "编程中心", m.Add("option", "cmd_env", "GOCACHE", os.Getenv("GOCACHE")) m.Add("option", "cmd_env", "GOARCH", arch, "GOOS", goos) m.Add("option", "cmd_env", "HOME", os.Getenv("HOME")) + m.Add("option", "cmd_env", "CGO_ENABLED", "0") m.Cmd("cli.system", "go", "build", "-o", file, main) // 编译记录 diff --git a/core/wiki/chart.go b/core/wiki/chart.go index 61378945..08de4114 100644 --- a/core/wiki/chart.go +++ b/core/wiki/chart.go @@ -273,3 +273,30 @@ func (b *Table) Draw(m *ice.Message, x, y int) Chart { } return b } + +func stack(m *ice.Message, name string, level int, data interface{}) { + l, ok := kit.Value(data, "list").([]interface{}) + style := []string{} + kit.Fetch(kit.Value(data, "meta"), func(key string, value string) { + switch key { + case "bg": + style = append(style, "background:"+value) + case "fg": + style = append(style, "color:"+value) + } + }) + if !ok || len(l) == 0 { + m.Echo(`
o %s
`, name, strings.Join(style, ";"), kit.Value(data, "meta.text")) + return + } + m.Echo(`
%s %s
`, + kit.Select("span", "fold", level > 2), name, strings.Join(style, ";"), kit.Select("v", ">", level > 2), kit.Value(data, "meta.text")) + + m.Echo("") +} diff --git a/core/wiki/template.go b/core/wiki/template.go index 7d167bd5..5802160b 100644 --- a/core/wiki/template.go +++ b/core/wiki/template.go @@ -8,7 +8,8 @@ data-type="{{.Option "type"}}" data-name="{{.Option "name"}}" data-text="{{.Opti var spark = `

{{.}}

` var shell = `
$ {{.Option "input"}} -{{.Option "output"}}
` +{{.Option "output"}} +` var order = `