From 5bf100d3600b2568cfe45fbd5f6cd65933ab3b42 Mon Sep 17 00:00:00 2001 From: shaoying Date: Sun, 8 Aug 2021 23:17:21 +0800 Subject: [PATCH] opt chat --- misc/bash/config.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 misc/bash/config.go diff --git a/misc/bash/config.go b/misc/bash/config.go new file mode 100644 index 00000000..3cba4695 --- /dev/null +++ b/misc/bash/config.go @@ -0,0 +1,21 @@ +package bash + +import ( + "strings" + + ice "github.com/shylinux/icebergs" + kit "github.com/shylinux/toolkits" +) + +func init() { + Index.Merge(&ice.Context{Commands: map[string]*ice.Command{ + "/config": {Name: "/config", Help: "配置", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + m.Cmd("web.code.git.config").Table(func(index int, value map[string]string, head []string) { + if strings.HasPrefix(value[kit.MDB_NAME], "url") { + m.Echo(`git config --global "%s" "%s"`, value[kit.MDB_NAME], value[kit.MDB_VALUE]) + m.Echo(ice.NL) + } + }) + }}, + }}) +}