1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-25 08:48:06 +08:00

tce add something

This commit is contained in:
shaoying 2018-07-31 22:20:44 +08:00
parent 8c2e41aeb9
commit 5a8f9566d9
5 changed files with 34 additions and 33 deletions

View File

@ -9,7 +9,7 @@ install:
@cp etc/shy.vim ~/.vim/syntax/
@touch etc/local.shy
go install $(BENCH)
@[ `uname` = "Darwin" ] && md5 `which bench`
# @[ `uname` = "Darwin" ] && md5 `which bench`
@date
build:

View File

@ -138,6 +138,12 @@ func (cli *CLI) Start(m *ctx.Message, arg ...string) bool { // {{{
m.Options("scan_end", false)
m.Optionv("ps_target", cli.target)
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 {
if !m.Caps("parse") {
switch cmd.Detail(0) {
@ -161,14 +167,9 @@ func (cli *CLI) Start(m *ctx.Message, arg ...string) bool { // {{{
return nil
}, "parse", arg[1]).Target().Name)
if arg[1] == "stdio" {
if _, e := os.Stat(m.Conf("init.shy")); e == nil {
msg := m.Spawn().Cmd("source", m.Conf("init.shy"))
msg.Result(0, msg.Meta["return"])
} else {
m.Spawn().Cmd("alias", "import", "nfs")
m.Spawn().Cmd("login", "root", "root")
}
if m.Options("init.shy") {
msg := m.Spawn().Cmd("source", m.Conf("init.shy"))
msg.Result(0, msg.Meta["return"])
}
return false
}

View File

@ -2887,5 +2887,5 @@ func Start(args ...string) {
log.target.Start(log)
Pulse.Options("terminal_color", true)
Pulse.Sess("cli", false).Cmd("source", "stdio", "async").Wait()
Pulse.Sess("cli", false).Cmd("source", "stdio").Wait()
}

View File

@ -239,7 +239,7 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
"show": &ctx.Command{
Name: "show table fields... [where conditions] [group fields] [order fields] [limit fields] [offset fields] [save filename] [other rest...]",
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) {
if mdb, ok := m.Target().Server.(*MDB); m.Assert(ok) { // {{{
table := m.Confx("table", arg, 0)
@ -249,9 +249,7 @@ var Index = &ctx.Context{Name: "mdb", Help: "数据中心",
fields := []string{"*"}
if len(arg) > 1 {
if fields = arg[1:]; m.Options("extras") {
fields = append(fields, "extra")
}
fields = arg[1:]
} else if m.Confs("field") {
fields = []string{m.Conf("field")}
}

View File

@ -598,26 +598,28 @@ func (nfs *NFS) Start(m *ctx.Message, arg ...string) bool { // {{{
nfs.Cap("termbox", "true")
nfs.Conf("color", "true")
}
if !m.Options("init.shy") {
for _, v := range []string{
// "say you are so pretty",
"context web serve ./ :9094",
} {
m.Back(m.Spawn(m.Source()).Set("detail", v))
}
for _, v := range []string{
"say you are so pretty",
"context web brow 'http://localhost:9094'",
} {
nfs.history = append(nfs.history, v)
m.Capi("nline", 1)
}
for _, v := range []string{
"say you are so pretty\n",
"your can brow 'http://localhost:9094'\n",
"press \"brow\" then press Enter\n",
} {
nfs.print(fmt.Sprintf(v))
for _, v := range []string{
// "say you are so pretty",
"context web serve ./ :9094",
} {
m.Back(m.Spawn(m.Source()).Set("detail", v))
}
for _, v := range []string{
"say you are so pretty",
"context web brow 'http://localhost:9094'",
} {
nfs.history = append(nfs.history, v)
m.Capi("nline", 1)
}
for _, v := range []string{
"say you are so pretty\n",
"your can brow 'http://localhost:9094'\n",
"press \"brow\" then press Enter\n",
} {
nfs.print(fmt.Sprintf(v))
}
}
}