mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-26 09:14:06 +08:00
tce add usr/shy
This commit is contained in:
parent
6b93a52249
commit
100d49f1b2
@ -230,9 +230,11 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
m.Wait()
|
m.Wait()
|
||||||
m.Target().Close(m)
|
m.Target().Close(m)
|
||||||
if arg[0] == "stdio" {
|
if arg[0] == "stdio" {
|
||||||
|
if f, e := os.Stat(m.Conf("exit.shy")); e == nil && !f.IsDir() {
|
||||||
m.Spawn().Cmd("source", m.Conf("exit.shy"))
|
m.Spawn().Cmd("source", m.Conf("exit.shy"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}},
|
}},
|
||||||
"label": &ctx.Command{Name: "label name", Help: "记录当前脚本的位置, name: 位置名", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
|
"label": &ctx.Command{Name: "label name", Help: "记录当前脚本的位置, name: 位置名", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
|
||||||
if cli, ok := m.Target().Server.(*CLI); m.Assert(ok) { // {{{
|
if cli, ok := m.Target().Server.(*CLI); m.Assert(ok) { // {{{
|
||||||
|
@ -2950,14 +2950,23 @@ var Index = &Context{Name: "ctx", Help: "模块中心",
|
|||||||
m.Capi("list_count", 1)
|
m.Capi("list_count", 1)
|
||||||
return
|
return
|
||||||
case "list":
|
case "list":
|
||||||
|
if m.Cap("list_begin") == "" {
|
||||||
|
return
|
||||||
|
}
|
||||||
begin, end := m.Capi("list_begin"), m.Capi("list_count")
|
begin, end := m.Capi("list_begin"), m.Capi("list_count")
|
||||||
if len(arg) > 1 {
|
if len(arg) > 1 {
|
||||||
n, e := strconv.Atoi(arg[1])
|
n, e := strconv.Atoi(arg[1])
|
||||||
|
if e != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
m.Assert(e)
|
m.Assert(e)
|
||||||
begin = n
|
begin = n
|
||||||
}
|
}
|
||||||
if len(arg) > 2 {
|
if len(arg) > 2 {
|
||||||
n, e := strconv.Atoi(arg[2])
|
n, e := strconv.Atoi(arg[2])
|
||||||
|
if e != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
m.Assert(e)
|
m.Assert(e)
|
||||||
end = n
|
end = n
|
||||||
}
|
}
|
||||||
|
@ -36,9 +36,11 @@ func (log *LOG) Begin(m *ctx.Message, arg ...string) ctx.Server { // {{{
|
|||||||
|
|
||||||
// }}}
|
// }}}
|
||||||
func (log *LOG) Start(m *ctx.Message, arg ...string) bool { // {{{
|
func (log *LOG) Start(m *ctx.Message, arg ...string) bool { // {{{
|
||||||
|
if f, e := os.Stat(m.Confx("bench.log", arg, 0)); e == nil && !f.IsDir() {
|
||||||
log.nfs = m.Sess("nfs").Cmd("append", m.Confx("bench.log", arg, 0), "", "日志文件")
|
log.nfs = m.Sess("nfs").Cmd("append", m.Confx("bench.log", arg, 0), "", "日志文件")
|
||||||
log.out = log.nfs.Optionv("out").(*os.File)
|
log.out = log.nfs.Optionv("out").(*os.File)
|
||||||
fmt.Fprintln(log.out, "\n\n")
|
fmt.Fprintln(log.out, "\n\n")
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,6 +323,21 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
"argument": []interface{}{"duyu"},
|
"argument": []interface{}{"duyu"},
|
||||||
"template": "append", "title": "lark",
|
"template": "append", "title": "lark",
|
||||||
},
|
},
|
||||||
|
map[string]interface{}{
|
||||||
|
"module": "nfs", "command": "dir",
|
||||||
|
"argument": []interface{}{"dir_type", "all", "dir_deep", "false", "dir_field", "time size line filename", "sort_field", "time", "sort_order", "time_r"},
|
||||||
|
"template": "append", "title": "",
|
||||||
|
},
|
||||||
|
map[string]interface{}{
|
||||||
|
"template": "upload", "title": "upload",
|
||||||
|
},
|
||||||
|
map[string]interface{}{
|
||||||
|
"template": "create", "title": "create",
|
||||||
|
},
|
||||||
|
map[string]interface{}{
|
||||||
|
"module": "nfs", "detail": []interface{}{"pwd"},
|
||||||
|
"template": "detail", "title": "pwd",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"shy": []interface{}{
|
"shy": []interface{}{
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
@ -694,13 +709,18 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
r := m.Optionv("request").(*http.Request) // {{{
|
r := m.Optionv("request").(*http.Request) // {{{
|
||||||
w := m.Optionv("response").(http.ResponseWriter)
|
w := m.Optionv("response").(http.ResponseWriter)
|
||||||
|
|
||||||
|
if login := m.Spawn().Cmd("/login"); login.Has("template") {
|
||||||
|
m.Echo("no").Copy(login, "append")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
m.Option("username", m.Append("username"))
|
||||||
|
|
||||||
//权限检查
|
//权限检查
|
||||||
dir := m.Option("dir", path.Join(m.Cap("directory"), m.Option("dir", strings.TrimPrefix(m.Option("path"), "/index"))))
|
dir := m.Option("dir", path.Join(m.Cap("directory"), m.Option("username"), m.Option("dir", strings.TrimPrefix(m.Option("path"), "/index"))))
|
||||||
if check := m.Spawn(c).Cmd("/check", "command", "/index/", "dir", dir); !check.Results(0) {
|
if check := m.Spawn(c).Cmd("/check", "command", "/index/", "dir", dir); !check.Results(0) {
|
||||||
m.Copy(check, "append")
|
m.Copy(check, "append")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
m.Option("username", m.Append("username"))
|
|
||||||
|
|
||||||
//执行命令
|
//执行命令
|
||||||
if m.Has("details") {
|
if m.Has("details") {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user