diff --git a/base/mdb/render.go b/base/mdb/render.go
index b0d77599..19310815 100644
--- a/base/mdb/render.go
+++ b/base/mdb/render.go
@@ -11,7 +11,10 @@ func init() { Index.MergeCommands(ice.Commands{RENDER: {Help: "渲染", Actions:
func RenderAction(arg ...ice.Any) ice.Actions {
return ice.MergeActions(ice.Actions{ice.CTX_INIT: AutoConfig(SHORT, TYPE, FIELD, "time,type,name,text", arg),
- CREATE: {Name: "create type name text", Hand: func(m *ice.Message, arg ...string) { HashCreate(m) }},
+ CREATE: {Name: "create type name text", Hand: func(m *ice.Message, arg ...string) {
+ Config(m, SHORT, TYPE)
+ HashCreate(m)
+ }},
SELECT: {Name: "select type name text auto create", Hand: func(m *ice.Message, arg ...string) {
if len(arg) < 2 || arg[0] == "" {
HashSelect(m, arg...)
diff --git a/base/nfs/cat.go b/base/nfs/cat.go
index f8bc98cb..13c06d07 100644
--- a/base/nfs/cat.go
+++ b/base/nfs/cat.go
@@ -131,7 +131,7 @@ func Template(m templateMessage, p string, arg ...ice.Any) string {
return kit.Renders(kit.Format(TemplateText(m, p), arg...), m)
}
func TemplateText(m templateMessage, p string) string {
- return m.Cmdx(CAT, path.Join(m.PrefixKey(), path.Base(p)), kit.Dict(DIR_ROOT, ice.SRC_TEMPLATE))
+ return strings.TrimSpace(m.Cmdx(CAT, path.Join(m.PrefixKey(), path.Base(p)), kit.Dict(DIR_ROOT, ice.SRC_TEMPLATE)))
}
func IsSourceFile(m *ice.Message, ext string) bool {
return mdb.Conf(m, Prefix(CAT), kit.Keym(SOURCE, ext)) == ice.TRUE
diff --git a/base/web/space.go b/base/web/space.go
index f926a53a..e1975a88 100644
--- a/base/web/space.go
+++ b/base/web/space.go
@@ -96,11 +96,11 @@ func _space_handle(m *ice.Message, safe bool, name string, c *websocket.Conn) {
}
}
func _space_domain(m *ice.Message) (link string) {
- // m.Options(ice.MSG_OPTION, ice.MSG_USERNAME, ice.MSG_OPTS, ice.MSG_USERNAME)
return kit.GetValid(
func() string { return ice.Info.Domain },
func() string {
if dev := kit.Select(ice.DEV, ice.OPS, ice.Info.NodeType == WORKER); mdb.HashSelectDetail(m, dev, nil) {
+ m.Options(ice.MSG_OPTION, ice.MSG_USERNAME, ice.MSG_OPTS, ice.MSG_USERNAME)
return m.Cmdv(SPACE, dev, cli.PWD, mdb.LINK)
}
return ""
@@ -111,7 +111,7 @@ func _space_domain(m *ice.Message) (link string) {
func _space_exec(m *ice.Message, source, target []string, c *websocket.Conn) {
switch kit.Select(cli.PWD, m.Detailv(), 0) {
case cli.PWD:
- m.Push(mdb.LINK, m.MergePod(_space_domain(m), kit.Select("", source, -1)))
+ m.Push(mdb.LINK, m.MergePod(kit.Select("", source, -1)))
default:
kit.If(aaa.Right(m, m.Detailv()), func() { m = m.Cmd() })
}
diff --git a/core/code/autogen.go b/core/code/autogen.go
index 1a49edf2..d205b4e2 100644
--- a/core/code/autogen.go
+++ b/core/code/autogen.go
@@ -66,7 +66,7 @@ func _autogen_version(m *ice.Message) string {
func _autogen_gits(m *ice.Message, arg ...string) string {
res := []string{}
kit.For(_autogen_git(m, arg...), func(k, v string) {
- res = append(res, kit.Format(` %s: "%s",`, kit.LowerCapital(k), strings.TrimSpace(v)))
+ res = append(res, kit.Format(` %s: "%s",`, kit.Capital(k), strings.TrimSpace(v)))
})
return kit.Join(res, ice.NL)
}
diff --git a/core/code/inner.go b/core/code/inner.go
index aca0d4bb..44e75987 100644
--- a/core/code/inner.go
+++ b/core/code/inner.go
@@ -133,7 +133,7 @@ func init() {
func PlugAction() ice.Actions {
return ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
- kit.For([]string{mdb.PLUGIN, mdb.RENDER, mdb.ENGINE}, func(cmd string) { m.Cmd(cmd, mdb.CREATE, m.CommandKey(), m.PrefixKey()) })
+ kit.For([]string{mdb.PLUGIN, mdb.RENDER, mdb.ENGINE, TEMPLATE, COMPLETE}, func(cmd string) { m.Cmd(cmd, mdb.CREATE, m.CommandKey(), m.PrefixKey()) })
LoadPlug(m, m.CommandKey())
}},
mdb.PLUGIN: {Hand: func(m *ice.Message, arg ...string) { m.Echo(mdb.Config(m, PLUG)) }},
diff --git a/core/code/shy.go b/core/code/shy.go
index 41b1fcbf..19663791 100644
--- a/core/code/shy.go
+++ b/core/code/shy.go
@@ -19,17 +19,13 @@ func init() {
Index.MergeCommands(ice.Commands{
SHY: {Name: "shy path auto", Help: "笔记", Actions: ice.MergeActions(ice.Actions{
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
- // ctx.ProcessCommand(m, web.WIKI_WORD, kit.Simple(path.Join(arg[2], arg[1])))
- // ctx.ProcessCommand(m, yac.STACK, kit.Simple(arg[1]))
- // if ls := kit.Split(arg[1], ice.PS); ls[0] == nfs.SCRIPT {
- // m.Search(ls[1], func(key string, cmd *ice.Command) { yac.StackHandler(m) })
- // ctx.ProcessCommand(m, ls[1], kit.Simple())
- // } else {
- // ctx.ProcessCommand(m, kit.TrimExt(arg[1], SHY), kit.Simple())
- // }
+ ctx.ProcessCommand(m, web.WIKI_WORD, kit.Simple(path.Join(arg[2], arg[1])))
+ return
ctx.ProcessCommand(m, yac.STACK, kit.Simple(path.Join(arg[2], arg[1])))
}},
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) {
+ ctx.ProcessCommand(m, web.WIKI_WORD, kit.Simple(path.Join(arg[2], arg[1])))
+ return
if msg := m.Cmd(yac.STACK, path.Join(arg[2], arg[1])); msg.Option("__index") != "" {
ctx.ProcessCommand(m, msg.Option("__index"), kit.Simple())
} else {
@@ -39,6 +35,7 @@ func init() {
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]))))
}},
+ COMPLETE: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy("web.wiki.word", COMPLETE, arg) }},
}, PlugAction()), Hand: func(m *ice.Message, arg ...string) {
if len(arg) > 0 && kit.Ext(arg[0]) == m.CommandKey() {
m.Cmdy(web.WIKI_WORD, path.Join(ice.SRC, strings.TrimPrefix(arg[0], nfs.SRC)))
diff --git a/core/wiki/audio.go b/core/wiki/audio.go
index f86349df..9ddd1fd9 100644
--- a/core/wiki/audio.go
+++ b/core/wiki/audio.go
@@ -2,6 +2,7 @@ package wiki
import (
ice "shylinux.com/x/icebergs"
+ "shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/nfs"
)
@@ -12,8 +13,8 @@ const AUDIO = "audio"
func init() {
Index.MergeCommands(ice.Commands{
- AUDIO: {Name: "audio url", Help: "音频", Actions: WordAction(
- ``, nfs.PATH, ice.USR_LOCAL_IMAGE,
- ), Hand: func(m *ice.Message, arg ...string) { _image_show(m, arg[0], arg[1:]...) }},
+ AUDIO: {Name: "audio url", Help: "音频", Actions: ctx.ConfAction(nfs.PATH, ice.USR_LOCAL_IMAGE), Hand: func(m *ice.Message, arg ...string) {
+ _image_show(m, arg[0], arg[1:]...)
+ }},
})
}
diff --git a/core/wiki/brief.go b/core/wiki/brief.go
index 52acaaa3..401e35c0 100644
--- a/core/wiki/brief.go
+++ b/core/wiki/brief.go
@@ -8,8 +8,8 @@ const BRIEF = "brief"
func init() {
Index.MergeCommands(ice.Commands{
- BRIEF: {Name: "brief text", Help: "摘要", Actions: WordAction(
- `
{{.Option "text"}}
`,
- ), Hand: func(m *ice.Message, arg ...string) { _wiki_template(m, "", arg[0], arg[1:]...) }},
+ BRIEF: {Name: "brief text", Help: "摘要", Hand: func(m *ice.Message, arg ...string) {
+ _wiki_template(m, "", "", arg[0], arg[1:]...)
+ }},
})
}
diff --git a/core/wiki/chart.go b/core/wiki/chart.go
index 9ad19310..04309dd5 100644
--- a/core/wiki/chart.go
+++ b/core/wiki/chart.go
@@ -124,7 +124,7 @@ func _chart_show(m *ice.Message, kind, text string, arg ...string) {
m.Option(WIDTH, chart.GetWidth())
m.Option(HEIGHT, chart.GetHeight())
- _wiki_template(m, "", text, arg...)
+ _wiki_template(m, "", "", text, arg...)
defer m.Echo("")
defer m.RenderResult()
chart.Draw(m, 0, 0)
@@ -156,10 +156,8 @@ const CHART = "chart"
func init() {
Index.MergeCommands(ice.Commands{
- CHART: {Name: "chart type=label,chain,sequence run text", Help: "图表", Actions: WordAction(
- `