forked from x/icebergs
opt some
This commit is contained in:
parent
0adc958bc2
commit
0f6111bbea
@ -107,9 +107,6 @@ func (f *Frame) scan(m *ice.Message, h, line string) *Frame {
|
||||
f.ps2 = kit.Simple(mdb.Confv(m, PROMPT, kit.Keym(PS2)))
|
||||
// m.Options(MESSAGE, m, ice.LOG_DISABLE, ice.TRUE)
|
||||
m.I, m.O = f.stdin, f.stdout
|
||||
if msg := m.Cmd("serve"); msg.Append("status") == "start" {
|
||||
m.Cmd(PRINTF, kit.Dict(nfs.CONTENT, ice.NL+ice.Render(m, ice.RENDER_QRCODE, tcp.PublishLocalhost(m, kit.Format("http://localhost:%s", msg.Append(tcp.PORT))))))
|
||||
}
|
||||
ps, bio := f.ps1, bufio.NewScanner(f.stdin)
|
||||
for f.prompt(m, ps...); f.stdin != nil && bio.Scan(); f.prompt(m, ps...) {
|
||||
if len(bio.Text()) == 0 && h == STDIO {
|
||||
|
@ -17,6 +17,7 @@ import (
|
||||
"shylinux.com/x/icebergs/base/gdb"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/base/ssh"
|
||||
"shylinux.com/x/icebergs/base/tcp"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
)
|
||||
@ -191,13 +192,14 @@ func init() {
|
||||
}},
|
||||
SERVE_START: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Go(func() {
|
||||
msg := m.Spawn(kit.Dict(ice.LOG_DISABLE, ice.TRUE)).Sleep("10ms")
|
||||
msg.Cmd(ssh.PRINTF, kit.Dict(nfs.CONTENT, ice.NL+ice.Render(msg, ice.RENDER_QRCODE, tcp.PublishLocalhost(msg, kit.Format("http://localhost:%s", msg.Option(tcp.PORT))))))
|
||||
msg.Cmd(ssh.PROMPT)
|
||||
opened := false
|
||||
for i := 0; i < 3 && !opened; i++ {
|
||||
m.Sleep("1s").Cmd(SPACE, kit.Dict(ice.LOG_DISABLE, ice.TRUE), func(values ice.Maps) {
|
||||
kit.If(values[mdb.TYPE] == CHROME, func() { opened = true })
|
||||
})
|
||||
msg.Sleep("1s").Cmd(SPACE, func(values ice.Maps) { kit.If(values[mdb.TYPE] == CHROME, func() { opened = true }) })
|
||||
}
|
||||
kit.If(!opened, func() { cli.Opens(m, _serve_address(m)) })
|
||||
kit.If(!opened, func() { cli.Opens(msg, _serve_address(msg)) })
|
||||
})
|
||||
}},
|
||||
DOMAIN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
|
2
init.go
2
init.go
@ -26,7 +26,7 @@ func (s *Frame) Begin(m *Message, arg ...string) {
|
||||
func (s *Frame) Start(m *Message, arg ...string) {
|
||||
m.Cmd(INIT, arg)
|
||||
kit.For(kit.Split(kit.Select(kit.Join([]string{LOG, GDB, SSH}), os.Getenv(CTX_DAEMON))), func(k string) { m.Sleep("10ms").Start(k) })
|
||||
m.Cmd(arg)
|
||||
m.Sleep("10ms").Cmd(arg)
|
||||
}
|
||||
func (s *Frame) Close(m *Message, arg ...string) {
|
||||
list := map[*Context]*Message{m.target: m}
|
||||
|
Loading…
x
Reference in New Issue
Block a user