1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 09:34:05 +08:00

opt inner

This commit is contained in:
shaoying 2020-10-20 09:59:11 +08:00
parent 15b0a20563
commit beb3482c66
3 changed files with 8 additions and 5 deletions

View File

@ -27,7 +27,7 @@ func _go_tags(m *ice.Message, key string) {
ls := strings.Split(key, ".") ls := strings.Split(key, ".")
key = ls[len(ls)-1] key = ls[len(ls)-1]
if _, e := os.Stat(path.Join(m.Option("_path"), ".tags")); e != nil { if _, e := os.Stat(path.Join(m.Option(cli.CMD_DIR), ".tags")); e != nil {
m.Cmd(cli.SYSTEM, "gotags", "-R", "-f", ".tags", "./") m.Cmd(cli.SYSTEM, "gotags", "-R", "-f", ".tags", "./")
} }
for _, l := range strings.Split(m.Cmdx(cli.SYSTEM, "grep", "^"+key+"\\>", ".tags"), "\n") { for _, l := range strings.Split(m.Cmdx(cli.SYSTEM, "grep", "^"+key+"\\>", ".tags"), "\n") {
@ -42,7 +42,7 @@ func _go_tags(m *ice.Message, key string) {
text := strings.TrimSuffix(strings.TrimPrefix(ls[0], "/^"), "$/") text := strings.TrimSuffix(strings.TrimPrefix(ls[0], "/^"), "$/")
line := kit.Int(text) line := kit.Int(text)
p := path.Join(m.Option("_path"), file) p := path.Join(m.Option(cli.CMD_DIR), file)
f, e := os.Open(p) f, e := os.Open(p)
m.Assert(e) m.Assert(e)
bio := bufio.NewScanner(f) bio := bufio.NewScanner(f)
@ -130,7 +130,7 @@ func init() {
if arg[0] == kit.MDB_FOREACH { if arg[0] == kit.MDB_FOREACH {
return return
} }
m.Option(cli.CMD_DIR, m.Option("_path")) m.Option(cli.CMD_DIR, kit.Select("src", arg, 2))
_go_find(m, kit.Select("main", arg, 1)) _go_find(m, kit.Select("main", arg, 1))
_go_tags(m, kit.Select("main", arg, 1)) _go_tags(m, kit.Select("main", arg, 1))
_go_help(m, kit.Select("main", arg, 1)) _go_help(m, kit.Select("main", arg, 1))

View File

@ -80,6 +80,9 @@ func init() {
FAVOR: {Name: "favor", Help: "收藏", Hand: func(m *ice.Message, arg ...string) { FAVOR: {Name: "favor", Help: "收藏", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(FAVOR, mdb.INSERT, arg) m.Cmdy(FAVOR, mdb.INSERT, arg)
}}, }},
nfs.DIR: {Name: "dir", Help: "目录", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(nfs.DIR, arg)
}},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { }, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if len(arg) < 2 { if len(arg) < 2 {
m.Cmdy(nfs.DIR, kit.Select("./", arg, 0)) m.Cmdy(nfs.DIR, kit.Select("./", arg, 0))

View File

@ -28,9 +28,9 @@ func init() {
Index.Merge(&ice.Context{ Index.Merge(&ice.Context{
Configs: map[string]*ice.Config{}, Configs: map[string]*ice.Config{},
Commands: map[string]*ice.Command{ Commands: map[string]*ice.Command{
VIMER: {Name: "vimer path=usr/demo file=hi.sh line=1 刷新:button=auto save project", Help: "编辑器", Meta: kit.Dict( VIMER: {Name: "vimer path=usr/demo file=hi.sh line=1 刷新:button=auto save project search", Help: "编辑器", Meta: kit.Dict(
"display", "/plugin/local/code/vimer.js", "style", "editor", "display", "/plugin/local/code/vimer.js", "style", "editor",
"trans", kit.Dict("project", "项目"), "trans", kit.Dict("project", "项目", "search", "搜索"),
), Action: map[string]*ice.Action{ ), Action: map[string]*ice.Action{
web.UPLOAD: {Name: "upload", Help: "上传", Hand: func(m *ice.Message, arg ...string) { web.UPLOAD: {Name: "upload", Help: "上传", Hand: func(m *ice.Message, arg ...string) {
_vimer_upload(m, m.Option(kit.MDB_PATH)) _vimer_upload(m, m.Option(kit.MDB_PATH))