mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 17:44:05 +08:00
opt some
This commit is contained in:
parent
55a6eccb46
commit
b16071324c
@ -25,7 +25,7 @@ func _command_list(m *ice.Message, name string) {
|
|||||||
|
|
||||||
// 命令详情
|
// 命令详情
|
||||||
m.Spawn(m.Source()).Search(name, func(p *ice.Context, s *ice.Context, key string, cmd *ice.Command) {
|
m.Spawn(m.Source()).Search(name, func(p *ice.Context, s *ice.Context, key string, cmd *ice.Command) {
|
||||||
m.Push(kit.MDB_INDEX, s.Cap(ice.CTX_FOLLOW))
|
m.Push(kit.MDB_INDEX, kit.Keys(s.Cap(ice.CTX_FOLLOW), key))
|
||||||
m.Push(kit.MDB_NAME, kit.Format(cmd.Name))
|
m.Push(kit.MDB_NAME, kit.Format(cmd.Name))
|
||||||
m.Push(kit.MDB_HELP, kit.Format(cmd.Help))
|
m.Push(kit.MDB_HELP, kit.Format(cmd.Help))
|
||||||
m.Push(kit.MDB_META, kit.Formats(cmd.Meta))
|
m.Push(kit.MDB_META, kit.Formats(cmd.Meta))
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func _cmd_render(m *ice.Message, cmd string, args ...interface{}) {
|
func _cmd_render(m *ice.Message, cmd string, args ...interface{}) {
|
||||||
list := []interface{}{kit.Dict("index", cmd, "args", args)}
|
list := []interface{}{kit.Dict("index", cmd, "args", kit.Simple(args))}
|
||||||
m.RenderResult(kit.Format(m.Conf(CMD, kit.Keym(kit.MDB_TEMPLATE)), kit.Format(list)))
|
m.RenderResult(kit.Format(m.Conf(CMD, kit.Keym(kit.MDB_TEMPLATE)), kit.Format(list)))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,24 +36,24 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
if strings.HasSuffix(m.R.URL.Path, "/") {
|
if strings.HasSuffix(m.R.URL.Path, "/") {
|
||||||
m.RenderIndex(web.SERVE, ice.VOLCANOS)
|
m.RenderIndex(web.SERVE, ice.VOLCANOS, "page/cmd.html")
|
||||||
return // 目录
|
return // 目录
|
||||||
}
|
}
|
||||||
|
|
||||||
if msg := m.Cmd(ctx.COMMAND, arg[0]); msg.Append("meta") != "" {
|
if msg := m.Cmd(ctx.COMMAND, arg[0]); msg.Append("meta") != "" {
|
||||||
_cmd_render(m, arg[0])
|
_cmd_render(m, arg[0], arg[1:])
|
||||||
return // 命令
|
return // 命令
|
||||||
}
|
}
|
||||||
|
|
||||||
switch p := path.Join(m.Conf(CMD, kit.META_PATH), path.Join(arg...)); kit.Ext(p) {
|
switch p := path.Join(m.Conf(CMD, kit.META_PATH), path.Join(arg...)); kit.Ext(p) {
|
||||||
case "svg":
|
case "svg":
|
||||||
_cmd_render(m, "web.wiki.draw", path.Dir(p)+"/", path.Base(p))
|
_cmd_render(m, "web.wiki.draw", path.Dir(p)+"/", path.Base(p))
|
||||||
|
case "csv":
|
||||||
|
_cmd_render(m, "web.wiki.data", p)
|
||||||
case "json":
|
case "json":
|
||||||
_cmd_render(m, "web.wiki.json", p)
|
_cmd_render(m, "web.wiki.json", p)
|
||||||
case "shy":
|
case "shy":
|
||||||
_cmd_render(m, "web.wiki.word", p)
|
_cmd_render(m, "web.wiki.word", p)
|
||||||
case "csv":
|
|
||||||
_cmd_render(m, "web.wiki.data", p)
|
|
||||||
case "go", "mod", "sum":
|
case "go", "mod", "sum":
|
||||||
_cmd_render(m, "web.code.inner", path.Dir(p)+"/", path.Base(p))
|
_cmd_render(m, "web.code.inner", path.Dir(p)+"/", path.Base(p))
|
||||||
default:
|
default:
|
||||||
|
@ -26,21 +26,15 @@ func init() {
|
|||||||
m.Cmdy(arg)
|
m.Cmdy(arg)
|
||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
|
if kit.Select("", arg, 0) == "" {
|
||||||
|
_cmd_render(m, web.ROUTE)
|
||||||
|
return
|
||||||
|
}
|
||||||
m.RenderIndex(web.SERVE, ice.VOLCANOS)
|
m.RenderIndex(web.SERVE, ice.VOLCANOS)
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
Configs: map[string]*ice.Config{
|
Configs: map[string]*ice.Config{
|
||||||
POD: {Name: POD, Help: "节点", Value: kit.Data(
|
POD: {Name: POD, Help: "节点", Value: kit.Data()},
|
||||||
kit.MDB_PATH, "./", kit.MDB_INDEX, "page/cmd.html", kit.MDB_TEMPLATE, `<!DOCTYPE html>
|
|
||||||
<head>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/page/cmd.css">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<script src="/page/cmd.js"></script>
|
|
||||||
<script>cmd(%s)</script>
|
|
||||||
</body>
|
|
||||||
`,
|
|
||||||
)},
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user