From 5676ceaf3e31a75e6bb7fadebaa014f69484465a Mon Sep 17 00:00:00 2001 From: shylinux Date: Thu, 20 Jan 2022 09:32:21 +0800 Subject: [PATCH] opt find.go --- base/nfs/find.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 base/nfs/find.go diff --git a/base/nfs/find.go b/base/nfs/find.go new file mode 100644 index 00000000..c50f2f40 --- /dev/null +++ b/base/nfs/find.go @@ -0,0 +1,19 @@ +package nfs + +import ( + "strings" + + ice "shylinux.com/x/icebergs" +) + +const FIND = "find" + +func init() { + Index.Merge(&ice.Context{Commands: map[string]*ice.Command{ + FIND: {Name: "find path word auto", Help: "搜索", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { + for _, file := range strings.Split(m.Cmdx("cli.system", FIND, ice.PWD, "-name", arg[1]), ice.NL) { + m.Push(FILE, strings.TrimPrefix(file, ice.PWD)) + } + }}, + }}) +}