diff --git a/base/web/space.go b/base/web/space.go index 1680f3e4..4a1eb537 100644 --- a/base/web/space.go +++ b/base/web/space.go @@ -163,8 +163,11 @@ func _space_handle(m *ice.Message, safe bool, name string, c *websocket.Conn) { }), SPACE, next) { break } - m.Info("what %v", m.FormatStack(1, 100)) - m.Info("what %v", m.FormatChain()) + m.Info("what %v", msg.FormatStack(1, 100)) + m.Info("what %v", msg.FormatChain()) + if msg.Option("space.noecho") == "true" { + break + } m.Sleep3s() } } diff --git a/base/web/toast.go b/base/web/toast.go index ca7e08ed..d3d53c75 100644 --- a/base/web/toast.go +++ b/base/web/toast.go @@ -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 && arg[0] == "", func() { arg[0] = toastTitle(m) }) - PushNoticeToast(m, text, arg) + PushNoticeToast(m.Spawn("space.noecho", "true"), text, arg) return m } func PushNoticeGrowXterm(m *ice.Message, title string, cmd ...ice.Any) { diff --git a/lock.go b/lock.go index c83c387d..b19f2328 100644 --- a/lock.go +++ b/lock.go @@ -28,6 +28,7 @@ func (m *Message) delete(key ...string) { defer m.lock.Lock()() for _, key := range key { delete(m._meta, key) + delete(m._data, key) } } diff --git a/meta.go b/meta.go index af29b968..0e9692b5 100644 --- a/meta.go +++ b/meta.go @@ -15,6 +15,7 @@ func (m *Message) Set(key string, arg ...string) *Message { case MSG_OPTION, MSG_APPEND: if m.FieldsIsDetail() { if len(arg) > 0 { + m.delete(arg[0]) m.setDetail(arg[0], arg[1:]...) } else { m.delete(KEY, VALUE, MSG_APPEND) @@ -52,7 +53,16 @@ func (m *Message) Set(key string, arg ...string) *Message { return m.Add(key, arg...) } 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 } func (m *Message) CutTo(key, to string) *Message { diff --git a/option.go b/option.go index 563f4073..c98460cd 100644 --- a/option.go +++ b/option.go @@ -79,7 +79,7 @@ func (m *Message) FieldsSetDetail() { } func (m *Message) FieldsIsDetail() bool { 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 { kit.If(length >= len(fields), func() { m.Option(MSG_FIELDS, FIELDS_DETAIL) }) diff --git a/type.go b/type.go index 8ffd77ae..0be7bdd3 100644 --- a/type.go +++ b/type.go @@ -401,10 +401,16 @@ func (m *Message) Design(action Any, help string, input ...Any) { m.ErrorNotImplement(input) } } - k := kit.Format(action) - if a, ok := m._cmd.Actions[k]; ok { + if k := kit.Format(action); k == LIST { + 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 - 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] }