mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 09:34:05 +08:00
opt some
This commit is contained in:
parent
d2bf427703
commit
6c91073e3d
@ -221,7 +221,7 @@ func init() {
|
||||
arg = arg[1:]
|
||||
}
|
||||
m.Cmdy(ctx.CONFIG, RUNTIME, arg)
|
||||
m.DisplayStory("json.js")
|
||||
m.DisplayStoryJSON()
|
||||
}},
|
||||
}})
|
||||
}
|
||||
|
@ -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()
|
||||
}},
|
||||
}})
|
||||
}
|
||||
|
@ -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")))
|
||||
}
|
||||
}},
|
||||
|
@ -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")))
|
||||
}
|
||||
}},
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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")),
|
||||
|
@ -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, ` }`)
|
||||
|
@ -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} {
|
||||
|
9
info.go
9
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)
|
||||
}
|
||||
|
11
init.go
11
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"))...)
|
||||
|
@ -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) {
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user