diff --git a/core/chat/action.go b/core/chat/action.go index b138cd0a..dd53d282 100644 --- a/core/chat/action.go +++ b/core/chat/action.go @@ -205,17 +205,15 @@ func init() { _action_show(m, arg[0], arg[1], arg[2], arg[3:]...) }}, - "/cmd": {Name: "/cmd", Help: "命令", Action: map[string]*ice.Action{ + "/cmd/": {Name: "/cmd/", Help: "命令", Action: map[string]*ice.Action{ ctx.COMMAND: {Name: "command", Help: "命令", Hand: func(m *ice.Message, arg ...string) { if len(arg) == 0 { - m.Push("index", "cli.system") - m.Push("args", kit.Format(kit.Simple("pwd"))) - - m.Push("index", "cli.runtime") - m.Push("args", kit.Format(kit.Simple("procinfo"))) + arg = strings.Split(strings.TrimPrefix(m.Option("_names"), "/chat/cmd/"), "/") + m.Push("index", arg[0]) + m.Push("args", kit.Format(arg[1:])) return } - m.Cmdy(ctx.COMMAND, arg) + m.Cmdy(ctx.COMMAND, arg[0]) }}, cli.RUN: {Name: "command", Help: "执行", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(arg) @@ -223,8 +221,5 @@ func init() { }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { m.RenderDownload(path.Join(m.Conf(web.SERVE, kit.Keym(ice.VOLCANOS, kit.MDB_PATH)), "page/cmd.html")) }}, - "/cmd/": {Name: "/cmd/", Help: "命令", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { - m.RenderDownload(path.Join(m.Conf(web.SERVE, kit.Keym(ice.VOLCANOS, kit.MDB_PATH)), "page/cmd.html")) - }}, }}) } diff --git a/core/code/webpack.go b/core/code/webpack.go index 7ac273a8..8d26648b 100644 --- a/core/code/webpack.go +++ b/core/code/webpack.go @@ -11,6 +11,13 @@ import ( kit "github.com/shylinux/toolkits" ) +func _volcanos(file ...string) string { + return path.Join(ice.USR_VOLCANOS, path.Join(file...)) +} +func _publish(file ...string) string { + return path.Join(ice.USR_PUBLISH, path.Join(file...)) +} + const WEBPACK = "webpack" func init() { @@ -62,19 +69,22 @@ func init() { } m.Option(nfs.DIR_ROOT, "") - if f, p, e := kit.Create(path.Join(ice.USR_PUBLISH, WEBPACK, kit.Keys(m.Option(kit.MDB_NAME), HTML))); m.Assert(e) { + if f, p, e := kit.Create(_publish(WEBPACK, kit.Keys(m.Option(kit.MDB_NAME), HTML))); m.Assert(e) { f.WriteString(fmt.Sprintf(_pack, - m.Cmdx(nfs.CAT, path.Join(ice.USR_VOLCANOS, "page/cache.css")), - m.Cmdx(nfs.CAT, path.Join(ice.USR_VOLCANOS, "page/index.css")), + m.Cmdx(nfs.CAT, _volcanos("page/cache.css")), + m.Cmdx(nfs.CAT, _volcanos("page/index.css")), - m.Cmdx(nfs.CAT, path.Join(ice.USR_VOLCANOS, ice.PROTO_JS)), - m.Cmdx(nfs.CAT, path.Join(ice.USR_PUBLISH, path.Join(WEBPACK, kit.Keys(m.Option(kit.MDB_NAME), JS)))), + m.Cmdx(nfs.CAT, _volcanos(ice.PROTO_JS)), + m.Cmdx(nfs.CAT, _publish(path.Join(WEBPACK, kit.Keys(m.Option(kit.MDB_NAME), JS)))), - m.Cmdx(nfs.CAT, path.Join(ice.USR_VOLCANOS, "page/cache.js")), - m.Cmdx(nfs.CAT, path.Join(ice.USR_VOLCANOS, "page/index.js")), + m.Cmdx(nfs.CAT, _volcanos("page/cache.js")), + m.Cmdx(nfs.CAT, _volcanos("page/index.js")), )) m.Echo(p) } + + m.Cmd(nfs.COPY, _volcanos("page/can.css"), _volcanos("page/index.css"), _volcanos("page/cache.css")) + m.Cmd(nfs.COPY, _volcanos("page/can.js"), _volcanos("proto.js"), _volcanos("page/cache.js")) }}, mdb.PRUNES: {Name: "prunes", Help: "清理", Hand: func(m *ice.Message, arg ...string) { m.Cmd(nfs.SAVE, path.Join(ice.USR_VOLCANOS, "page/cache.css"), "")