forked from x/ContextOS
tce add something
This commit is contained in:
parent
8c2e41aeb9
commit
5a8f9566d9
2
Makefile
2
Makefile
@ -9,7 +9,7 @@ install:
|
|||||||
@cp etc/shy.vim ~/.vim/syntax/
|
@cp etc/shy.vim ~/.vim/syntax/
|
||||||
@touch etc/local.shy
|
@touch etc/local.shy
|
||||||
go install $(BENCH)
|
go install $(BENCH)
|
||||||
@[ `uname` = "Darwin" ] && md5 `which bench`
|
# @[ `uname` = "Darwin" ] && md5 `which bench`
|
||||||
@date
|
@date
|
||||||
|
|
||||||
build:
|
build:
|
||||||
|
@ -138,6 +138,12 @@ func (cli *CLI) Start(m *ctx.Message, arg ...string) bool { // {{{
|
|||||||
m.Options("scan_end", false)
|
m.Options("scan_end", false)
|
||||||
m.Optionv("ps_target", cli.target)
|
m.Optionv("ps_target", cli.target)
|
||||||
m.Option("prompt", m.Conf("prompt"))
|
m.Option("prompt", m.Conf("prompt"))
|
||||||
|
m.Options("init.shy", false)
|
||||||
|
if arg[1] == "stdio" {
|
||||||
|
if _, e := os.Stat(m.Conf("init.shy")); e == nil {
|
||||||
|
m.Options("init.shy", true)
|
||||||
|
}
|
||||||
|
}
|
||||||
m.Cap("stream", m.Spawn(yac.Target()).Call(func(cmd *ctx.Message) *ctx.Message {
|
m.Cap("stream", m.Spawn(yac.Target()).Call(func(cmd *ctx.Message) *ctx.Message {
|
||||||
if !m.Caps("parse") {
|
if !m.Caps("parse") {
|
||||||
switch cmd.Detail(0) {
|
switch cmd.Detail(0) {
|
||||||
@ -161,14 +167,9 @@ func (cli *CLI) Start(m *ctx.Message, arg ...string) bool { // {{{
|
|||||||
return nil
|
return nil
|
||||||
}, "parse", arg[1]).Target().Name)
|
}, "parse", arg[1]).Target().Name)
|
||||||
|
|
||||||
if arg[1] == "stdio" {
|
if m.Options("init.shy") {
|
||||||
if _, e := os.Stat(m.Conf("init.shy")); e == nil {
|
msg := m.Spawn().Cmd("source", m.Conf("init.shy"))
|
||||||
msg := m.Spawn().Cmd("source", m.Conf("init.shy"))
|
msg.Result(0, msg.Meta["return"])
|
||||||
msg.Result(0, msg.Meta["return"])
|
|
||||||
} else {
|
|
||||||
m.Spawn().Cmd("alias", "import", "nfs")
|
|
||||||
m.Spawn().Cmd("login", "root", "root")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -2887,5 +2887,5 @@ func Start(args ...string) {
|
|||||||
log.target.Start(log)
|
log.target.Start(log)
|
||||||
|
|
||||||
Pulse.Options("terminal_color", true)
|
Pulse.Options("terminal_color", true)
|
||||||
Pulse.Sess("cli", false).Cmd("source", "stdio", "async").Wait()
|
Pulse.Sess("cli", false).Cmd("source", "stdio").Wait()
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
|
|||||||
"show": &ctx.Command{
|
"show": &ctx.Command{
|
||||||
Name: "show table fields... [where conditions] [group fields] [order fields] [limit fields] [offset fields] [save filename] [other rest...]",
|
Name: "show table fields... [where conditions] [group fields] [order fields] [limit fields] [offset fields] [save filename] [other rest...]",
|
||||||
Help: "查询数据库, table: 表名, fields: 字段, where: 查询条件, group: 聚合字段, order: 排序字段",
|
Help: "查询数据库, table: 表名, fields: 字段, where: 查询条件, group: 聚合字段, order: 排序字段",
|
||||||
Form: map[string]int{"where": 1, "group": 1, "order": 1, "limit": 1, "offset": 1, "extras": 1, "extra_format": 1, "trans_field": 1, "trans_map": 2, "save": 1, "export": 1, "other": -1},
|
Form: map[string]int{"where": 1, "group": 1, "order": 1, "limit": 1, "offset": 1, "extras": 1, "extra_field": 1, "extra_format": 1, "trans_field": 1, "trans_map": 2, "save": 1, "export": 1, "other": -1},
|
||||||
Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
|
Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) {
|
||||||
if mdb, ok := m.Target().Server.(*MDB); m.Assert(ok) { // {{{
|
if mdb, ok := m.Target().Server.(*MDB); m.Assert(ok) { // {{{
|
||||||
table := m.Confx("table", arg, 0)
|
table := m.Confx("table", arg, 0)
|
||||||
@ -249,9 +249,7 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
|
|||||||
|
|
||||||
fields := []string{"*"}
|
fields := []string{"*"}
|
||||||
if len(arg) > 1 {
|
if len(arg) > 1 {
|
||||||
if fields = arg[1:]; m.Options("extras") {
|
fields = arg[1:]
|
||||||
fields = append(fields, "extra")
|
|
||||||
}
|
|
||||||
} else if m.Confs("field") {
|
} else if m.Confs("field") {
|
||||||
fields = []string{m.Conf("field")}
|
fields = []string{m.Conf("field")}
|
||||||
}
|
}
|
||||||
|
@ -598,26 +598,28 @@ func (nfs *NFS) Start(m *ctx.Message, arg ...string) bool { // {{{
|
|||||||
nfs.Cap("termbox", "true")
|
nfs.Cap("termbox", "true")
|
||||||
nfs.Conf("color", "true")
|
nfs.Conf("color", "true")
|
||||||
}
|
}
|
||||||
|
if !m.Options("init.shy") {
|
||||||
|
|
||||||
for _, v := range []string{
|
for _, v := range []string{
|
||||||
// "say you are so pretty",
|
// "say you are so pretty",
|
||||||
"context web serve ./ :9094",
|
"context web serve ./ :9094",
|
||||||
} {
|
} {
|
||||||
m.Back(m.Spawn(m.Source()).Set("detail", v))
|
m.Back(m.Spawn(m.Source()).Set("detail", v))
|
||||||
}
|
}
|
||||||
for _, v := range []string{
|
for _, v := range []string{
|
||||||
"say you are so pretty",
|
"say you are so pretty",
|
||||||
"context web brow 'http://localhost:9094'",
|
"context web brow 'http://localhost:9094'",
|
||||||
} {
|
} {
|
||||||
nfs.history = append(nfs.history, v)
|
nfs.history = append(nfs.history, v)
|
||||||
m.Capi("nline", 1)
|
m.Capi("nline", 1)
|
||||||
}
|
}
|
||||||
for _, v := range []string{
|
for _, v := range []string{
|
||||||
"say you are so pretty\n",
|
"say you are so pretty\n",
|
||||||
"your can brow 'http://localhost:9094'\n",
|
"your can brow 'http://localhost:9094'\n",
|
||||||
"press \"brow\" then press Enter\n",
|
"press \"brow\" then press Enter\n",
|
||||||
} {
|
} {
|
||||||
nfs.print(fmt.Sprintf(v))
|
nfs.print(fmt.Sprintf(v))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user