mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-25 16:58:06 +08:00
add dir.mime
This commit is contained in:
parent
8e9999016b
commit
45a8e7fc00
@ -7,5 +7,5 @@ var version = struct {
|
||||
self int
|
||||
}{
|
||||
[]string{"2017-11-01 01:02:03", "2019-07-13 18:02:21"},
|
||||
`2019-10-24 09:49:55`, `mac`, 653,
|
||||
`2019-10-24 16:28:20`, `centos`, 642,
|
||||
}
|
||||
|
@ -96,10 +96,14 @@ func (log *LOG) Start(m *ctx.Message, arg ...string) bool {
|
||||
font := m.Conf("output", []string{"font", kit.Select("", value, 1)})
|
||||
meta := msg.Format(m.Confv("output", []string{"meta", kit.Select("short", value, 2)}).([]interface{})...)
|
||||
|
||||
// 输出日志
|
||||
fmt.Fprintln(file, fmt.Sprintf("%d %s %s%s %s%s", m.Capi("nout", 1), meta, font,
|
||||
str := fmt.Sprintf("%d %s %s%s %s%s", m.Capi("nout", 1), meta, font,
|
||||
kit.Format(l["action"]), fmt.Sprintf(kit.Format(l["str"]), l["arg"].([]interface{})...),
|
||||
kit.Select("", "\033[0m", font != "")))
|
||||
kit.Select("", "\033[0m", font != ""))
|
||||
|
||||
// 输出日志
|
||||
if fmt.Fprintln(file, str); m.Confs("output", []string{"stdio", value[0]}) {
|
||||
fmt.Println(str)
|
||||
}
|
||||
break loop
|
||||
}
|
||||
}
|
||||
@ -121,6 +125,9 @@ var Index = &ctx.Context{Name: "log", Help: "日志中心",
|
||||
"logdir": &ctx.Config{Name: "logdir", Value: "var/log", Help: "日志目录"},
|
||||
|
||||
"output": &ctx.Config{Name: "output", Value: map[string]interface{}{
|
||||
"stdio": map[string]interface{}{
|
||||
"bench": false,
|
||||
},
|
||||
"file": map[string]interface{}{
|
||||
"debug": "debug.log",
|
||||
"bench": "bench.log",
|
||||
|
@ -561,6 +561,17 @@ var Index = &ctx.Context{Name: "nfs", Help: "存储中心",
|
||||
"type": "both",
|
||||
"temp": "var/tmp/file",
|
||||
"trash": "var/tmp/trash",
|
||||
"mime": map[string]interface{}{
|
||||
"js": "txt",
|
||||
"css": "txt",
|
||||
"html": "txt",
|
||||
"shy": "txt",
|
||||
"py": "txt",
|
||||
"go": "txt",
|
||||
"h": "txt",
|
||||
"c": "txt",
|
||||
"gz": "bin",
|
||||
},
|
||||
}, Help: "目录管理"},
|
||||
"pwd": &ctx.Config{Name: "pwd", Value: []interface{}{
|
||||
"", "usr/local", "usr", "var", "bin", "etc", "src", "src/plugin",
|
||||
@ -637,6 +648,8 @@ var Index = &ctx.Context{Name: "nfs", Help: "存储中心",
|
||||
return sed(m, arg[0], args)
|
||||
}
|
||||
|
||||
mime := m.Conf("dir", []string{"mime", strings.TrimPrefix(path.Ext(arg[0]), ".")})
|
||||
|
||||
skip, find := false, false
|
||||
m.Confm("pwd", func(index int, value string) bool {
|
||||
p := kit.Select("./", path.Join(value, arg[0]))
|
||||
@ -649,7 +662,7 @@ var Index = &ctx.Context{Name: "nfs", Help: "存储中心",
|
||||
dir(m, kit.Pwd(), p, 0, kit.Right(m.Has("dir_deep")),
|
||||
dir_type, rg, fields, m.Conf("time", "format"))
|
||||
|
||||
} else if s.Size() > int64(m.Confi("buf", "size")) {
|
||||
} else if mime != "txt" && (mime == "bin" || s.Size() > int64(m.Confi("buf", "size"))) {
|
||||
m.Append("directory", p)
|
||||
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user