1
0
mirror of https://shylinux.com/x/ContextOS synced 2025-04-25 16:58:06 +08:00

fix m.Form

This commit is contained in:
shaoying 2019-07-30 17:26:15 +08:00
parent b5deaddc00
commit 3fde8557e7

View File

@ -2,6 +2,7 @@ package ctx
import ( import (
"errors" "errors"
"fmt"
"io" "io"
"strings" "strings"
"time" "time"
@ -58,7 +59,7 @@ func (c *Context) Plugin(s *Context, args []string) string {
m.Cmd(args) m.Cmd(args)
} }
for _, v := range m.Meta["result"] { for _, v := range m.Meta["result"] {
m.Show(v) fmt.Printf(v)
} }
return "" return ""
} }
@ -329,7 +330,11 @@ func (m *Message) Sess(key string, arg ...interface{}) *Message {
return nil return nil
} }
func (m *Message) Form(x *Command, arg []string) []string { func (m *Message) Form(x *Command, arg []string) []string {
for _, form := range []map[string]int{m.Optionv("ctx.form").(map[string]int), x.Form} { form, ok := m.Optionv("ctx.form").(map[string]int)
if !ok {
return arg
}
for _, form := range []map[string]int{form, x.Form} {
if args := []string{}; form != nil { if args := []string{}; form != nil {
for i := 0; i < len(arg); i++ { for i := 0; i < len(arg); i++ {