1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 01:24:05 +08:00

opt debug

This commit is contained in:
IT 老营长 @云轩领航-创始人 2023-12-22 17:49:00 +08:00
parent 7796bf4ce1
commit 302a75485e
7 changed files with 29 additions and 13 deletions

View File

@ -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

View File

@ -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/"

View File

@ -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) {

View File

@ -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])

View File

@ -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) {

View File

@ -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) {

View File

@ -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, "")