From 2d792e36078945c0d6de25d26be8cad8f53bc566 Mon Sep 17 00:00:00 2001 From: shylinux Date: Tue, 16 Apr 2019 09:43:32 +0800 Subject: [PATCH] add schedule --- src/examples/code/code.go | 15 +++++++++++++++ usr/template/code/code.tmpl | 1 + 2 files changed, 16 insertions(+) diff --git a/src/examples/code/code.go b/src/examples/code/code.go index 2d5ce3b4..87a2f740 100644 --- a/src/examples/code/code.go +++ b/src/examples/code/code.go @@ -203,6 +203,10 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心", }, }, }, Help: "文档管理"}, + "schedule": &ctx.Config{Name: "schedule", Value: map[string]interface{}{ + "data": []interface{}{}, + "maps": map[string]interface{}{"baidu": "%s"}, + }, Help: "闪存"}, "upgrade": &ctx.Config{Name: "upgrade", Value: map[string]interface{}{ "system": []interface{}{"exit_shy", "common_shy", "init_shy", "bench", "boot_sh"}, @@ -374,6 +378,17 @@ var Index = &ctx.Context{Name: "code", Help: "代码中心", m.Cmdy("cli.system", "tmux", "send-keys", "-t", target, arg[3:]) return }}, + "schedule": &ctx.Command{Name: "schedule", Help: "行程安排", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) { + if len(arg) == 0 { // 会话列表 + m.Confm("schedule", "data", func(index int, value map[string]interface{}) { + m.Add("append", "destination", fmt.Sprintf(m.Conf("schedule", "maps.baidu"), value["destination"], value["destination"])) + }) + m.Table() + return + } + m.Conf("schedule", []string{"data", "-1"}, map[string]interface{}{"destination": arg[0]}) + return + }}, "update": &ctx.Command{Name: "update", Help: "更新代码", Hand: func(m *ctx.Message, c *ctx.Context, key string, arg ...string) (e error) { return diff --git a/usr/template/code/code.tmpl b/usr/template/code/code.tmpl index 761a45c1..353c47bf 100644 --- a/usr/template/code/code.tmpl +++ b/usr/template/code/code.tmpl @@ -19,6 +19,7 @@ bench_data: {{option . "bench_data"}}, } +百度 {{end}} {{define "toolkit"}}