forked from x/icebergs
add some
This commit is contained in:
parent
704519e336
commit
eb73841a72
@ -163,8 +163,11 @@ func _space_handle(m *ice.Message, safe bool, name string, c *websocket.Conn) {
|
|||||||
}), SPACE, next) {
|
}), SPACE, next) {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
m.Info("what %v", m.FormatStack(1, 100))
|
m.Info("what %v", msg.FormatStack(1, 100))
|
||||||
m.Info("what %v", m.FormatChain())
|
m.Info("what %v", msg.FormatChain())
|
||||||
|
if msg.Option("space.noecho") == "true" {
|
||||||
|
break
|
||||||
|
}
|
||||||
m.Sleep3s()
|
m.Sleep3s()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -123,7 +123,7 @@ func Toast(m *ice.Message, text string, arg ...ice.Any) *ice.Message { // [title
|
|||||||
}
|
}
|
||||||
kit.If(len(arg) == 0, func() { arg = append(arg, "") })
|
kit.If(len(arg) == 0, func() { arg = append(arg, "") })
|
||||||
kit.If(len(arg) > 0 && arg[0] == "", func() { arg[0] = toastTitle(m) })
|
kit.If(len(arg) > 0 && arg[0] == "", func() { arg[0] = toastTitle(m) })
|
||||||
PushNoticeToast(m, text, arg)
|
PushNoticeToast(m.Spawn("space.noecho", "true"), text, arg)
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
func PushNoticeGrowXterm(m *ice.Message, title string, cmd ...ice.Any) {
|
func PushNoticeGrowXterm(m *ice.Message, title string, cmd ...ice.Any) {
|
||||||
|
1
lock.go
1
lock.go
@ -28,6 +28,7 @@ func (m *Message) delete(key ...string) {
|
|||||||
defer m.lock.Lock()()
|
defer m.lock.Lock()()
|
||||||
for _, key := range key {
|
for _, key := range key {
|
||||||
delete(m._meta, key)
|
delete(m._meta, key)
|
||||||
|
delete(m._data, key)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
meta.go
12
meta.go
@ -15,6 +15,7 @@ func (m *Message) Set(key string, arg ...string) *Message {
|
|||||||
case MSG_OPTION, MSG_APPEND:
|
case MSG_OPTION, MSG_APPEND:
|
||||||
if m.FieldsIsDetail() {
|
if m.FieldsIsDetail() {
|
||||||
if len(arg) > 0 {
|
if len(arg) > 0 {
|
||||||
|
m.delete(arg[0])
|
||||||
m.setDetail(arg[0], arg[1:]...)
|
m.setDetail(arg[0], arg[1:]...)
|
||||||
} else {
|
} else {
|
||||||
m.delete(KEY, VALUE, MSG_APPEND)
|
m.delete(KEY, VALUE, MSG_APPEND)
|
||||||
@ -52,7 +53,16 @@ func (m *Message) Set(key string, arg ...string) *Message {
|
|||||||
return m.Add(key, arg...)
|
return m.Add(key, arg...)
|
||||||
}
|
}
|
||||||
func (m *Message) Cut(fields ...string) *Message {
|
func (m *Message) Cut(fields ...string) *Message {
|
||||||
m.value(MSG_APPEND, kit.Split(kit.Join(fields))...)
|
if m.FieldsIsDetail() {
|
||||||
|
m.Table(func(value Maps) {
|
||||||
|
m.Set(MSG_APPEND).FieldsSetDetail()
|
||||||
|
for _, k := range kit.Split(kit.Join(fields)) {
|
||||||
|
m.Push(k, value[k])
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
m.value(MSG_APPEND, kit.Split(kit.Join(fields))...)
|
||||||
|
}
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
func (m *Message) CutTo(key, to string) *Message {
|
func (m *Message) CutTo(key, to string) *Message {
|
||||||
|
@ -79,7 +79,7 @@ func (m *Message) FieldsSetDetail() {
|
|||||||
}
|
}
|
||||||
func (m *Message) FieldsIsDetail() bool {
|
func (m *Message) FieldsIsDetail() bool {
|
||||||
ls := m.value(MSG_APPEND)
|
ls := m.value(MSG_APPEND)
|
||||||
return len(ls) == 2 && ls[0] == KEY && ls[1] == VALUE || m.OptionFields() == FIELDS_DETAIL
|
return len(ls) == 2 && ls[0] == KEY && ls[1] == VALUE || len(ls) == 0 && m.OptionFields() == FIELDS_DETAIL
|
||||||
}
|
}
|
||||||
func (m *Message) Fields(length int, fields ...string) string {
|
func (m *Message) Fields(length int, fields ...string) string {
|
||||||
kit.If(length >= len(fields), func() { m.Option(MSG_FIELDS, FIELDS_DETAIL) })
|
kit.If(length >= len(fields), func() { m.Option(MSG_FIELDS, FIELDS_DETAIL) })
|
||||||
|
12
type.go
12
type.go
@ -401,10 +401,16 @@ func (m *Message) Design(action Any, help string, input ...Any) {
|
|||||||
m.ErrorNotImplement(input)
|
m.ErrorNotImplement(input)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
k := kit.Format(action)
|
if k := kit.Format(action); k == LIST {
|
||||||
if a, ok := m._cmd.Actions[k]; ok {
|
m._cmd.Meta[k], m._cmd.List = list, list
|
||||||
|
if help != "" {
|
||||||
|
kit.Value(m._cmd.Meta, kit.Keys(CTX_TRANS, k), help)
|
||||||
|
}
|
||||||
|
} else if a, ok := m._cmd.Actions[k]; ok {
|
||||||
m._cmd.Meta[k], a.List = list, list
|
m._cmd.Meta[k], a.List = list, list
|
||||||
kit.Value(m._cmd.Meta, kit.Keys(CTX_TRANS, k), help)
|
if help != "" {
|
||||||
|
kit.Value(m._cmd.Meta, kit.Keys(CTX_TRANS, k), help)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func (m *Message) Actions(key string) *Action { return m._cmd.Actions[key] }
|
func (m *Message) Actions(key string) *Action { return m._cmd.Actions[key] }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user