diff --git a/base/cli/runtime.go b/base/cli/runtime.go index 4f758450..d9feb4b0 100644 --- a/base/cli/runtime.go +++ b/base/cli/runtime.go @@ -221,7 +221,7 @@ func init() { arg = arg[1:] } m.Cmdy(ctx.CONFIG, RUNTIME, arg) - m.DisplayStory("json.js") + m.DisplayStoryJSON() }}, }}) } diff --git a/base/lex/split.go b/base/lex/split.go index 8f2cf2c0..b4c925d6 100644 --- a/base/lex/split.go +++ b/base/lex/split.go @@ -107,7 +107,7 @@ func init() { } m.Echo(kit.Format(_split_list(m, arg[0], kit.Split(kit.Join(arg[1:]))...))) - m.DisplayStory("json.js") + m.DisplayStoryJSON() }}, }}) } diff --git a/base/mdb/plugin.go b/base/mdb/plugin.go index a54d0644..a4130b4a 100644 --- a/base/mdb/plugin.go +++ b/base/mdb/plugin.go @@ -27,7 +27,7 @@ func init() { if HashSelect(m, arg...); len(arg) == 0 { m.Sort(TYPE) } else if len(arg) == 1 { - m.DisplayStory("json.js") + m.DisplayStoryJSON() m.Echo(kit.Formats(m.Confv(m.Append(NAME), "meta.plug"))) } }}, diff --git a/base/mdb/render.go b/base/mdb/render.go index c01a4856..f9099f71 100644 --- a/base/mdb/render.go +++ b/base/mdb/render.go @@ -27,7 +27,7 @@ func init() { if HashSelect(m, arg...); len(arg) == 0 { m.Sort(TYPE) } else if len(arg) == 1 { - m.DisplayStory("json.js") + m.DisplayStoryJSON() m.Echo(kit.Formats(m.Confv(m.Append(NAME), "meta.plug"))) } }}, diff --git a/base/nfs/dir.go b/base/nfs/dir.go index 6fbd1f8e..bca27324 100644 --- a/base/nfs/dir.go +++ b/base/nfs/dir.go @@ -174,6 +174,10 @@ func _dir_list(m *ice.Message, root string, name string, level int, deep bool, d } } + switch f.Name() { + case "node_modules", "pluged", "target", "trash": + continue + } if f.IsDir() && deep { _dir_list(m, root, path.Join(name, f.Name()), level+1, deep, dir_type, dir_reg, fields) } diff --git a/core/code/autogen.go b/core/code/autogen.go index 457416be..08d737f1 100644 --- a/core/code/autogen.go +++ b/core/code/autogen.go @@ -102,7 +102,7 @@ go 1.11 } func _autogen_git(m *ice.Message, arg ...string) map[string]interface{} { - return kit.Dict("Time", m.Time(), arg, + return kit.Dict("Path", kit.Path(""), "Time", m.Time(), arg, "Hash", strings.TrimSpace(m.Cmdx(cli.SYSTEM, "git", "log", "-n1", `--pretty=%H`)), "Remote", strings.TrimSpace(m.Cmdx(cli.SYSTEM, "git", "config", "remote.origin.url")), "Branch", strings.TrimSpace(m.Cmdx(cli.SYSTEM, "git", "rev-parse", "--abbrev-ref", "HEAD")), diff --git a/core/code/binpack.go b/core/code/binpack.go index 3aa74ce1..199e5e18 100644 --- a/core/code/binpack.go +++ b/core/code/binpack.go @@ -37,10 +37,6 @@ func _binpack_dir(m *ice.Message, f *os.File, dir string) { if path.Base(value[nfs.PATH]) == "binpack.go" { return } - switch strings.Split(value[nfs.PATH], ice.PS)[0] { - case "pluged", "trash": - return - } fmt.Fprintln(f, _binpack_file(m, path.Join(dir, value[nfs.PATH]))) }) fmt.Fprintln(f) @@ -130,10 +126,10 @@ func init() { fmt.Fprintln(f, `func init() {`) fmt.Fprintln(f, ` ice.Info.Pack = map[string][]byte{`) - _binpack_dir(m, f, ice.USR_LEARNING) + // _binpack_dir(m, f, ice.USR_LEARNING) _binpack_can(m, f, ice.USR_VOLCANOS) _binpack_dir(m, f, ice.USR_INTSHELL) - _binpack_dir(m, f, ice.USR_ICEBERGS) + // _binpack_dir(m, f, ice.USR_ICEBERGS) _binpack_ctx(m, f) fmt.Fprintln(f, ` }`) diff --git a/core/code/webpack.go b/core/code/webpack.go index 19042b8f..cad52ca1 100644 --- a/core/code/webpack.go +++ b/core/code/webpack.go @@ -48,12 +48,12 @@ func _webpack_cache(m *ice.Message, dir string, write bool) { m.Option(nfs.DIR_PACK, true) m.Option(nfs.DIR_TYPE, nfs.CAT) - m.Cmd(nfs.DIR, ice.SRC).Tables(func(value map[string]string) { - if kit.Ext(value[nfs.PATH]) == JS { - fmt.Fprintln(js, `_can_name = "`+path.Join("/require", ice.Info.Make.Module, value[nfs.PATH])+`"`) - fmt.Fprintln(js, m.Cmdx(nfs.CAT, value[nfs.PATH])) - } - }) + // m.Cmd(nfs.DIR, ice.SRC).Tables(func(value map[string]string) { + // if kit.Ext(value[nfs.PATH]) == JS { + // fmt.Fprintln(js, `_can_name = "`+path.Join("/require", ice.Info.Make.Module, value[nfs.PATH])+`"`) + // fmt.Fprintln(js, m.Cmdx(nfs.CAT, value[nfs.PATH])) + // } + // }) m.Option(nfs.DIR_ROOT, dir) for _, k := range []string{LIB, PANEL, PLUGIN} { diff --git a/info.go b/info.go index b9cd23c3..dceb0c5e 100644 --- a/info.go +++ b/info.go @@ -9,6 +9,7 @@ import ( ) type MakeInfo struct { + Path string Time string Hash string Module string @@ -63,10 +64,16 @@ func fileKey(dir string) string { dir = strings.Split(dir, DF)[0] dir = strings.ReplaceAll(dir, ".js", ".go") dir = strings.ReplaceAll(dir, ".sh", ".go") + if strings.Contains(dir, "go/pkg/mod") { return path.Join("/require", strings.Split(dir, "go/pkg/mod")[1]) } - dir = strings.TrimPrefix(dir, kit.Path("")+PS) + if Info.Make.Path != "" && strings.HasPrefix(dir, Info.Make.Path+PS) { + dir = strings.TrimPrefix(dir, Info.Make.Path+PS) + } + if strings.HasPrefix(dir, kit.Path("")+PS) { + dir = strings.TrimPrefix(dir, kit.Path("")+PS) + } if strings.HasPrefix(dir, SRC) { return path.Join("/require", dir) } diff --git a/init.go b/init.go index df2a4778..ed5dcdd6 100644 --- a/init.go +++ b/init.go @@ -103,6 +103,17 @@ var Pulse = &Message{ func init() { Index.root, Pulse.root = Index, Pulse } func Run(arg ...string) string { + list := []string{} + for k := range Info.File { + if strings.HasPrefix(k, Info.Make.Path+PS) { + list = append(list, k) + } + } + for _, k := range list { + Info.File["/require/"+strings.TrimPrefix(k, Info.Make.Path+PS)] = Info.File[k] + delete(Info.File, k) + } + if len(arg) == 0 { // 进程参数 if arg = append(arg, os.Args[1:]...); kit.Env("ctx_arg") != "" { arg = append(arg, kit.Split(kit.Env("ctx_arg"))...) diff --git a/misc/git/status.go b/misc/git/status.go index 9ff0b58a..77a4a576 100644 --- a/misc/git/status.go +++ b/misc/git/status.go @@ -218,7 +218,7 @@ func init() { } } }}, - CLONE: {Name: "clone repos='https://shylinux.com/x/volcanos' path=usr/volcanos", Help: "克隆", Hand: func(m *ice.Message, arg ...string) { + CLONE: {Name: "clone repos='https://shylinux.com/x/volcanos' path=", Help: "克隆", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(REPOS, mdb.CREATE) }}, PULL: {Name: "pull", Help: "下载", Hand: func(m *ice.Message, arg ...string) { diff --git a/render.go b/render.go index 6a98306e..26f47a9b 100644 --- a/render.go +++ b/render.go @@ -244,6 +244,9 @@ func (m *Message) DisplayStory(file string, arg ...interface{}) *Message { } return m.DisplayBase(file, arg...) } +func (m *Message) DisplayStoryJSON(arg ...interface{}) *Message { + return m.DisplayStory("json", arg...) +} func (m *Message) Display(file string, arg ...interface{}) *Message { m.Option(MSG_DISPLAY, kit.MergeURL(DisplayRequire(2, file)[DISPLAY], arg...)) return m