mirror of
https://shylinux.com/x/ContextOS
synced 2025-04-26 09:14:06 +08:00
kid mod cli.time
This commit is contained in:
parent
4d1f499749
commit
d37ccbf5cb
@ -321,8 +321,8 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
}
|
}
|
||||||
} // }}}
|
} // }}}
|
||||||
}},
|
}},
|
||||||
"time": &ctx.Command{Name: "time [parse format when] format when",
|
"time": &ctx.Command{Name: "time [parse when] format when",
|
||||||
Formats: map[string]int{"parse": 2},
|
Formats: map[string]int{"parse": 1},
|
||||||
Help: "睡眠, time(ns/us/ms/s/m/h): 时间值(纳秒/微秒/毫秒/秒/分钟/小时)", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
|
Help: "睡眠, time(ns/us/ms/s/m/h): 时间值(纳秒/微秒/毫秒/秒/分钟/小时)", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
|
||||||
t := time.Now() // {{{
|
t := time.Now() // {{{
|
||||||
if m.Options("parse") {
|
if m.Options("parse") {
|
||||||
@ -332,15 +332,12 @@ var Index = &ctx.Context{Name: "cli", Help: "管理中心",
|
|||||||
t = n
|
t = n
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(arg) > 1 {
|
|
||||||
n, e := strconv.Atoi(arg[1])
|
|
||||||
m.Assert(e)
|
|
||||||
t = time.Unix(int64(n), 0)
|
|
||||||
}
|
|
||||||
|
|
||||||
f := ""
|
f := ""
|
||||||
if len(arg) > 0 {
|
if len(arg) > 0 {
|
||||||
f = arg[0]
|
n, e := strconv.Atoi(arg[0])
|
||||||
|
m.Assert(e)
|
||||||
|
t = time.Unix(int64(n), 0)
|
||||||
|
f = "2006-01-02 15:04:05"
|
||||||
}
|
}
|
||||||
|
|
||||||
if f == "" {
|
if f == "" {
|
||||||
|
@ -1302,7 +1302,6 @@ func (m *Message) Exec(key string, arg ...string) string { // {{{
|
|||||||
|
|
||||||
if x, ok := s.Commands[key]; ok && x.Hand != nil && c.Check(m, "commands", key) {
|
if x, ok := s.Commands[key]; ok && x.Hand != nil && c.Check(m, "commands", key) {
|
||||||
m.AssertOne(m, true, func(m *Message) {
|
m.AssertOne(m, true, func(m *Message) {
|
||||||
fmt.Printf("fuck1-------- %v\n", m.Meta)
|
|
||||||
m.Log("cmd", s, "%d %s %v %v", len(m.target.Historys), key, arg, m.Meta["option"])
|
m.Log("cmd", s, "%d %s %v %v", len(m.target.Historys), key, arg, m.Meta["option"])
|
||||||
|
|
||||||
if x.Options != nil {
|
if x.Options != nil {
|
||||||
@ -1654,7 +1653,6 @@ var CGI = template.FuncMap{
|
|||||||
|
|
||||||
switch which := arg[1].(type) {
|
switch which := arg[1].(type) {
|
||||||
case string:
|
case string:
|
||||||
m.Log("fuck", nil, "sesss %s", which)
|
|
||||||
m.Sesss(which, arg[2:]...)
|
m.Sesss(which, arg[2:]...)
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
@ -2622,7 +2620,6 @@ var Index = &Context{Name: "ctx", Help: "模块中心",
|
|||||||
m.Target().Index = map[string]*Context{}
|
m.Target().Index = map[string]*Context{}
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("fuck3\n")
|
|
||||||
current := m.Target()
|
current := m.Target()
|
||||||
aaa := m.Sesss("aaa")
|
aaa := m.Sesss("aaa")
|
||||||
void := index["void"]
|
void := index["void"]
|
||||||
@ -2784,16 +2781,13 @@ var Index = &Context{Name: "ctx", Help: "模块中心",
|
|||||||
delete(shares, arg[2])
|
delete(shares, arg[2])
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
m.Log("fuck", nil, "wh %v", shares)
|
|
||||||
|
|
||||||
for i := 0; i < len(shares[arg[2]]); i++ {
|
for i := 0; i < len(shares[arg[2]]); i++ {
|
||||||
if shares[arg[2]][i] == arg[3] {
|
if shares[arg[2]][i] == arg[3] {
|
||||||
m.Log("fuck", nil, "====%v", arg[3])
|
|
||||||
for ; i < len(shares[arg[2]])-1; i++ {
|
for ; i < len(shares[arg[2]])-1; i++ {
|
||||||
shares[arg[2]][i] = shares[arg[2]][i+1]
|
shares[arg[2]][i] = shares[arg[2]][i+1]
|
||||||
}
|
}
|
||||||
shares[arg[2]] = shares[arg[2]][:i]
|
shares[arg[2]] = shares[arg[2]][:i]
|
||||||
m.Log("fuck", nil, "====%v", shares)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,13 +124,7 @@ func (web *WEB) generate(m *ctx.Message, uri string, arg ...string) string { //
|
|||||||
|
|
||||||
args := []string{}
|
args := []string{}
|
||||||
for i := 0; i < len(arg)-1; i += 2 {
|
for i := 0; i < len(arg)-1; i += 2 {
|
||||||
value := arg[i+1]
|
args = append(args, arg[i]+"="+url.QueryEscape(arg[i+1]))
|
||||||
if len(value) > 1 {
|
|
||||||
if value[0] == '$' {
|
|
||||||
value = m.Cap(value[1:])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
args = append(args, arg[i]+"="+url.QueryEscape(value))
|
|
||||||
}
|
}
|
||||||
p := strings.Join(args, "&")
|
p := strings.Join(args, "&")
|
||||||
|
|
||||||
@ -715,7 +709,6 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
if auth.Append("right") != "ok" {
|
if auth.Append("right") != "ok" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
m.Log("fuck", nil, "why %v", auth.Meta)
|
|
||||||
|
|
||||||
if m.Option("method") == "POST" {
|
if m.Option("method") == "POST" {
|
||||||
if m.Options("notshareto") { // 取消共享
|
if m.Options("notshareto") { // 取消共享
|
||||||
@ -725,12 +718,9 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
m.Append("link", "hello")
|
m.Append("link", "hello")
|
||||||
return
|
return
|
||||||
} else if m.Options("shareto") { //共享目录
|
} else if m.Options("shareto") { //共享目录
|
||||||
m.Log("fuck", nil, "why %v", auth.Meta)
|
|
||||||
msg := m.Spawn(m.Target()) //TODO
|
msg := m.Spawn(m.Target()) //TODO
|
||||||
msg.Sesss("aaa", a)
|
msg.Sesss("aaa", a)
|
||||||
fmt.Printf("fuck1--------\n")
|
|
||||||
msg.Cmd("right", "add", m.Option("shareto"), "command", "/upload", "file", m.Option("sharefile"))
|
msg.Cmd("right", "add", m.Option("shareto"), "command", "/upload", "file", m.Option("sharefile"))
|
||||||
fmt.Printf("fuck2---------\n")
|
|
||||||
m.Append("link", "hello")
|
m.Append("link", "hello")
|
||||||
return
|
return
|
||||||
} else if m.Options("filename") { //添加文件或目录
|
} else if m.Options("filename") { //添加文件或目录
|
||||||
@ -781,14 +771,11 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
// 解析模板
|
// 解析模板
|
||||||
render := m.Spawn(m.Target()).Put("option", "request", r).Put("option", "response", w)
|
render := m.Spawn(m.Target()).Put("option", "request", r).Put("option", "response", w)
|
||||||
|
|
||||||
m.Log("fuck", nil, "group: %v", a.Meta)
|
|
||||||
// 共享列表
|
// 共享列表
|
||||||
share := render.Sesss("share", m.Target())
|
share := render.Sesss("share", m.Target())
|
||||||
index := share.Target().Index
|
index := share.Target().Index
|
||||||
if index != nil && index[a.Append("group")] != nil {
|
if index != nil && index[a.Append("group")] != nil {
|
||||||
m.Log("fuck", nil, "group: %v", index)
|
|
||||||
for k, v := range index[a.Append("group")].Index {
|
for k, v := range index[a.Append("group")].Index {
|
||||||
m.Log("fuck", nil, "group: %v", a.Meta)
|
|
||||||
for i, j := range v.Commands {
|
for i, j := range v.Commands {
|
||||||
for v, n := range j.Shares {
|
for v, n := range j.Shares {
|
||||||
for _, nn := range n {
|
for _, nn := range n {
|
||||||
@ -927,7 +914,7 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
|||||||
}
|
}
|
||||||
|
|
||||||
sessid := ""
|
sessid := ""
|
||||||
if m.Options("password") {
|
if m.Options("username") && m.Options("password") {
|
||||||
msg := m.Find("aaa").Cmd("login", m.Option("username"), m.Option("password"))
|
msg := m.Find("aaa").Cmd("login", m.Option("username"), m.Option("password"))
|
||||||
sessid = msg.Result(0)
|
sessid = msg.Result(0)
|
||||||
http.SetCookie(w, &http.Cookie{Name: "sessid", Value: sessid})
|
http.SetCookie(w, &http.Cookie{Name: "sessid", Value: sessid})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user