mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 17:44:05 +08:00
add template.go
This commit is contained in:
parent
c2ff6a5b08
commit
9919e3bcdf
@ -151,6 +151,7 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
FAVOR: {Name: "favor", Help: "收藏"},
|
FAVOR: {Name: "favor", Help: "收藏"},
|
||||||
}, ctx.CmdAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, ctx.CmdAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
|
arg[0] = strings.Split(arg[0], ice.FS)[0]
|
||||||
if !strings.HasSuffix(arg[0], ice.PS) {
|
if !strings.HasSuffix(arg[0], ice.PS) {
|
||||||
arg[1] = kit.Slice(strings.Split(arg[0], ice.PS), -1)[0]
|
arg[1] = kit.Slice(strings.Split(arg[0], ice.PS), -1)[0]
|
||||||
arg[0] = strings.TrimSuffix(arg[0], arg[1])
|
arg[0] = strings.TrimSuffix(arg[0], arg[1])
|
||||||
@ -161,7 +162,8 @@ func init() {
|
|||||||
nfs.Dir(m, nfs.PATH)
|
nfs.Dir(m, nfs.PATH)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
m.Option("exts", "inner/search.js?a=1,inner/favor.js")
|
arg[1] = strings.Split(arg[1], ice.FS)[0]
|
||||||
|
m.Option("exts", "inner/search.js?a=1,inner/favor.js,inner/template.js")
|
||||||
if _inner_list(m, kit.Ext(arg[1]), arg[1], arg[0]); m.IsErrNotFound() {
|
if _inner_list(m, kit.Ext(arg[1]), arg[1], arg[0]); m.IsErrNotFound() {
|
||||||
m.SetResult("")
|
m.SetResult("")
|
||||||
}
|
}
|
||||||
|
26
core/code/template.go
Normal file
26
core/code/template.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package code
|
||||||
|
|
||||||
|
import (
|
||||||
|
"path"
|
||||||
|
|
||||||
|
ice "shylinux.com/x/icebergs"
|
||||||
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
const TEMPLATE = "template"
|
||||||
|
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
||||||
|
TEMPLATE: {Name: "template name auto create", Help: "模板", Action: ice.MergeAction(
|
||||||
|
map[string]*ice.Action{
|
||||||
|
mdb.CREATE: {Name: "create type name text args", Help: "创建"},
|
||||||
|
nfs.DEFS: {Name: "defs file", Help: "生成", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmd(nfs.DEFS, path.Join(m.Option(nfs.PATH), m.Option(nfs.FILE)), m.Option(mdb.TEXT))
|
||||||
|
}},
|
||||||
|
}, mdb.HashAction(mdb.SHORT, "name", mdb.FIELD, "time,type,name,text,args"),
|
||||||
|
), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
|
mdb.HashSelect(m, arg...)
|
||||||
|
m.PushAction(nfs.DEFS, mdb.REMOVE)
|
||||||
|
}}},
|
||||||
|
})
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user