From 18b14bf393a0ea2ece680e6998327696774f8d10 Mon Sep 17 00:00:00 2001 From: shaoying Date: Tue, 27 Dec 2022 11:52:08 +0800 Subject: [PATCH] opt some --- core/code/binpack.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/core/code/binpack.go b/core/code/binpack.go index 72592c96..e288f3e9 100644 --- a/core/code/binpack.go +++ b/core/code/binpack.go @@ -73,15 +73,6 @@ func _binpack_all(m *ice.Message) { _binpack_file(m, w, ice.MAKEFILE) _binpack_file(m, w, ice.README_MD) fmt.Fprintln(w) - mdb.HashSelects(m).Sort(nfs.PATH).Tables(func(value ice.Maps) { - if s, e := nfs.StatFile(m, value[nfs.PATH]); e == nil { - if s.IsDir() { - _binpack_dir(m, w, value[nfs.PATH]) - } else { - _binpack_file(m, w, value[nfs.PATH]) - } - } - }) list := map[string]bool{} ctx.TravelCmd(m, func(key, file, line string) { dir := path.Dir(file) @@ -92,7 +83,7 @@ func _binpack_all(m *ice.Message) { return } list[dir] = true - m.Cmd(nfs.DIR, dir, nfs.PATH, kit.Dict(nfs.DIR_ROOT, nfs.PWD, nfs.DIR_REG, `.*\.(sh|shy|js)$`)).Tables(func(value ice.Maps) { + m.Cmd(nfs.DIR, dir, nfs.PATH, kit.Dict(nfs.DIR_ROOT, nfs.PWD, nfs.DIR_REG, kit.ExtReg("(sh|shy|js)"))).Tables(func(value ice.Maps) { if list[value[nfs.PATH]] { return } @@ -102,6 +93,15 @@ func _binpack_all(m *ice.Message) { _binpack_file(m, w, value[nfs.PATH]) }) }) + mdb.HashSelects(m).Sort(nfs.PATH).Tables(func(value ice.Maps) { + if s, e := nfs.StatFile(m, value[nfs.PATH]); e == nil { + if s.IsDir() { + _binpack_dir(m, w, value[nfs.PATH]) + } else { + _binpack_file(m, w, value[nfs.PATH]) + } + } + }) } }