1
0
mirror of https://shylinux.com/x/icebergs synced 2025-06-27 02:37:31 +08:00
This commit is contained in:
harveyshao 2022-10-24 17:38:08 +08:00
parent f1994a0837
commit 4a63b654bd

View File

@ -1,6 +1,11 @@
package nfs package nfs
import ice "shylinux.com/x/icebergs" import (
"strings"
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/mdb"
)
const GREP = "grep" const GREP = "grep"
@ -8,7 +13,13 @@ func init() {
Index.MergeCommands(ice.Commands{ Index.MergeCommands(ice.Commands{
GREP: {Name: "grep word path auto", Help: "搜索", Hand: func(m *ice.Message, arg ...string) { GREP: {Name: "grep word path auto", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
m.Option("cmd_dir", arg[1]) m.Option("cmd_dir", arg[1])
m.Split(m.Cmdx("cli.system", GREP, "--exclude=.[a-z]*", "--exclude-dir=.[a-z]*", "-rni", arg[0], ice.PT), "file:line:text", ice.DF) for _, line := range strings.Split(m.Cmdx("cli.system", GREP, "--exclude=.[a-z]*", "--exclude-dir=.[a-z]*", "-rni", arg[0], ice.PT), ice.NL) {
if ls := strings.SplitN(line, ice.DF, 3); len(ls) > 2 {
m.Push(FILE, ls[0])
m.Push(LINE, ls[1])
m.Push(mdb.TEXT, ls[2])
}
}
}}, }},
}) })
} }