From 095e243c44d32acab96c4f35a6b57722485ab24d Mon Sep 17 00:00:00 2001 From: shaoying Date: Tue, 21 Jul 2020 20:28:48 +0800 Subject: [PATCH] opt some --- base/cli/system.go | 2 +- core/wiki/draw.go | 5 +++-- core/wiki/word.go | 22 ++++++++++++++++++++++ misc/chrome/chrome.shy | 10 ++++++++++ 4 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 misc/chrome/chrome.shy diff --git a/base/cli/system.go b/base/cli/system.go index 0a1de5a3..3384950c 100644 --- a/base/cli/system.go +++ b/base/cli/system.go @@ -56,7 +56,7 @@ func init() { SYSTEM: {Name: "system", Help: "系统命令", Value: kit.Data()}, }, Commands: map[string]*ice.Command{ - SYSTEM: {Name: "system cmd arg arg arg arg...", Help: "系统命令", Hand: func(m *ice.Message, c *ice.Context, key string, arg ...string) { + SYSTEM: {Name: "system cmd arg", Help: "系统命令", Hand: func(m *ice.Message, c *ice.Context, key string, arg ...string) { cmd := exec.Command(arg[0], arg[1:]...) // 运行目录 diff --git a/core/wiki/draw.go b/core/wiki/draw.go index 756db2ac..5137f4cc 100644 --- a/core/wiki/draw.go +++ b/core/wiki/draw.go @@ -28,12 +28,13 @@ const ( func init() { sub := Index.Register(&ice.Context{Name: "draw", Help: "思维导图", Configs: map[string]*ice.Config{ - DRAW: {Name: "draw", Help: "思维导图", Value: kit.Data(kit.MDB_SHORT, "name", "path", "usr/demo", "regs", ".*\\.svg", + DRAW: {Name: "draw", Help: "思维导图", Value: kit.Data( + "path", "", "regs", ".*\\.svg", "prefix", ``, "suffix", ``, )}, }, Commands: map[string]*ice.Command{ - DRAW: {Name: "draw path=hi.svg auto", Help: "思维导图", Meta: kit.Dict(mdb.PLUGIN, DrawPlugin), Action: map[string]*ice.Action{ + DRAW: {Name: "draw path=src/main.svg auto", Help: "思维导图", Meta: kit.Dict(mdb.PLUGIN, DrawPlugin), Action: map[string]*ice.Action{ nfs.SAVE: {Name: "save path text", Help: "保存", Hand: func(m *ice.Message, arg ...string) { _wiki_save(m, DRAW, arg[0], kit.Select(m.Option("content"), arg, 1)) }}, diff --git a/core/wiki/word.go b/core/wiki/word.go index 14a7c297..a15e2a8c 100644 --- a/core/wiki/word.go +++ b/core/wiki/word.go @@ -164,6 +164,28 @@ func _field_show(m *ice.Message, name, text string, arg ...string) { m.Parse("option", arg[i], arg[i+1]) } data[arg[i]] = m.Optionv(arg[i]) + if arg[i] == "args" { + args := kit.Simple(m.Optionv(arg[i])) + + count := 0 + kit.Fetch(data["inputs"], func(index int, value map[string]interface{}) { + if value["_input"] == "text" || value["type"] == "text" { + count++ + } + }) + + if len(args) > count { + list := data["inputs"].([]interface{}) + for i := count; i < len(args); i++ { + list = append(list, kit.Dict( + "_input", "text", + "name", "args", + "value", args[i], + )) + } + data["inputs"] = list + } + } } // 渲染引擎 diff --git a/misc/chrome/chrome.shy b/misc/chrome/chrome.shy new file mode 100644 index 00000000..61eac4e7 --- /dev/null +++ b/misc/chrome/chrome.shy @@ -0,0 +1,10 @@ +title "HTML5" + +refer "官网" ` +官网 https://www.w3.org/ +文档 https://developer.mozilla.org/ +源码 https://github.com/chromium/chromium/ +插件 chrome://extensions +` + +