From 5821f3e25825dbc8cb77642d9958d85d9d85669d Mon Sep 17 00:00:00 2001 From: shaoying Date: Thu, 7 May 2020 16:16:23 +0800 Subject: [PATCH] opt some --- base.go | 2 +- base/web/web.go | 16 ++++------------ misc/git/git.go | 2 +- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/base.go b/base.go index fa743ef5..2c7405b2 100644 --- a/base.go +++ b/base.go @@ -88,7 +88,7 @@ var Index = &Context{Name: "ice", Help: "冰山模块", m.root.Cost("_init") m.target.root.wg = &sync.WaitGroup{} - for _, k := range kit.Split(os.Getenv("ctx_mod")) { + for _, k := range kit.Split(kit.Select("gdb,log,ssh,ctx", os.Getenv("ctx_mod"))) { m.Start(k) } diff --git a/base/web/web.go b/base/web/web.go index 5da15243..d6ec251c 100644 --- a/base/web/web.go +++ b/base/web/web.go @@ -2415,19 +2415,11 @@ var Index = &ice.Context{Name: "web", Help: "网络模块", "/plugin/github.com/": {Name: "/space/", Help: "空间站", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { prefix := m.Conf(ice.WEB_SERVE, "meta.volcanos.require") - if _, e := os.Stat(path.Join(prefix, cmd)); e != nil { - m.Cmd(ice.CLI_SYSTEM, "git", "clone", "https://"+strings.Join(strings.Split(cmd, "/")[2:5], "/"), - path.Join(prefix, strings.Join(strings.Split(cmd, "/")[1:5], "/"))) + repos := path.Join(strings.Split(cmd, "/")[2:5]...) + if _, e := os.Stat(path.Join(prefix, repos)); e != nil { + m.Cmd(ice.CLI_SYSTEM, "git", "clone", "https://"+repos, path.Join(prefix, repos)) } - m.Render(ice.RENDER_DOWNLOAD, path.Join(prefix, cmd)) - }}, - "/github.com/": {Name: "/space/", Help: "空间站", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { - prefix := m.Conf(ice.WEB_SERVE, "meta.volcanos.require") - if _, e := os.Stat(path.Join(prefix, cmd)); e != nil { - m.Cmd(ice.CLI_SYSTEM, "git", "clone", "https://"+strings.Join(strings.Split(cmd, "/")[1:4], "/"), - path.Join(prefix, strings.Join(strings.Split(cmd, "/")[1:4], "/"))) - } - m.Render(ice.RENDER_DOWNLOAD, path.Join(prefix, cmd)) + m.Render(ice.RENDER_DOWNLOAD, path.Join(prefix, repos, path.Join(arg[2:]...))) }}, "/local/": {Name: "/space/", Help: "空间站", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { p := path.Join(cmd) diff --git a/misc/git/git.go b/misc/git/git.go index 43652fac..4eefc72a 100644 --- a/misc/git/git.go +++ b/misc/git/git.go @@ -270,7 +270,7 @@ var Index = &ice.Context{Name: "git", Help: "代码库", }}, "trend": {Name: "trend name=auto begin_time=@date auto", Help: "趋势图", Meta: kit.Dict( - "display", "/plugin/story/trend", + "display", "story/trend", ), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { if len(arg) == 0 { m.Option("_display", "table")