1
0
forked from x/icebergs

opt inner

This commit is contained in:
shaoying 2020-08-07 20:34:17 +08:00
parent fbed37c343
commit 515ec07559
7 changed files with 20 additions and 18 deletions

View File

@ -17,7 +17,7 @@ func init() {
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Load() }},
ice.CTX_EXIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.Save(PASTE) }},
PASTE: {Name: "paste text auto 添加:button", Help: "粘贴板", Meta: kit.Dict(
PASTE: {Name: "paste text auto 粘贴:button", Help: "粘贴板", Meta: kit.Dict(
"display", "/plugin/story/paste.js",
), Action: map[string]*ice.Action{
mdb.INSERT: {Name: "insert [key value]...", Help: "添加", Hand: func(m *ice.Message, arg ...string) {

View File

@ -19,14 +19,16 @@ func _inner_list(m *ice.Message, ext, file, dir string, arg ...string) {
if !m.Right(strings.Split(dir, "/"), file) {
return
}
if m.Cmdy(mdb.RENDER, ext, file, dir, arg); m.Result() == "" {
if m.Cmdy(mdb.RENDER, ext, file, dir, arg); m.Result() != "" {
return
}
if m.Conf(INNER, kit.Keys("meta.source", ext)) == "true" {
if m.Cmdy(mdb.RENDER, nfs.FILE, file, dir, arg); m.Result() == "" {
if m.Cmdy(mdb.RENDER, nfs.FILE, file, dir, arg); m.Result() != "" {
return
}
}
m.Echo(path.Join(dir, file))
}
}
}
}
func _inner_show(m *ice.Message, ext, file, dir string, arg ...string) {
if m.Cmdy(mdb.ENGINE, ext, file, dir, arg); m.Result() == "" {
if ls := kit.Simple(m.Confv(INNER, kit.Keys("meta.show", ext))); len(ls) > 0 {
@ -105,6 +107,7 @@ func init() {
"csv", "true", "json", "true",
"css", "true", "html", "true",
"txt", "true", "url", "true",
"log", "true", "err", "true",
"md", "true", "conf", "true",
"ts", "true", "tsx", "true", "vue", "true", "sass", "true",

View File

@ -39,7 +39,7 @@ func init() {
}},
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) {
m.Option(cli.CMD_DIR, arg[2])
m.Cmdy(cli.SYSTEM, arg[1])
m.Cmdy(cli.SYSTEM, "sh", arg[1])
m.Set(ice.MSG_APPEND)
}},

View File

@ -1,10 +1,12 @@
package wiki
import (
"github.com/shylinux/icebergs"
"path"
ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/mdb"
"github.com/shylinux/icebergs/base/nfs"
"github.com/shylinux/toolkits"
kit "github.com/shylinux/toolkits"
)
func _data_show(m *ice.Message, name string, arg ...string) {
@ -21,7 +23,7 @@ func init() {
Index.Merge(&ice.Context{Name: "data", Help: "数据表格",
Configs: map[string]*ice.Config{
DATA: {Name: "data", Help: "数据表格", Value: kit.Data(
kit.MDB_SHORT, "name", "path", "", "regs", ".*\\.csv",
"path", "usr/export", "regs", ".*\\.csv",
)},
},
Commands: map[string]*ice.Command{
@ -31,7 +33,7 @@ func init() {
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if !_wiki_list(m, DATA, kit.Select("./", arg, 0)) {
_data_show(m, arg[0])
_data_show(m, path.Join(m.Conf(DATA, "meta.path"), arg[0]))
}
}},
},

View File

@ -16,7 +16,7 @@ func init() {
Index.Merge(&ice.Context{Name: "feel", Help: "影音媒体",
Configs: map[string]*ice.Config{
FEEL: {Name: "feel", Help: "影音媒体", Value: kit.Data(
"path", "", "regs", ".*.(qrc|png|PNG|jpg|jpeg|JPG|MOV|m4v|mp4)",
"path", "usr/image", "regs", ".*.(qrc|png|PNG|jpg|jpeg|JPG|MOV|m4v|mp4)",
)},
},
Commands: map[string]*ice.Command{
@ -44,14 +44,11 @@ func init() {
}
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
m.Option("prefix", m.Conf(FEEL, "meta.path"))
if !_wiki_list(m, FEEL, kit.Select("./", arg, 0)) {
m.Echo(path.Join(m.Conf(FEEL, "meta.path"), arg[0]))
return
}
m.Table(func(index int, value map[string]string, head []string) {
m.Push("show", m.Cmdx(mdb.RENDER, web.RENDER.IMG, path.Join("/share/local", value["path"])))
})
m.Sort(kit.MDB_TIME, "time_r")
}},
},
}, nil)

View File

@ -33,7 +33,7 @@ func _wiki_save(m *ice.Message, cmd, name, text string, arg ...string) {
}
func _wiki_upload(m *ice.Message, cmd string) {
m.Cmdy(web.CACHE, web.UPLOAD)
m.Cmdy(web.CACHE, web.WATCH, m.Option(web.DATA), path.Join(m.Option("path"), m.Option("name")))
m.Cmdy(web.CACHE, web.WATCH, m.Option(web.DATA), path.Join(m.Conf(cmd, "meta.path"), m.Option("path"), m.Option("name")))
}
func reply(m *ice.Message, cmd string, arg ...string) bool {

View File

@ -13,7 +13,7 @@ field "编辑器" web.code.vimer args `[ src/ main.go ]`
field "资料库" web.chat.meet.miss args `[ ]`
field "粘贴板" web.chat.paste.paste args `[ ]`
field "相册集" web.wiki.feel args `[ usr/export/web.chat.meet.miss/feel/ ]`
field "相册集" web.wiki.feel args `[ ]`
field "思维导图" web.wiki.draw.draw args `[ src/ main.svg ]`
field "任务" web.team.task args `[ ]`