1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 01:24:05 +08:00
This commit is contained in:
harveyshao 2022-11-27 01:34:03 +08:00
parent 12e35976ee
commit 20a3aa3d84
5 changed files with 19 additions and 23 deletions

View File

@ -124,4 +124,4 @@ var Index = &ice.Context{Name: LOG, Help: "日志模块", Configs: ice.Configs{
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {}},
}}
func init() { ice.Index.Register(Index, &Frame{}) }
func init() { ice.Index.Register(Index, &Frame{}, TAIL) }

View File

@ -1,4 +1,4 @@
package nfs
package log
import (
"bufio"
@ -6,13 +6,14 @@ import (
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
kit "shylinux.com/x/toolkits"
)
func _tail_create(m *ice.Message, arg ...string) {
h := mdb.HashCreate(m, arg)
kit.Fetch(kit.Split(m.Option(FILE)), func(file string) {
m.Options("cmd_output", Pipe(m, func(text string) { mdb.ZoneInsert(m, h, FILE, file, SIZE, len(text), mdb.TEXT, text) }), mdb.CACHE_CLEAR_ON_EXIT, ice.TRUE)
m.Options("cmd_output", Pipe(m, func(text string) { mdb.ZoneInsert(m, h, FILE, file, nfs.SIZE, len(text), mdb.TEXT, text) }), mdb.CACHE_CLEAR_ON_EXIT, ice.TRUE)
m.Cmd("cli.daemon", TAIL, "-n", "0", "-f", file)
})
}
@ -32,7 +33,7 @@ func init() {
case mdb.NAME:
m.Push(arg[0], kit.Split(m.Option(FILE), ice.PS))
case FILE:
m.Cmdy(DIR, kit.Select(PWD, arg, 1), PATH).RenameAppend(PATH, FILE).ProcessAgain()
m.Cmdy(nfs.DIR, kit.Select(nfs.PWD, arg, 1), nfs.PATH).RenameAppend(nfs.PATH, FILE).ProcessAgain()
}
}},
mdb.CREATE: {Hand: func(m *ice.Message, arg ...string) { _tail_create(m, arg...) }},

View File

@ -6,4 +6,6 @@ const NFS = "nfs"
var Index = &ice.Context{Name: "nfs", Help: "存储模块"}
func init() { ice.Index.Register(Index, nil, CAT, DIR, PACK, DEFS, SAVE, PUSH, COPY, LINK, GREP, TAIL, TRASH) }
func init() {
ice.Index.Register(Index, nil, CAT, DIR, PACK, DEFS, SAVE, PUSH, COPY, LINK, GREP, TRASH)
}

View File

@ -21,6 +21,12 @@ const (
COOKIE = "cookie"
STATUS = "status"
)
const (
WEBSITE = "website"
CODE_INNER = "web.code.inner"
WIKI_WORD = "web.wiki.word"
)
func Render(m *ice.Message, cmd string, args ...ice.Any) bool {
if cmd != "" {

View File

@ -47,9 +47,6 @@ func (frame *Frame) ServeHTTP(w http.ResponseWriter, r *http.Request) {
frame.ServeMux.ServeHTTP(w, r)
}
}
func (frame *Frame) Spawn(m *ice.Message, c *ice.Context, arg ...string) ice.Server {
return &Frame{}
}
func (frame *Frame) Begin(m *ice.Message, arg ...string) ice.Server {
frame.send = ice.Messages{}
return frame
@ -107,26 +104,16 @@ func (frame *Frame) Start(m *ice.Message, arg ...string) bool {
func (frame *Frame) Close(m *ice.Message, arg ...string) bool {
return true
}
func (frame *Frame) Spawn(m *ice.Message, c *ice.Context, arg ...string) ice.Server {
return &Frame{}
}
const (
WEBSITE = "website"
CODE_INNER = "web.code.inner"
WIKI_WORD = "web.wiki.word"
)
const WEB = "web"
var Index = &ice.Context{Name: WEB, Help: "网络模块"}
func init() {
ice.Index.Register(Index, &Frame{},
BROAD, SERVE, SPACE, DREAM,
SHARE, CACHE, SPIDE, ROUTE,
)
}
func init() { ice.Index.Register(Index, &Frame{}, BROAD, SERVE, SPACE, DREAM, SHARE, CACHE, SPIDE, ROUTE) }
func ApiAction(arg ...string) ice.Actions {
return ice.Actions{kit.Select(ice.PS, arg, 0): {}}
}
func ApiAction(arg ...string) ice.Actions { return ice.Actions{kit.Select(ice.PS, arg, 0): {}} }
func P(arg ...string) string { return path.Join(ice.PS, path.Join(arg...)) }
func PP(arg ...string) string { return P(arg...) + ice.PS }