diff --git a/base/log/log.go b/base/log/log.go index 1997c78f..54ea01ea 100644 --- a/base/log/log.go +++ b/base/log/log.go @@ -40,17 +40,17 @@ func (f *Frame) Start(m *ice.Message, arg ...string) bool { bio := m.Confv(FILE, kit.Keys(file, FILE)).(*bufio.Writer) bio.WriteString(l.p) - bio.WriteString(ice.MOD_SP) + bio.WriteString(ice.SP) if p, ok := view[PREFIX].(string); ok { bio.WriteString(p) } bio.WriteString(l.l) - bio.WriteString(ice.MOD_SP) + bio.WriteString(ice.SP) bio.WriteString(l.s) if p, ok := view[SUFFIX].(string); ok { bio.WriteString(p) } - bio.WriteString(ice.MOD_NL) + bio.WriteString(ice.NL) bio.Flush() } } diff --git a/base/nfs/dir.go b/base/nfs/dir.go index 6f411b23..95ac2c44 100644 --- a/base/nfs/dir.go +++ b/base/nfs/dir.go @@ -118,7 +118,7 @@ func _dir_show(m *ice.Message, root string, name string, level int, deep bool, d m.Push(kit.MDB_HASH, kit.Select(hex.EncodeToString(h[:6]), hex.EncodeToString(h[:]), field == kit.MDB_HASH)) case ctx.ACTION: - if !f.IsDir() && !aaa.SessIsCli(m) { + if !f.IsDir() && !aaa.SessIsCli(m) && m.Option(ice.MSG_USERROLE) != aaa.VOID { m.PushButton(TRASH) } else { m.Push(field, "") diff --git a/base/ssh/scripts.go b/base/ssh/scripts.go index 95f5b050..91f5fc28 100644 --- a/base/ssh/scripts.go +++ b/base/ssh/scripts.go @@ -29,8 +29,8 @@ func Render(msg *ice.Message, cmd string, args ...interface{}) string { res := msg.Result() // 输出结果 - if fmt.Fprint(msg.O, res); !strings.HasSuffix(res, ice.MOD_NL) { - fmt.Fprint(msg.O, ice.MOD_NL) + if fmt.Fprint(msg.O, res); !strings.HasSuffix(res, ice.NL) { + fmt.Fprint(msg.O, ice.NL) } return res @@ -42,8 +42,8 @@ func Render(msg *ice.Message, cmd string, args ...interface{}) string { } // 输出结果 - if fmt.Fprint(msg.O, res); !strings.HasSuffix(res, ice.MOD_NL) { - fmt.Fprint(msg.O, ice.MOD_NL) + if fmt.Fprint(msg.O, res); !strings.HasSuffix(res, ice.NL) { + fmt.Fprint(msg.O, ice.NL) } return res } diff --git a/base/ssh/session.go b/base/ssh/session.go index 0b085e98..a984ef62 100644 --- a/base/ssh/session.go +++ b/base/ssh/session.go @@ -75,7 +75,7 @@ func init() { m.Richs(SESSION, "", m.Option(kit.MDB_HASH), func(key string, value map[string]interface{}) { if w, ok := kit.Value(value, kit.Keym(INPUT)).(io.Writer); ok { m.Grow(SESSION, kit.Keys(kit.MDB_HASH, key), kit.Dict(kit.MDB_TYPE, CMD, kit.MDB_TEXT, m.Option(CMD))) - w.Write([]byte(m.Option(CMD) + ice.MOD_NL)) + w.Write([]byte(m.Option(CMD) + ice.NL)) } }) m.ProcessRefresh("300ms") diff --git a/conf.go b/conf.go index 7cf02dca..df633b61 100644 --- a/conf.go +++ b/conf.go @@ -5,8 +5,6 @@ const ( NL = "\n" ) const ( // MOD - MOD_SP = " " - MOD_NL = "\n" MOD_DIR = 0750 MOD_FILE = 0640 diff --git a/core/code/autogen.go b/core/code/autogen.go index 1b9a23c1..ad77899d 100644 --- a/core/code/autogen.go +++ b/core/code/autogen.go @@ -48,7 +48,7 @@ go 1.11 list = append(list, line) }) - m.Cmd(nfs.SAVE, dir, strings.Join(list, ice.MOD_NL)) + m.Cmd(nfs.SAVE, dir, strings.Join(list, ice.NL)) return } func _autogen_import(m *ice.Message, main string, ctx string, mod string) (list []string) { @@ -70,7 +70,7 @@ func main() { print(ice.Run()) } } }) - m.Cmd(nfs.SAVE, main, strings.Join(list, ice.MOD_NL)) + m.Cmd(nfs.SAVE, main, strings.Join(list, ice.NL)) return } func _autogen_mod(m *ice.Message, file string) (mod string) { diff --git a/core/code/binpack.go b/core/code/binpack.go index 9406ca3e..3be93842 100644 --- a/core/code/binpack.go +++ b/core/code/binpack.go @@ -17,7 +17,7 @@ func _pack_write(o *os.File, arg ...string) { for _, v := range arg { o.WriteString(v) } - o.WriteString(ice.MOD_NL) + o.WriteString(ice.NL) } func _pack_file(m *ice.Message, file string) string { list := "" @@ -48,7 +48,7 @@ func _pack_dir(m *ice.Message, pack *os.File, dir string) { pack.WriteString(fmt.Sprintf(" \"%s\": %s,\n", path.Join(dir, value[kit.MDB_PATH]), _pack_file(m, path.Join(dir, value[kit.MDB_PATH])))) }) - pack.WriteString(ice.MOD_NL) + pack.WriteString(ice.NL) } func _pack_volcanos(m *ice.Message, pack *os.File, dir string) { @@ -65,11 +65,11 @@ func _pack_volcanos(m *ice.Message, pack *os.File, dir string) { value[kit.MDB_PATH], _pack_file(m, path.Join(dir, value[kit.MDB_PATH])))) }) } - pack.WriteString(ice.MOD_NL) + pack.WriteString(ice.NL) } func _pack_contexts(m *ice.Message, pack *os.File) { _pack_dir(m, pack, "src") - pack.WriteString(ice.MOD_NL) + pack.WriteString(ice.NL) } const BINPACK = "binpack" diff --git a/core/code/pprof.go b/core/code/pprof.go index f72a2e53..254e308e 100644 --- a/core/code/pprof.go +++ b/core/code/pprof.go @@ -68,14 +68,14 @@ func init() { msg := m.Cmd(web.SPIDE, web.SPIDE_DEV, web.SPIDE_CACHE, web.SPIDE_GET, m.Option(SERVICE), SECONDS, m.Option(SECONDS)) cmd := kit.Simple(m.Confv(PPROF, kit.Keym(PPROF)), "-text", m.Option(BINNARY), msg.Append(kit.MDB_FILE)) - res := strings.Split(m.Cmdx(cli.SYSTEM, cmd), ice.MOD_NL) + res := strings.Split(m.Cmdx(cli.SYSTEM, cmd), ice.NL) if len(res) > 20 { res = res[:20] } m.Cmd(mdb.INSERT, PPROF, "", mdb.ZONE, m.Option(kit.MDB_ZONE), - kit.MDB_TEXT, strings.Join(res, ice.MOD_NL), kit.MDB_FILE, msg.Append(kit.MDB_FILE)) - m.Echo(strings.Join(res, ice.MOD_NL)) + kit.MDB_TEXT, strings.Join(res, ice.NL), kit.MDB_FILE, msg.Append(kit.MDB_FILE)) + m.Echo(strings.Join(res, ice.NL)) m.ProcessInner() }}, web.SERVE: {Name: "serve", Help: "展示", Hand: func(m *ice.Message, arg ...string) { diff --git a/core/code/publish.go b/core/code/publish.go index 38bb6176..2c07fe63 100644 --- a/core/code/publish.go +++ b/core/code/publish.go @@ -75,7 +75,7 @@ func init() { m.Cmd(PUBLISH, mdb.CREATE, kit.MDB_FILE, ice.BIN_ICE_BIN) p := m.Option(cli.CMD_DIR, m.Conf(PUBLISH, kit.META_PATH)) - ls := strings.Split(strings.TrimSpace(m.Cmd(cli.SYSTEM, "bash", "-c", "ls |xargs file |grep executable").Append(cli.CMD_OUT)), ice.MOD_NL) + ls := strings.Split(strings.TrimSpace(m.Cmd(cli.SYSTEM, "bash", "-c", "ls |xargs file |grep executable").Append(cli.CMD_OUT)), ice.NL) for _, ls := range ls { if file := strings.TrimSpace(strings.Split(ls, ":")[0]); file != "" { if s, e := os.Stat(path.Join(p, file)); e == nil { diff --git a/core/team/count.go b/core/team/count.go index 1fa53d77..6e87dea8 100644 --- a/core/team/count.go +++ b/core/team/count.go @@ -13,9 +13,7 @@ const COUNT = "count" func init() { Index.Merge(&ice.Context{Commands: map[string]*ice.Command{ - COUNT: {Name: "count begin_time@date end_time@date auto insert", Help: "倒计时", Meta: kit.Dict( - ice.Display(COUNT), - ), Action: map[string]*ice.Action{ + COUNT: {Name: "count begin_time@date end_time@date auto insert", Help: "倒计时", Meta: kit.Dict(ice.Display(COUNT)), Action: map[string]*ice.Action{ mdb.INSERT: {Name: "insert zone type=once,step,week name text begin_time@date close_time@date", Help: "添加", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(TASK, mdb.INSERT, arg) }}, diff --git a/core/wiki/order.go b/core/wiki/order.go index fb23272d..ae137f3e 100644 --- a/core/wiki/order.go +++ b/core/wiki/order.go @@ -8,7 +8,7 @@ import ( ) func _order_show(m *ice.Message, text string, arg ...string) { - m.Optionv(kit.MDB_LIST, kit.Split(strings.TrimSpace(text), ice.MOD_NL)) + m.Optionv(kit.MDB_LIST, kit.Split(strings.TrimSpace(text), ice.NL)) _wiki_template(m, ORDER, "", text, arg...) } diff --git a/core/wiki/refer.go b/core/wiki/refer.go index 13c87f27..4c86f840 100644 --- a/core/wiki/refer.go +++ b/core/wiki/refer.go @@ -10,7 +10,7 @@ import ( func _refer_show(m *ice.Message, text string, arg ...string) { list := [][]string{} - for _, v := range kit.Split(strings.TrimSpace(text), ice.MOD_NL, ice.MOD_NL) { + for _, v := range kit.Split(strings.TrimSpace(text), ice.NL, ice.NL) { if ls := kit.Split(v); len(ls) == 1 { list = append(list, []string{path.Base(ls[0]), ls[0]}) } else { diff --git a/core/wiki/table.go b/core/wiki/table.go index 99bfc4f0..ba7c6bbf 100644 --- a/core/wiki/table.go +++ b/core/wiki/table.go @@ -9,7 +9,7 @@ import ( func _table_show(m *ice.Message, text string, arg ...string) { head, list := []string{}, [][]string{} - for i, v := range kit.Split(strings.TrimSpace(text), ice.MOD_NL) { + for i, v := range kit.Split(strings.TrimSpace(text), ice.NL) { if v = strings.ReplaceAll(v, "%", "%%"); i == 0 { head = kit.Split(v) } else { diff --git a/misc.go b/misc.go index 6208b865..f0e8ab52 100644 --- a/misc.go +++ b/misc.go @@ -427,7 +427,6 @@ func Display(file string, arg ...string) map[string]string { file = kit.Select(file+".js", file, strings.HasSuffix(file, ".js")) file = path.Join("/require/github.com/shylinux", path.Dir(ls[len(ls)-1]), file) } - // return map[string]string{kit.MDB_DISPLAY: file, kit.MDB_STYLE: kit.Select("", arg, 0)} return map[string]string{"display": file, kit.MDB_STYLE: kit.Select("", arg, 0)} } func MergeAction(list ...map[string]*Action) map[string]*Action {