From 8739c8fa6f578065d77d212db0dd0058b851d109 Mon Sep 17 00:00:00 2001 From: shaoying Date: Sat, 30 Jan 2021 23:13:11 +0800 Subject: [PATCH] opt code --- base/ssh/scripts.go | 2 +- core/code/autogen.go | 1 + core/code/code.shy | 10 +++++----- core/code/compile.go | 2 +- core/code/csdn.go | 8 ++++---- core/code/github.go | 6 +++--- core/code/install.go | 2 +- core/code/upgrade.go | 5 ++--- core/wiki/feel.go | 1 - core/wiki/wiki.go | 7 +++---- core/wiki/wiki.shy | 16 ++++++++++++++++ 11 files changed, 37 insertions(+), 23 deletions(-) diff --git a/base/ssh/scripts.go b/base/ssh/scripts.go index f4f0d628..ad235832 100644 --- a/base/ssh/scripts.go +++ b/base/ssh/scripts.go @@ -314,7 +314,7 @@ func (f *Frame) Start(m *ice.Message, arg ...string) bool { } if f.count = 1; f.source == STDIO { - m.Option("_disable_log", "true") + // m.Option("_disable_log", "true") f.count = kit.Int(m.Conf(SOURCE, "hash.stdio.meta.count")) + 1 f.scan(m, STDIO, "", r) } else { diff --git a/core/code/autogen.go b/core/code/autogen.go index eba736a0..e8c49921 100644 --- a/core/code/autogen.go +++ b/core/code/autogen.go @@ -83,6 +83,7 @@ func init() { _autogen_main(m, m.Option("main"), _autogen_mod(m, "go.mod"), m.Option("name")) } m.Cmdy(cli.SYSTEM, "make") + m.Option(ice.MSG_PROCESS, ice.PROCESS_INNER) }}, mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) { switch arg[0] { diff --git a/core/code/code.shy b/core/code/code.shy index 5339f73e..6deee6f6 100644 --- a/core/code/code.shy +++ b/core/code/code.shy @@ -34,14 +34,14 @@ shy.go go.go js.go -install.go +autogen.go compile.go -binpack.go -webpack.go - publish.go upgrade.go -autogen.go + +webpack.go +binpack.go +install.go code.go code.shy diff --git a/core/code/compile.go b/core/code/compile.go index a071d23d..dfa00ebd 100644 --- a/core/code/compile.go +++ b/core/code/compile.go @@ -56,7 +56,7 @@ func init() { // 编译参数 m.Optionv(cli.CMD_ENV, kit.Simple(m.Confv(COMPILE, "meta.env"), "GOARCH", arch, "GOOS", goos)) - if msg := m.Cmd(cli.SYSTEM, m.Confv(COMPILE, "meta.go"), "-o", file, main); msg.Append(cli.CMD_CODE) != "0" { + if msg := m.Cmd(cli.SYSTEM, m.Confv(COMPILE, "meta.go"), "-o", file, main, "src/version.go"); msg.Append(cli.CMD_CODE) != "0" { m.Copy(msg) return } diff --git a/core/code/csdn.go b/core/code/csdn.go index 7787f185..3c1b8746 100644 --- a/core/code/csdn.go +++ b/core/code/csdn.go @@ -9,7 +9,7 @@ import ( func _csdn_show(m *ice.Message, name, text string, arg ...string) { } func _csdn_search(m *ice.Message, kind, name, text string) { - if kit.Contains(kind, "*") || kit.Contains(kind, "csdn") { + if kit.Contains(kind, kit.MDB_FOREACH) || kit.Contains(kind, CSDN) { m.PushSearchWeb(CSDN, name) } } @@ -22,12 +22,12 @@ func init() { CSDN: {Name: "csdn", Help: "博客", Value: kit.Data(kit.MDB_SHORT, kit.MDB_TEXT)}, }, Commands: map[string]*ice.Command{ CSDN: {Name: "csdn [name] word", Help: "博客", Action: map[string]*ice.Action{ - mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) { - _csdn_search(m, arg[0], arg[1], arg[2]) - }}, mdb.CREATE: {Name: "create type name text", Help: "创建", Hand: func(m *ice.Message, arg ...string) { m.Cmd(mdb.INSERT, m.Prefix(CSDN), "", mdb.HASH, arg) }}, + mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) { + _csdn_search(m, arg[0], arg[1], arg[2]) + }}, }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { _csdn_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...) }}, diff --git a/core/code/github.go b/core/code/github.go index 92cf0594..3c119283 100644 --- a/core/code/github.go +++ b/core/code/github.go @@ -23,12 +23,12 @@ func init() { }, Commands: map[string]*ice.Command{ GITHUB: {Name: "github [name] word", Help: "百度", Action: map[string]*ice.Action{ - mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) { - _github_search(m, arg[0], arg[1], arg[2]) - }}, mdb.CREATE: {Name: "create type name text", Help: "创建", Hand: func(m *ice.Message, arg ...string) { m.Cmd(mdb.INSERT, m.Prefix(GITHUB), "", mdb.HASH, arg) }}, + mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) { + _github_search(m, arg[0], arg[1], arg[2]) + }}, }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { _github_show(m, arg[0], kit.Select(arg[0], arg[1]), arg[2:]...) }}, diff --git a/core/code/install.go b/core/code/install.go index d3704941..4609e18c 100644 --- a/core/code/install.go +++ b/core/code/install.go @@ -28,7 +28,7 @@ func init() { )}, }, Commands: map[string]*ice.Command{ - INSTALL: {Name: "install name port path auto", Help: "安装", Meta: kit.Dict(), Action: map[string]*ice.Action{ + INSTALL: {Name: "install name port path auto download", Help: "安装", Meta: kit.Dict(), Action: map[string]*ice.Action{ web.DOWNLOAD: {Name: "download link", Help: "下载", Hand: func(m *ice.Message, arg ...string) { link := m.Option(kit.MDB_LINK) name := path.Base(link) diff --git a/core/code/upgrade.go b/core/code/upgrade.go index f99ad116..4cd3e556 100644 --- a/core/code/upgrade.go +++ b/core/code/upgrade.go @@ -23,12 +23,11 @@ func init() { }, Commands: map[string]*ice.Command{ UPGRADE: {Name: "upgrade item:select=system 执行:button", Help: "升级", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { - exit := false m.Grows(cmd, kit.Keys(kit.MDB_HASH, kit.Select("system", arg, 0)), "", "", func(index int, value map[string]interface{}) { + m.Option("exit", "true") if value[kit.MDB_FILE] == "ice.bin" { // 程序文件 value[kit.MDB_FILE] = kit.Keys("ice", m.Conf(cli.RUNTIME, "host.GOOS"), m.Conf(cli.RUNTIME, "host.GOARCH")) - exit = true } // 下载文件 @@ -36,7 +35,7 @@ func init() { m.Cmd(web.STORY, web.WATCH, msg.Append(kit.MDB_FILE), value[kit.MDB_PATH]) os.Chmod(kit.Format(value[kit.MDB_PATH]), 0770) }) - if exit { + if m.Option("exit") == "true" { m.Sleep("1s").Go(func() { m.Cmd("exit", 1) }) } }}, diff --git a/core/wiki/feel.go b/core/wiki/feel.go index bebe461e..a82ba03e 100644 --- a/core/wiki/feel.go +++ b/core/wiki/feel.go @@ -24,7 +24,6 @@ func init() { }}, }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { _wiki_list(m, FEEL, kit.Select("./", arg, 0)) - m.Option(ice.MSG_DISPLAY, "") m.SortTimeR(kit.MDB_TIME) }}, }, diff --git a/core/wiki/wiki.go b/core/wiki/wiki.go index 684525af..258c3e3f 100644 --- a/core/wiki/wiki.go +++ b/core/wiki/wiki.go @@ -18,17 +18,16 @@ func _wiki_path(m *ice.Message, cmd string, arg ...string) string { func _wiki_list(m *ice.Message, cmd string, arg ...string) bool { m.Option("prefix", m.Option(nfs.DIR_ROOT, _wiki_path(m, cmd))) if len(arg) == 0 || strings.HasSuffix(arg[0], "/") { - m.Option(ice.MSG_DISPLAY, "table") if m.Option(nfs.DIR_DEEP) != "true" { // 目录列表 m.Option(nfs.DIR_TYPE, nfs.DIR) - m.Cmdy(nfs.DIR, kit.Select("./", arg, 0), "time size path") + m.Cmdy(nfs.DIR, kit.Select("./", arg, 0), "time,size,path") } // 文件列表 m.Option(nfs.DIR_TYPE, nfs.FILE) m.Option(nfs.DIR_REG, m.Conf(cmd, "meta.regs")) - m.Cmdy(nfs.DIR, kit.Select("./", arg, 0), "time size path") + m.Cmdy(nfs.DIR, kit.Select("./", arg, 0), "time,size,path") return true } return false @@ -65,7 +64,7 @@ var Index = &ice.Context{Name: WIKI, Help: "文档中心", func init() { web.Index.Register(Index, &web.Frame{}, - FEEL, WORD, DATA, DRAW, + FEEL, DRAW, DATA, WORD, SPARK, IMAGE, ) } diff --git a/core/wiki/wiki.shy b/core/wiki/wiki.shy index 8c1aec95..dadd5faf 100644 --- a/core/wiki/wiki.shy +++ b/core/wiki/wiki.shy @@ -1 +1,17 @@ chapter "文档" + +wiki.go +wiki.shy + +baidu.go +music.go +video.go + +chart.go +template.go + +feel.go +draw.go +data.go +word.go +