1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 09:34:05 +08:00
This commit is contained in:
IT 老营长 @云轩领航-创始人 2021-11-04 15:08:38 +08:00
parent fa802eabaa
commit d0dd7c7e68
5 changed files with 10 additions and 6 deletions

View File

@ -210,6 +210,7 @@ const ( // PROCESS
)
const ( // Err
ErrWarn = "warn: "
ErrPanic = "panic: "
ErrExists = "exists: "
ErrExpire = "expire: "
ErrTimeout = "timeout: "

View File

@ -40,13 +40,15 @@ func (m *Message) Assert(expr interface{}) bool {
case nil:
return true
case error:
panic(expr)
case bool:
if expr == 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 {
m.Debug("sleep %s %s", d, kit.FileLine(2, 3))

View File

@ -108,7 +108,6 @@ func Run(arg ...string) string {
Index.root, Pulse.root = Index, Pulse
Pulse.Option(CACHE_LIMIT, "10")
log.LogDisable = false
switch Index.Merge(Index).Begin(Pulse.Spawn(), arg...); kit.Select("", arg, 0) {
case "serve", "space":
if log.LogDisable = false; Index.Start(Pulse, arg...) {

View File

@ -170,7 +170,7 @@ func init() {
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) {
_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) {
m.Go(func() {

View File

@ -34,9 +34,11 @@ func (m *Message) OptionLoad(file string) *Message {
defer f.Close()
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
}