1
0
mirror of https://shylinux.com/x/icebergs synced 2025-05-03 20:07:01 +08:00
This commit is contained in:
shylinux 2021-08-10 02:25:40 +08:00
parent 5bf100d360
commit 66b6ba2276
14 changed files with 23 additions and 28 deletions

View File

@ -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()
}
}

View File

@ -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, "")

View File

@ -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
}

View File

@ -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")

View File

@ -5,8 +5,6 @@ const (
NL = "\n"
)
const ( // MOD
MOD_SP = " "
MOD_NL = "\n"
MOD_DIR = 0750
MOD_FILE = 0640

View File

@ -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) {

View File

@ -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"

View File

@ -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) {

View File

@ -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 {

View File

@ -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)
}},

View File

@ -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...)
}

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {