1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 01:24:05 +08:00
This commit is contained in:
shylinux 2020-06-11 10:49:16 +08:00
parent b5007b0e41
commit 00e223f14b
3 changed files with 12 additions and 7 deletions

View File

@ -250,7 +250,8 @@ func _story_add(m *ice.Message, arg ...string) {
"scene", arg[1], "story", arg[2], "count", count+1, "data", arg[3], "prev", prev,
))
m.Log_CREATE("story", list, "type", arg[1], "name", arg[2])
m.Push("list", list)
m.Push("count", count+1)
m.Push("key", list)
if head == "" {
// 添加索引
@ -375,11 +376,13 @@ func _story_history(m *ice.Message, name string) {
func StoryHistory(m *ice.Message, name string) *ice.Message { _story_history(m, name); return m }
func StoryIndex(m *ice.Message, name string) *ice.Message { _story_index(m, name, true); return m }
func StoryWatch(m *ice.Message, index string, file string) { _story_watch(m, index, file) }
func StoryCatch(m *ice.Message, mime string, file string) {
func StoryCatch(m *ice.Message, mime string, file string) *ice.Message {
_story_catch(m, "catch", kit.Select(mime, strings.TrimPrefix(path.Ext(file), ".")), file, "")
return m
}
func StoryAdd(m *ice.Message, mime string, name string, text string, arg ...string) {
func StoryAdd(m *ice.Message, mime string, name string, text string, arg ...string) *ice.Message {
_story_add(m, kit.Simple("add", mime, name, text, arg)...)
return m
}
func init() {

View File

@ -129,7 +129,7 @@ func init() {
)},
},
Commands: map[string]*ice.Command{
INNER: {Name: "inner path=auto name=auto auto", Help: "编辑器", Meta: map[string]interface{}{
INNER: {Name: "inner path=tmp name=hi.qrc key auto", Help: "编辑器", Meta: map[string]interface{}{
"display": "/plugin/inner.js", "style": "editor",
}, Action: map[string]*ice.Action{
"cmd": {Name: "cmd arg", Help: "命令", Hand: func(m *ice.Message, arg ...string) {
@ -164,7 +164,8 @@ func init() {
}
}},
"commit": {Name: "commit path name", Help: "提交", Hand: func(m *ice.Message, arg ...string) {
web.StoryCatch(m, "", path.Join("./", arg[0], arg[1]))
msg := web.StoryCatch(m.Spawn(), "", path.Join("./", arg[0], arg[1]))
m.Copy(msg, ice.MSG_APPEND, "time", "count", "key")
}},
"recover": {Name: "recover", Help: "复盘", Hand: func(m *ice.Message, arg ...string) {
msg := web.StoryHistory(m.Spawn(), path.Join("./", arg[0], arg[1])+".display")
@ -175,7 +176,8 @@ func init() {
}
}},
"record": {Name: "record", Help: "记录", Hand: func(m *ice.Message, arg ...string) {
web.StoryAdd(m, "display", path.Join("./", m.Option("path"), m.Option("name"))+".display", m.Option("display"))
msg := web.StoryAdd(m.Spawn(), "display", path.Join("./", m.Option("path"), m.Option("name"))+".display", m.Option("display"))
m.Copy(msg, ice.MSG_APPEND, "time", "count", "key")
}},
"log": {Name: "log path name", Help: "日志", Hand: func(m *ice.Message, arg ...string) {

View File

@ -359,7 +359,7 @@ var Index = &ice.Context{Name: "wiki", Help: "文档中心",
// 解析数据
m.CSV(m.Result())
}},
"word": {Name: "word path=auto auto", Help: "语言文字", Meta: kit.Dict("display", "local/wiki/word"), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
"word": {Name: "word path=自然/编程/hi.shy auto", Help: "语言文字", Meta: kit.Dict("display", "local/wiki/word"), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if len(arg) > 0 && arg[0] == "action" {
switch arg[1] {
case "story":