mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 17:44:05 +08:00
add m1
This commit is contained in:
parent
fa802eabaa
commit
d0dd7c7e68
1
conf.go
1
conf.go
@ -210,6 +210,7 @@ const ( // PROCESS
|
|||||||
)
|
)
|
||||||
const ( // Err
|
const ( // Err
|
||||||
ErrWarn = "warn: "
|
ErrWarn = "warn: "
|
||||||
|
ErrPanic = "panic: "
|
||||||
ErrExists = "exists: "
|
ErrExists = "exists: "
|
||||||
ErrExpire = "expire: "
|
ErrExpire = "expire: "
|
||||||
ErrTimeout = "timeout: "
|
ErrTimeout = "timeout: "
|
||||||
|
6
exec.go
6
exec.go
@ -40,13 +40,15 @@ func (m *Message) Assert(expr interface{}) bool {
|
|||||||
case nil:
|
case nil:
|
||||||
return true
|
return true
|
||||||
case error:
|
case error:
|
||||||
panic(expr)
|
|
||||||
case bool:
|
case bool:
|
||||||
if expr == true {
|
if expr == true {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
expr = errors.New(kit.Format("error: %v", expr))
|
||||||
}
|
}
|
||||||
panic(errors.New(kit.Format("error: %v", expr)))
|
m.Result(ErrPanic, expr)
|
||||||
|
panic(expr)
|
||||||
}
|
}
|
||||||
func (m *Message) Sleep(d string) *Message {
|
func (m *Message) Sleep(d string) *Message {
|
||||||
m.Debug("sleep %s %s", d, kit.FileLine(2, 3))
|
m.Debug("sleep %s %s", d, kit.FileLine(2, 3))
|
||||||
|
1
init.go
1
init.go
@ -108,7 +108,6 @@ func Run(arg ...string) string {
|
|||||||
Index.root, Pulse.root = Index, Pulse
|
Index.root, Pulse.root = Index, Pulse
|
||||||
Pulse.Option(CACHE_LIMIT, "10")
|
Pulse.Option(CACHE_LIMIT, "10")
|
||||||
|
|
||||||
log.LogDisable = false
|
|
||||||
switch Index.Merge(Index).Begin(Pulse.Spawn(), arg...); kit.Select("", arg, 0) {
|
switch Index.Merge(Index).Begin(Pulse.Spawn(), arg...); kit.Select("", arg, 0) {
|
||||||
case "serve", "space":
|
case "serve", "space":
|
||||||
if log.LogDisable = false; Index.Start(Pulse, arg...) {
|
if log.LogDisable = false; Index.Start(Pulse, arg...) {
|
||||||
|
@ -170,7 +170,7 @@ func init() {
|
|||||||
CONNECT: {Name: "connect hash auto dial prunes", Help: "连接", Action: map[string]*ice.Action{
|
CONNECT: {Name: "connect hash auto dial prunes", Help: "连接", Action: map[string]*ice.Action{
|
||||||
tcp.OPEN: {Name: "open authfile username=shy password verfiy host=shylinux.com port=22 private=.ssh/id_rsa", Help: "终端", Hand: func(m *ice.Message, arg ...string) {
|
tcp.OPEN: {Name: "open authfile username=shy password verfiy host=shylinux.com port=22 private=.ssh/id_rsa", Help: "终端", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_ssh_open(m.OptionLoad(m.Option("authfile")), arg...)
|
_ssh_open(m.OptionLoad(m.Option("authfile")), arg...)
|
||||||
m.Echo("exit %v:%v\n", m.Option(tcp.HOST), m.Option(tcp.PORT))
|
m.Echo("exit %v@%v:%v\n", m.Option(aaa.USERNAME), m.Option(tcp.HOST), m.Option(tcp.PORT))
|
||||||
}},
|
}},
|
||||||
tcp.DIAL: {Name: "dial username=shy host=shylinux.com port=22 private=.ssh/id_rsa", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
tcp.DIAL: {Name: "dial username=shy host=shylinux.com port=22 private=.ssh/id_rsa", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Go(func() {
|
m.Go(func() {
|
||||||
|
@ -34,9 +34,11 @@ func (m *Message) OptionLoad(file string) *Message {
|
|||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
var data interface{}
|
var data interface{}
|
||||||
json.NewDecoder(f).Decode(&data)
|
m.Assert(json.NewDecoder(f).Decode(&data))
|
||||||
|
|
||||||
kit.Fetch(data, func(key string, value interface{}) { m.Option(key, kit.Simple(value)) })
|
kit.Fetch(data, func(key string, value interface{}) {
|
||||||
|
m.Option(key, kit.Simple(value))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user