forked from x/ContextOS
tce mod some
This commit is contained in:
parent
29430ae745
commit
5f7d55da1a
15
Makefile
15
Makefile
@ -6,16 +6,17 @@ install:
|
||||
@go get github.com/nsf/termbox-go
|
||||
@go get github.com/skip2/go-qrcode
|
||||
@go get github.com/gomarkdown/markdown
|
||||
@touch etc/local.shy
|
||||
@touch etc/local_exit.shy
|
||||
@touch etc/init.shy
|
||||
@touch etc/exit.shy
|
||||
@touch etc/login.txt
|
||||
@touch etc/history.txt
|
||||
go install $(BENCH)
|
||||
# @[ `uname` = "Darwin" ] && md5 `which bench`
|
||||
@date
|
||||
|
||||
install_all: install
|
||||
touch etc/local.shy
|
||||
touch etc/local_exit.shy
|
||||
touch etc/init.shy
|
||||
touch etc/exit.shy
|
||||
touch etc/login.txt
|
||||
touch etc/history.txt
|
||||
|
||||
build:
|
||||
go build $(BENCH)
|
||||
|
||||
|
@ -17,31 +17,33 @@ syn keyword shStatement if else elif end for
|
||||
syn keyword shStatement let var
|
||||
|
||||
" ctx command
|
||||
syn match shStatement "\(^\|\t\|$(\)cache"
|
||||
syn match shStatement "\(^\|\t\|$(\)config"
|
||||
syn match shStatement "\(^\|\t\|$(\)detail"
|
||||
syn match shStatement "\(^\|\t\|$(\)option"
|
||||
syn match shStatement "\(^\|\t\|$(\)append"
|
||||
syn match shStatement "\(^\|\t\|$(\)result"
|
||||
syn match shStatement "\(^\|\t\|$(\|\ \ \)cache"
|
||||
syn match shStatement "\(^\|\t\|$(\|\ \ \)config"
|
||||
|
||||
syn match shStatement "\(^\|\t\|$(\|\ \ \)detail"
|
||||
syn match shStatement "\(^\|\t\|$(\|\ \ \)option"
|
||||
syn match shStatement "\(^\|\t\|$(\|\ \ \)append"
|
||||
syn match shStatement "\(^\|\t\|$(\|\ \ \)result"
|
||||
|
||||
" ctx command
|
||||
syn match shCommand "\(^\|\t\|$(\)message"
|
||||
syn match shCommand "\(^\|\t\|$(\)session"
|
||||
syn match shCommand "\(^\|\t\|$(\)context"
|
||||
syn match shCommand "\(^\|\t\|$(\)server"
|
||||
syn match shCommand "\(^\|\t\|$(\)command"
|
||||
syn match shCommand "\(^\|\t\|$(\)right"
|
||||
syn match shCommand "\(^\|\t\|$(\|\ \ \)command"
|
||||
syn match shCommand "\(^\|\t\|$(\|\ \ \)context"
|
||||
syn match shCommand "\(^\|\t\|$(\|\ \ \)message"
|
||||
syn match shCommand "\(^\|\t\|$(\|\ \ \)session"
|
||||
syn match shCommand "\(^\|\t\|$(\|\ \ \)server"
|
||||
syn match shCommand "\(^\|\t\|$(\|\ \ \)right"
|
||||
|
||||
" tcp command
|
||||
syn match shCommand "\(^\|\t\|$(\)listen"
|
||||
syn match shCommand "\(^\|\t\|$(\|\ \ \)listen"
|
||||
|
||||
" web command
|
||||
syn match shCommand "\(^\|\t\|$(\)serve"
|
||||
syn match shCommand "\(^\|\t\|$(\)route"
|
||||
syn match shCommand "\(^\|\t\|$(\|\ \ \)client"
|
||||
syn match shCommand "\(^\|\t\|$(\|\ \ \)serve\$"
|
||||
syn match shCommand "\(^\|\t\|$(\|\ \ \)route"
|
||||
|
||||
syn match shCommand "\(^\|\t\|$(\)open"
|
||||
syn match shCommand "\(^\|\t\|$(\)cookie"
|
||||
syn match shCommand "\(^\|\t\|$(\)login"
|
||||
syn match shCommand "\(^\|\t\|$(\|\ \ \)open"
|
||||
syn match shCommand "\(^\|\t\|$(\|\ \ \)cookie"
|
||||
syn match shCommand "\(^\|\t\|$(\|\ \ \)login"
|
||||
|
||||
hi def link shComment Comment
|
||||
hi def link shString String
|
||||
|
@ -773,16 +773,16 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
||||
if k == "" {
|
||||
continue
|
||||
}
|
||||
fields[k] = true
|
||||
if len(fields) == 1 {
|
||||
if fields[k] = true; len(fields) == 1 {
|
||||
m.Meta["append"] = append(m.Meta["append"], "index")
|
||||
}
|
||||
m.Meta["append"] = append(m.Meta["append"], k)
|
||||
}
|
||||
|
||||
if len(fields) > 0 {
|
||||
|
||||
switch ret := result.(type) {
|
||||
case map[string]interface{}:
|
||||
m.Log("fuck", "fuck %v", ret)
|
||||
m.Append("index", "0")
|
||||
for k, v := range ret {
|
||||
switch value := v.(type) {
|
||||
@ -796,8 +796,6 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
||||
}
|
||||
}
|
||||
}
|
||||
m.Table()
|
||||
return
|
||||
case []interface{}:
|
||||
for i, r := range ret {
|
||||
m.Add("append", "index", i)
|
||||
@ -810,7 +808,7 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
||||
}
|
||||
case float64:
|
||||
if _, ok := fields[k]; len(fields) == 0 || ok {
|
||||
m.Add("append", k, fmt.Sprintf("%v", value))
|
||||
m.Add("append", k, fmt.Sprintf("%d", int64(value)))
|
||||
}
|
||||
case bool:
|
||||
if _, ok := fields[k]; len(fields) == 0 || ok {
|
||||
@ -839,16 +837,14 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
||||
for i, _ := range ret {
|
||||
m.Add("append", "index", i)
|
||||
}
|
||||
m.Table()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result := string(buf)
|
||||
m.Echo("%s", result)
|
||||
// m.Append("response", result)
|
||||
if m.Table(); len(m.Meta["append"]) == 0 {
|
||||
m.Echo("%s", string(buf))
|
||||
}
|
||||
} // }}}
|
||||
|
||||
}},
|
||||
"post": &ctx.Command{Name: "post", Help: "访问服务",
|
||||
Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
|
||||
@ -1597,9 +1593,7 @@ var Index = &ctx.Context{Name: "web", Help: "应用中心",
|
||||
var data WXMsg
|
||||
|
||||
b, e := ioutil.ReadAll(r.Body)
|
||||
m.Log("fuck", "b: %v", string(b))
|
||||
e = xml.Unmarshal(b, &data)
|
||||
m.Log("fuck", "b: %#v", data)
|
||||
|
||||
// de := xml.NewDecoder(r.Body)
|
||||
// e := de.Decode(&data)
|
||||
|
Loading…
x
Reference in New Issue
Block a user