mirror of
https://shylinux.com/x/icebergs
synced 2025-04-28 18:22:02 +08:00
opt ctx.command
This commit is contained in:
parent
dec1d8ac1e
commit
192bd7cdb2
@ -86,6 +86,7 @@ var Index = &ice.Context{Name: "ctx", Help: "配置模块",
|
|||||||
m.Push("index", k)
|
m.Push("index", k)
|
||||||
m.Push("name", v.Name)
|
m.Push("name", v.Name)
|
||||||
m.Push("help", kit.Simple(v.Help)[0])
|
m.Push("help", kit.Simple(v.Help)[0])
|
||||||
|
m.Push("list", kit.Format(v.List))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
@ -104,6 +105,35 @@ var Index = &ice.Context{Name: "ctx", Help: "配置模块",
|
|||||||
m.Push("name", cmd.Name)
|
m.Push("name", cmd.Name)
|
||||||
m.Push("help", kit.Simple(cmd.Help)[0])
|
m.Push("help", kit.Simple(cmd.Help)[0])
|
||||||
m.Push("meta", kit.Format(cmd.Meta))
|
m.Push("meta", kit.Format(cmd.Meta))
|
||||||
|
if len(cmd.List) == 0 {
|
||||||
|
list := kit.Split(cmd.Name)
|
||||||
|
button := false
|
||||||
|
for i, v := range list {
|
||||||
|
if i > 0 {
|
||||||
|
ls := kit.Split(v, ":=")
|
||||||
|
switch ls[0] {
|
||||||
|
case "auto":
|
||||||
|
cmd.List = append(cmd.List, kit.List(kit.MDB_INPUT, "button", "name", "查看", "value", "auto")...)
|
||||||
|
cmd.List = append(cmd.List, kit.List(kit.MDB_INPUT, "button", "name", "返回", "value", "Last")...)
|
||||||
|
button = true
|
||||||
|
default:
|
||||||
|
if len(ls) > 1 && ls[1] == "button" {
|
||||||
|
button = true
|
||||||
|
}
|
||||||
|
cmd.List = append(cmd.List, kit.List(
|
||||||
|
kit.MDB_INPUT, kit.Select("text", ls, 1), "name", ls[0], "value", kit.Select("", ls, 2),
|
||||||
|
)...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(cmd.List) == 0 {
|
||||||
|
cmd.List = append(cmd.List, kit.List(kit.MDB_INPUT, "text", "name", "name")...)
|
||||||
|
}
|
||||||
|
if !button {
|
||||||
|
cmd.List = append(cmd.List, kit.List(kit.MDB_INPUT, "button", "name", "查看")...)
|
||||||
|
cmd.List = append(cmd.List, kit.List(kit.MDB_INPUT, "button", "name", "返回", "value", "Last")...)
|
||||||
|
}
|
||||||
|
}
|
||||||
m.Push("list", kit.Format(cmd.List))
|
m.Push("list", kit.Format(cmd.List))
|
||||||
} else {
|
} else {
|
||||||
if you := m.Option(kit.Format(kit.Value(cmd.Meta, "remote"))); you != "" {
|
if you := m.Option(kit.Format(kit.Value(cmd.Meta, "remote"))); you != "" {
|
||||||
|
@ -1768,9 +1768,7 @@ var Index = &ice.Context{Name: "web", Help: "网络模块",
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
|
|
||||||
ice.WEB_ROUTE: {Name: "route", Help: "路由", Meta: kit.Dict(
|
ice.WEB_ROUTE: {Name: "route name auto", Help: "路由", Meta: kit.Dict("detail", []string{"分组"}), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
"detail", []string{"分组"},
|
|
||||||
), List: ice.ListLook("name"), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
|
||||||
if len(arg) > 1 && arg[0] == "action" {
|
if len(arg) > 1 && arg[0] == "action" {
|
||||||
switch arg[1] {
|
switch arg[1] {
|
||||||
case "group", "分组":
|
case "group", "分组":
|
||||||
@ -1837,10 +1835,9 @@ var Index = &ice.Context{Name: "web", Help: "网络模块",
|
|||||||
|
|
||||||
m.Cmdy(ice.WEB_ROUTE, arg[0], arg[1:])
|
m.Cmdy(ice.WEB_ROUTE, arg[0], arg[1:])
|
||||||
}},
|
}},
|
||||||
ice.WEB_GROUP: {Name: "group", Help: "分组", Meta: kit.Dict(
|
ice.WEB_GROUP: {Name: "group group name auto", Help: "分组", Meta: kit.Dict(
|
||||||
"exports", []string{"grp", "group"},
|
"exports", []string{"grp", "group"}, "detail", []string{"标签", "退还"},
|
||||||
"detail", []string{"标签", "退还"},
|
), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
), List: ice.ListLook("group", "name"), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
|
||||||
if len(arg) > 1 && arg[0] == "action" {
|
if len(arg) > 1 && arg[0] == "action" {
|
||||||
switch arg[1] {
|
switch arg[1] {
|
||||||
case "label", "标签":
|
case "label", "标签":
|
||||||
@ -1920,10 +1917,9 @@ var Index = &ice.Context{Name: "web", Help: "网络模块",
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
ice.WEB_LABEL: {Name: "label", Help: "标签", Meta: kit.Dict(
|
ice.WEB_LABEL: {Name: "label label name auto", Help: "标签", Meta: kit.Dict(
|
||||||
"exports", []string{"lab", "label"},
|
"exports", []string{"lab", "label"}, "detail", []string{"归还"},
|
||||||
"detail", []string{"归还"},
|
), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
), List: ice.ListLook("label", "name"), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
|
||||||
if len(arg) > 1 && arg[0] == "action" {
|
if len(arg) > 1 && arg[0] == "action" {
|
||||||
switch arg[1] {
|
switch arg[1] {
|
||||||
case "del", "归还":
|
case "del", "归还":
|
||||||
|
@ -189,6 +189,21 @@ var Index = &ice.Context{Name: "chat", Help: "聊天中心",
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
|
|
||||||
|
"search": {Name: "search label:text=some word:text=启动流程 auto", Help: "搜索引擎", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
|
if len(arg) < 2 {
|
||||||
|
m.Cmdy(ice.WEB_LABEL, arg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
m.Cmdy(ice.WEB_LABEL, arg[0], "*", "favor", "search", arg[1:])
|
||||||
|
}},
|
||||||
|
"commend": {Name: "commend label:text=some word:text=请求响应 auto", Help: "推荐引擎", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
|
if len(arg) < 2 {
|
||||||
|
m.Cmdy(ice.WEB_LABEL, arg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
m.Cmdy(ice.WEB_LABEL, arg[0], "*", "favor", "search", arg[1:])
|
||||||
|
}},
|
||||||
|
|
||||||
"/toast": {Name: "/toast", Help: "提示", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},
|
"/toast": {Name: "/toast", Help: "提示", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},
|
||||||
"/carte": {Name: "/carte", Help: "菜单", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},
|
"/carte": {Name: "/carte", Help: "菜单", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},
|
||||||
"/tutor": {Name: "/tutor", Help: "向导", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},
|
"/tutor": {Name: "/tutor", Help: "向导", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},
|
||||||
@ -396,8 +411,10 @@ var Index = &ice.Context{Name: "chat", Help: "聊天中心",
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
|
|
||||||
"/header": {Name: "/header", Help: "菜单栏", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {}},
|
"/header": {Name: "/header", Help: "标题栏", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
"/footer": {Name: "/input", Help: "输入", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
m.Echo(m.Conf(ice.WEB_SHARE, "meta.repos"))
|
||||||
|
}},
|
||||||
|
"/footer": {Name: "/footer", Help: "状态栏", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
m.Echo(m.Conf(ice.WEB_SHARE, "meta.email"))
|
m.Echo(m.Conf(ice.WEB_SHARE, "meta.email"))
|
||||||
m.Echo(m.Conf(ice.WEB_SHARE, "meta.legal"))
|
m.Echo(m.Conf(ice.WEB_SHARE, "meta.legal"))
|
||||||
}},
|
}},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user