From 1168b9edc219795f55606fcd93a9cea3885f6026 Mon Sep 17 00:00:00 2001 From: shaoying Date: Thu, 22 Jul 2021 08:47:51 +0800 Subject: [PATCH] opt chrome --- misc/chrome/page.go | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 misc/chrome/page.go diff --git a/misc/chrome/page.go b/misc/chrome/page.go new file mode 100644 index 00000000..d4a34a85 --- /dev/null +++ b/misc/chrome/page.go @@ -0,0 +1,36 @@ +package crx + +import ( + ice "github.com/shylinux/icebergs" + "github.com/shylinux/icebergs/base/cli" + "github.com/shylinux/icebergs/base/ctx" + kit "github.com/shylinux/toolkits" +) + +const Page = "page" + +func init() { + Index.Merge(&ice.Context{ + Configs: map[string]*ice.Config{ + Page: {Name: "page", Help: "网页", Value: kit.Data()}, + }, + Commands: map[string]*ice.Command{ + "/page": {Name: "/page", Help: "网页", Action: map[string]*ice.Action{ + ctx.COMMAND: {Name: "command", Help: "命令", Hand: func(m *ice.Message, arg ...string) { + if arg[0] == "get" { + m.Option("top", "200") + m.Echo("cli.runtime") + return + } + if arg[0] == cli.RUN { + m.Cmdy(arg[1:]) + return + } + m.Cmdy(ctx.COMMAND, arg) + }}, + }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + + }}, + }, + }) +}