diff --git a/base/ctx/command.go b/base/ctx/command.go index 270c8f38..88c788a0 100644 --- a/base/ctx/command.go +++ b/base/ctx/command.go @@ -23,6 +23,7 @@ func _command_list(m *ice.Message, name string) *ice.Message { m.Push(mdb.HELP, kit.Format(cmd.Help)) m.Push(mdb.META, kit.Format(cmd.Meta)) m.Push(mdb.LIST, kit.Format(cmd.List)) + m.Push("_help", GetCmdHelp(m, name)) }) return m } @@ -170,10 +171,17 @@ func GetFileCmd(dir string) string { } return "" } +func GetCmdHelp(m *ice.Message, cmds string) (file string) { + file = strings.TrimPrefix(FileURI(kit.ExtChange(GetCmdFile(m, cmds), nfs.SHY)), "/require/") + if !nfs.Exists(m, path.Join(nfs.SRC_DOCUMENT, "commands", strings.TrimPrefix(file, "usr/icebergs/")), func(p string) { file = p }) { + kit.If(!nfs.Exists(m, file), func() { file = "" }) + } + return +} func GetCmdFile(m *ice.Message, cmds string) (file string) { m.Search(kit.Select(m.PrefixKey(), cmds), func(key string, cmd *ice.Command) { if file = strings.TrimPrefix(FileURI(kit.Split(cmd.FileLine(), nfs.DF)[0]), "/require/"); !nfs.Exists(m, file) { - file = path.Join(ice.ISH_PLUGED, file) + file = path.Join("/require/", file) } }) return diff --git a/base/nfs/dir.go b/base/nfs/dir.go index e53fc128..f4a227ff 100644 --- a/base/nfs/dir.go +++ b/base/nfs/dir.go @@ -149,6 +149,8 @@ const ( USR_LOCAL = ice.USR_LOCAL SRC_DOCUMENT = ice.SRC_DOCUMENT SRC_TEMPLATE = ice.SRC_TEMPLATE + REQUIRE_SRC = "/require/src/" + REQUIRE_USR = "/require/usr/" REQUIRE = "/require/" VOLCANOS = "/volcanos/" INTSHELL = "/intshell/" diff --git a/base/web/render.go b/base/web/render.go index 05686ac1..1df16ebc 100644 --- a/base/web/render.go +++ b/base/web/render.go @@ -142,6 +142,7 @@ func RenderPodCmd(m *ice.Message, pod, cmd string, arg ...ice.Any) { RenderCmds(m, kit.Dict(msg.AppendSimple(mdb.NAME, mdb.HELP), ctx.INDEX, msg.Append(ctx.INDEX), ctx.ARGS, kit.Simple(arg), ctx.DISPLAY, m.Option(ice.MSG_DISPLAY), mdb.LIST, kit.UnMarshal(msg.Append(mdb.LIST)), mdb.META, kit.UnMarshal(msg.Append(mdb.META)), + "_help", msg.Append("_help"), )) } func RenderCmd(m *ice.Message, cmd string, arg ...ice.Any) { diff --git a/core/chat/action.go b/core/chat/action.go index 43904ce5..8dafb548 100644 --- a/core/chat/action.go +++ b/core/chat/action.go @@ -75,11 +75,7 @@ func init() { return } if web.PodCmd(m, web.SPACE, arg...) { - m.Table(func(value ice.Maps) { - m.StatusTimeCount() - m.Push(web.SPACE, m.Option(ice.MSG_USERPOD)) - }) - return + m.Table(func(value ice.Maps) { m.Push(web.SPACE, m.Option(ice.MSG_USERPOD)) }) } else if len(arg) == 2 { ctx.OptionFromConfig(m, MENUS) _action_list(m, arg[0], arg[1]) diff --git a/core/chat/footer.go b/core/chat/footer.go index ed359b73..b82995d3 100644 --- a/core/chat/footer.go +++ b/core/chat/footer.go @@ -15,15 +15,14 @@ func init() { Index.MergeCommands(ice.Commands{ FOOTER: {Help: "状态栏", Actions: ice.MergeActions(ice.Actions{ ice.HELP: {Hand: func(m *ice.Message, arg ...string) { - ctx.ProcessField(m, web.WIKI_WORD, []string{ctx.FileURI(kit.ExtChange(ctx.GetCmdFile(m, arg[0]), nfs.SHY))}, arg...) - }}, - nfs.SCRIPT: {Hand: func(m *ice.Message, arg ...string) { - ctx.ProcessField(m, web.CODE_VIMER, func() []string { - return nfs.SplitPath(m, kit.ExtChange(nfs.Relative(m, ctx.GetCmdFile(m, arg[0])), nfs.JS)) - }, arg...) + if !web.PodCmd(m, ice.POD, kit.Simple(m.ActionKey(), arg)...) { + ctx.ProcessField(m, web.WIKI_WORD, ctx.GetCmdHelp(m, arg[0]), arg...) + } }}, nfs.SOURCE: {Hand: func(m *ice.Message, arg ...string) { - ctx.ProcessField(m, web.CODE_VIMER, func() []string { return nfs.SplitPath(m, ctx.GetCmdFile(m, arg[0])) }, arg...) + if !web.PodCmd(m, ice.POD, kit.Simple(m.ActionKey(), arg)...) { + ctx.ProcessField(m, web.CODE_VIMER, func() []string { return nfs.SplitPath(m, ctx.GetCmdFile(m, arg[0])) }, arg...) + } }}, ctx.CONFIG: {Hand: func(m *ice.Message, arg ...string) { ctx.ProcessField(m, ctx.CONFIG, arg, arg...) }}, }, web.ApiWhiteAction()), Hand: func(m *ice.Message, arg ...string) { diff --git a/core/chat/storm.go b/core/chat/storm.go index 09f51715..e1e8b60d 100644 --- a/core/chat/storm.go +++ b/core/chat/storm.go @@ -48,6 +48,7 @@ func init() { m.Push(mdb.HELP, msg.Append(mdb.HELP)) m.Push(mdb.META, msg.Append(mdb.META)) m.Push(mdb.LIST, msg.Append(mdb.LIST)) + m.Push("_help", msg.Append("_help")) }) m.Action(mdb.INSERT) } else if aaa.Right(m, arg) { diff --git a/core/code/inner.go b/core/code/inner.go index 4592a57e..e42863ad 100644 --- a/core/code/inner.go +++ b/core/code/inner.go @@ -103,6 +103,15 @@ func init() { }}, }, aaa.RoleAction()), Hand: func(m *ice.Message, arg ...string) { if kit.HasPrefix(arg[0], "/volcanos/", "/require/", ice.HTTP) { + if kit.HasPrefix(arg[0], nfs.REQUIRE_SRC) { + m.Option(nfs.FILE, strings.Split(strings.TrimPrefix(arg[0], nfs.REQUIRE_SRC), "?")[0]) + m.Option(nfs.PATH, nfs.SRC) + } + if kit.HasPrefix(arg[0], nfs.REQUIRE_USR) { + ls := kit.Split(arg[0], nfs.PS) + m.Option(nfs.FILE, strings.Split(strings.TrimPrefix(arg[0], nfs.REQUIRE_USR+ls[2]+nfs.PS), "?")[0]) + m.Option(nfs.PATH, nfs.USR+ls[2]+nfs.PS) + } m.Echo(m.Cmdx(web.SPIDE, ice.OPS, web.SPIDE_RAW, http.MethodGet, arg[0])) m.Options("mode", "simple", lex.PARSE, kit.Ext(kit.ParseURL(arg[0]).Path)) ctx.DisplayLocal(m, "")