From 7269f25c77c77c07a068bf70a96114ed8131a213 Mon Sep 17 00:00:00 2001 From: shylinux Date: Fri, 12 Jun 2020 10:54:14 +0800 Subject: [PATCH] add input --- core/team/team.go | 6 ++++++ core/team/work.go | 36 +++++++++++++++++++++++++++++++----- 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/core/team/team.go b/core/team/team.go index 71dc2833..204803c6 100644 --- a/core/team/team.go +++ b/core/team/team.go @@ -197,6 +197,9 @@ func _task_plugin(m *ice.Message, arg ...string) { } m.Cmdy(kit.Keys(arg[0], arg[1]), arg[2:]) } +func _task_input(m *ice.Message, key, value string) { + m.Cmdy(kit.Keys(m.Option("zone"), m.Option("type")), "action", "input", key, value) +} var Index = &ice.Context{Name: "team", Help: "团队中心", Configs: map[string]*ice.Config{ @@ -237,6 +240,9 @@ var Index = &ice.Context{Name: "team", Help: "团队中心", "plugin": {Name: "plugin", Help: "插件", Hand: func(m *ice.Message, arg ...string) { _task_plugin(m, arg...) }}, + "input": {Name: "input", Help: "补全", Hand: func(m *ice.Message, arg ...string) { + _task_input(m, arg[0], arg[1]) + }}, }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { begin_time := time.Now() if len(arg) > 1 { diff --git a/core/team/work.go b/core/team/work.go index fe9b8b3f..1884b1a0 100644 --- a/core/team/work.go +++ b/core/team/work.go @@ -5,6 +5,20 @@ import ( "github.com/shylinux/icebergs/base/web" ) +func _work_input(m *ice.Message, key, value string) { + switch key { + case "name": + m.Push(key, "volcanos") + m.Push(key, "icebergs") + m.Push(key, "intshell") + m.Push(key, "contexts") + m.Push(key, "toolkits") + m.Push(key, "learning") + case "text": + m.Push(key, "volcanos") + m.Push(key, "icebergs") + } +} func init() { Index.Register(&ice.Context{Name: "工作", Help: "工作", Commands: map[string]*ice.Command{ @@ -19,12 +33,24 @@ func init() { Index.Register(&ice.Context{Name: "创业", Help: "创业", Commands: map[string]*ice.Command{ - "项目调研": {Name: "项目调研", Help: "项目调研", Hand: func(m *ice.Message, c *ice.Context, key string, arg ...string) { + "项目调研": {Name: "项目调研", Help: "项目调研", + Action: map[string]*ice.Action{ + "input": {Name: "input", Help: "补全", Hand: func(m *ice.Message, arg ...string) { + _work_input(m, arg[0], arg[1]) + }}, + }, + Hand: func(m *ice.Message, c *ice.Context, key string, arg ...string) { - }}, - "项目开发": {Name: "项目开发", Help: "项目开发", Hand: func(m *ice.Message, c *ice.Context, key string, arg ...string) { - m.Echo("hello world") - }}, + }}, + "项目开发": {Name: "项目开发", Help: "项目开发", + Action: map[string]*ice.Action{ + "input": {Name: "input", Help: "补全", Hand: func(m *ice.Message, arg ...string) { + _work_input(m, arg[0], arg[1]) + }}, + }, + Hand: func(m *ice.Message, c *ice.Context, key string, arg ...string) { + m.Echo("hello world") + }}, "项目测试": {Name: "项目测试", Help: "项目测试", Hand: func(m *ice.Message, c *ice.Context, key string, arg ...string) { }},