forked from x/icebergs
opt some
This commit is contained in:
parent
c2d4cea08a
commit
73d66b7c37
@ -95,7 +95,16 @@ func _config_only(v ice.Any, arg ...string) bool {
|
||||
if len(v) > len(arg) {
|
||||
return false
|
||||
}
|
||||
for k := range v {
|
||||
for k, v := range v {
|
||||
if v, ok := v.(ice.Map); ok && len(v) == 0 {
|
||||
continue
|
||||
} else {
|
||||
for k := range v {
|
||||
if kit.IsIn(k, "important") && len(v) > 1 {
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
if kit.IndexOf(arg, k) == -1 {
|
||||
return false
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ func init() {
|
||||
KILL: {Name: "kill pid signal", Help: "结束", Hand: func(m *ice.Message, arg ...string) {
|
||||
_signal_process(m, m.Option(PID), syscall.Signal(kit.Int(kit.Select("9", m.Option(SIGNAL)))))
|
||||
}},
|
||||
}, mdb.HashAction(mdb.SHORT, SIGNAL, mdb.FIELD, "time,signal,name,cmd", mdb.ACTION, HAPPEN)), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, mdb.HashAction(mdb.SHORT, SIGNAL, mdb.FIELD, "time,signal,name,cmd", mdb.ACTION, HAPPEN), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
mdb.HashSelect(m, arg...).Sort(SIGNAL)
|
||||
}},
|
||||
})
|
||||
|
@ -131,7 +131,7 @@ func Template(m templateMessage, p string, arg ...ice.Any) string {
|
||||
return kit.Renders(kit.Format(TemplateText(m, p), arg...), m)
|
||||
}
|
||||
func TemplateText(m templateMessage, p string) string {
|
||||
return strings.TrimSpace(m.Cmdx(CAT, path.Join(m.PrefixKey(), path.Base(p)), kit.Dict(DIR_ROOT, ice.SRC_TEMPLATE)))
|
||||
return m.Cmdx(CAT, path.Join(m.PrefixKey(), path.Base(p)), kit.Dict(DIR_ROOT, ice.SRC_TEMPLATE))
|
||||
}
|
||||
func IsSourceFile(m *ice.Message, ext string) bool {
|
||||
return mdb.Conf(m, Prefix(CAT), kit.Keym(SOURCE, ext)) == ice.TRUE
|
||||
|
@ -10,6 +10,7 @@ import (
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
"shylinux.com/x/icebergs/base/lex"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
@ -47,8 +48,9 @@ func _binpack_all(m *ice.Message) {
|
||||
if w, p, e := nfs.CreateFile(m, ice.SRC_BINPACK_GO); m.Assert(e) {
|
||||
defer w.Close()
|
||||
defer m.Echo(p)
|
||||
fmt.Fprint(w, nfs.Template(m, ice.SRC_BINPACK_GO))
|
||||
defer fmt.Fprint(w, nfs.Template(m, "binpack_end.go"))
|
||||
fmt.Fprintln(w, nfs.Template(m, ice.SRC_BINPACK_GO))
|
||||
defer fmt.Fprintln(w, nfs.Template(m, "binpack_end.go"))
|
||||
defer fmt.Fprint(w, lex.TB)
|
||||
nfs.OptionFiles(m, nfs.DiskFile)
|
||||
for _, p := range []string{ice.USR_VOLCANOS, ice.USR_INTSHELL, ice.SRC} {
|
||||
_binpack_dir(m, w, p)
|
||||
|
@ -164,7 +164,7 @@ func init() {
|
||||
}
|
||||
m.Push(mdb.TEXT, strings.Join(text, ", "))
|
||||
}},
|
||||
}, gdb.EventAction(web.DREAM_TABLES), aaa.RoleAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, gdb.EventAction(web.DREAM_TABLES), aaa.RoleAction(), mdb.ImportantDataAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) > 0 && arg[0] == ctx.ACTION {
|
||||
m.Cmdy(REPOS, arg)
|
||||
} else if config, err := config.LoadConfig(config.GlobalScope); err == nil && config.User.Email == "" && mdb.Config(m, aaa.EMAIL) == "" {
|
||||
|
Loading…
x
Reference in New Issue
Block a user