1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 09:34:05 +08:00
This commit is contained in:
harveyshao 2022-03-10 10:28:04 +08:00
parent d2bf427703
commit 6c91073e3d
12 changed files with 40 additions and 19 deletions

View File

@ -221,7 +221,7 @@ func init() {
arg = arg[1:] arg = arg[1:]
} }
m.Cmdy(ctx.CONFIG, RUNTIME, arg) m.Cmdy(ctx.CONFIG, RUNTIME, arg)
m.DisplayStory("json.js") m.DisplayStoryJSON()
}}, }},
}}) }})
} }

View File

@ -107,7 +107,7 @@ func init() {
} }
m.Echo(kit.Format(_split_list(m, arg[0], kit.Split(kit.Join(arg[1:]))...))) m.Echo(kit.Format(_split_list(m, arg[0], kit.Split(kit.Join(arg[1:]))...)))
m.DisplayStory("json.js") m.DisplayStoryJSON()
}}, }},
}}) }})
} }

View File

@ -27,7 +27,7 @@ func init() {
if HashSelect(m, arg...); len(arg) == 0 { if HashSelect(m, arg...); len(arg) == 0 {
m.Sort(TYPE) m.Sort(TYPE)
} else if len(arg) == 1 { } else if len(arg) == 1 {
m.DisplayStory("json.js") m.DisplayStoryJSON()
m.Echo(kit.Formats(m.Confv(m.Append(NAME), "meta.plug"))) m.Echo(kit.Formats(m.Confv(m.Append(NAME), "meta.plug")))
} }
}}, }},

View File

@ -27,7 +27,7 @@ func init() {
if HashSelect(m, arg...); len(arg) == 0 { if HashSelect(m, arg...); len(arg) == 0 {
m.Sort(TYPE) m.Sort(TYPE)
} else if len(arg) == 1 { } else if len(arg) == 1 {
m.DisplayStory("json.js") m.DisplayStoryJSON()
m.Echo(kit.Formats(m.Confv(m.Append(NAME), "meta.plug"))) m.Echo(kit.Formats(m.Confv(m.Append(NAME), "meta.plug")))
} }
}}, }},

View File

@ -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 { if f.IsDir() && deep {
_dir_list(m, root, path.Join(name, f.Name()), level+1, deep, dir_type, dir_reg, fields) _dir_list(m, root, path.Join(name, f.Name()), level+1, deep, dir_type, dir_reg, fields)
} }

View File

@ -102,7 +102,7 @@ go 1.11
} }
func _autogen_git(m *ice.Message, arg ...string) map[string]interface{} { 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`)), "Hash", strings.TrimSpace(m.Cmdx(cli.SYSTEM, "git", "log", "-n1", `--pretty=%H`)),
"Remote", strings.TrimSpace(m.Cmdx(cli.SYSTEM, "git", "config", "remote.origin.url")), "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")), "Branch", strings.TrimSpace(m.Cmdx(cli.SYSTEM, "git", "rev-parse", "--abbrev-ref", "HEAD")),

View File

@ -37,10 +37,6 @@ func _binpack_dir(m *ice.Message, f *os.File, dir string) {
if path.Base(value[nfs.PATH]) == "binpack.go" { if path.Base(value[nfs.PATH]) == "binpack.go" {
return 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, _binpack_file(m, path.Join(dir, value[nfs.PATH])))
}) })
fmt.Fprintln(f) fmt.Fprintln(f)
@ -130,10 +126,10 @@ func init() {
fmt.Fprintln(f, `func init() {`) fmt.Fprintln(f, `func init() {`)
fmt.Fprintln(f, ` ice.Info.Pack = map[string][]byte{`) 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_can(m, f, ice.USR_VOLCANOS)
_binpack_dir(m, f, ice.USR_INTSHELL) _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) _binpack_ctx(m, f)
fmt.Fprintln(f, ` }`) fmt.Fprintln(f, ` }`)

View File

@ -48,12 +48,12 @@ func _webpack_cache(m *ice.Message, dir string, write bool) {
m.Option(nfs.DIR_PACK, true) m.Option(nfs.DIR_PACK, true)
m.Option(nfs.DIR_TYPE, nfs.CAT) m.Option(nfs.DIR_TYPE, nfs.CAT)
m.Cmd(nfs.DIR, ice.SRC).Tables(func(value map[string]string) { // m.Cmd(nfs.DIR, ice.SRC).Tables(func(value map[string]string) {
if kit.Ext(value[nfs.PATH]) == JS { // 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, `_can_name = "`+path.Join("/require", ice.Info.Make.Module, value[nfs.PATH])+`"`)
fmt.Fprintln(js, m.Cmdx(nfs.CAT, value[nfs.PATH])) // fmt.Fprintln(js, m.Cmdx(nfs.CAT, value[nfs.PATH]))
} // }
}) // })
m.Option(nfs.DIR_ROOT, dir) m.Option(nfs.DIR_ROOT, dir)
for _, k := range []string{LIB, PANEL, PLUGIN} { for _, k := range []string{LIB, PANEL, PLUGIN} {

View File

@ -9,6 +9,7 @@ import (
) )
type MakeInfo struct { type MakeInfo struct {
Path string
Time string Time string
Hash string Hash string
Module string Module string
@ -63,10 +64,16 @@ func fileKey(dir string) string {
dir = strings.Split(dir, DF)[0] dir = strings.Split(dir, DF)[0]
dir = strings.ReplaceAll(dir, ".js", ".go") dir = strings.ReplaceAll(dir, ".js", ".go")
dir = strings.ReplaceAll(dir, ".sh", ".go") dir = strings.ReplaceAll(dir, ".sh", ".go")
if strings.Contains(dir, "go/pkg/mod") { if strings.Contains(dir, "go/pkg/mod") {
return path.Join("/require", strings.Split(dir, "go/pkg/mod")[1]) 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) { if strings.HasPrefix(dir, SRC) {
return path.Join("/require", dir) return path.Join("/require", dir)
} }

11
init.go
View File

@ -103,6 +103,17 @@ var Pulse = &Message{
func init() { Index.root, Pulse.root = Index, Pulse } func init() { Index.root, Pulse.root = Index, Pulse }
func Run(arg ...string) string { 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 len(arg) == 0 { // 进程参数
if arg = append(arg, os.Args[1:]...); kit.Env("ctx_arg") != "" { if arg = append(arg, os.Args[1:]...); kit.Env("ctx_arg") != "" {
arg = append(arg, kit.Split(kit.Env("ctx_arg"))...) arg = append(arg, kit.Split(kit.Env("ctx_arg"))...)

View File

@ -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) m.Cmdy(REPOS, mdb.CREATE)
}}, }},
PULL: {Name: "pull", Help: "下载", Hand: func(m *ice.Message, arg ...string) { PULL: {Name: "pull", Help: "下载", Hand: func(m *ice.Message, arg ...string) {

View File

@ -244,6 +244,9 @@ func (m *Message) DisplayStory(file string, arg ...interface{}) *Message {
} }
return m.DisplayBase(file, arg...) 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 { func (m *Message) Display(file string, arg ...interface{}) *Message {
m.Option(MSG_DISPLAY, kit.MergeURL(DisplayRequire(2, file)[DISPLAY], arg...)) m.Option(MSG_DISPLAY, kit.MergeURL(DisplayRequire(2, file)[DISPLAY], arg...))
return m return m