1
0
forked from x/icebergs
This commit is contained in:
harveyshao 2022-12-04 13:04:59 +08:00
parent 30fdb259c6
commit 20e53d3885
9 changed files with 79 additions and 92 deletions

View File

@ -39,18 +39,21 @@ func init() {
}) })
} }
var _release = ""
func release(m *ice.Message) string { func release(m *ice.Message) string {
osid := runtime.GOOS osid := runtime.GOOS
if osid != "linux" { if osid != "linux" {
return osid return osid
} }
m.Cmd(nfs.CAT, "/etc/os-release", kit.Dict(ice.MSG_USERROLE, aaa.ROOT), func(text string) { m.Option(nfs.CAT_CONTENT, _release)
_release = m.Cmdx(nfs.CAT, "/etc/os-release", kit.Dict(ice.MSG_USERROLE, aaa.ROOT), func(text string, _ int) string {
if ls := kit.Split(text, ice.EQ); len(ls) > 1 { if ls := kit.Split(text, ice.EQ); len(ls) > 1 {
switch ls[0] { switch ls[0] {
case "ID", "ID_LIKE": case "ID", "ID_LIKE":
osid = strings.TrimSpace(ls[1] + ice.SP + osid) osid = strings.TrimSpace(ls[1] + ice.SP + osid)
} }
} }
return text
}) })
return osid return osid
} }
@ -68,3 +71,4 @@ func insert(m *ice.Message, sys, cmd string, arg ...string) bool {
func IsAlpine(m *ice.Message, arg ...string) bool { return insert(m, ALPINE, "system apk add", arg...) } func IsAlpine(m *ice.Message, arg ...string) bool { return insert(m, ALPINE, "system apk add", arg...) }
func IsCentos(m *ice.Message, arg ...string) bool { return insert(m, CENTOS, "yum install -y", arg...) } func IsCentos(m *ice.Message, arg ...string) bool { return insert(m, CENTOS, "yum install -y", arg...) }
func IsUbuntu(m *ice.Message, arg ...string) bool { return insert(m, UBUNTU, "apt get -y", arg...) } func IsUbuntu(m *ice.Message, arg ...string) bool { return insert(m, UBUNTU, "apt get -y", arg...) }
func IsSystem(m *ice.Message, arg ...string) bool { return IsAlpine(m, arg...) || IsCentos(m, arg...) || IsUbuntu(m, arg...) }

View File

@ -99,6 +99,7 @@ func init() {
ice.Index.Register(Index, &Frame{}, BROAD, SERVE, SPACE, DREAM, SHARE, CACHE, SPIDE) ice.Index.Register(Index, &Frame{}, BROAD, SERVE, SPACE, DREAM, SHARE, CACHE, SPIDE)
} }
func ApiAction(arg ...string) ice.Actions { return ice.Actions{kit.Select(ice.PS, arg, 0): {}} } func ApiAction(arg ...string) ice.Actions { return ice.Actions{kit.Select(ice.PS, arg, 0): {}} }
func Prefix(arg ...string) string { return kit.Keys(WEB, arg) }
func P(arg ...string) string { return path.Join(ice.PS, path.Join(arg...)) } func P(arg ...string) string { return path.Join(ice.PS, path.Join(arg...)) }
func PP(arg ...string) string { return P(arg...) + ice.PS } func PP(arg ...string) string { return P(arg...) + ice.PS }

View File

@ -59,6 +59,7 @@ func _autogen_version(m *ice.Message) {
} }
m.Cmd(nfs.DEFS, ice.SRC_BINPACK_GO, `package main`+ice.NL) m.Cmd(nfs.DEFS, ice.SRC_BINPACK_GO, `package main`+ice.NL)
m.Cmd(nfs.SAVE, ice.SRC_VERSION_GO, kit.Format(_version_template, _autogen_gits(m, nfs.MODULE, _autogen_mod(m, ice.GO_MOD), tcp.HOSTNAME, ice.Info.Hostname, aaa.USERNAME, ice.Info.Username))) m.Cmd(nfs.SAVE, ice.SRC_VERSION_GO, kit.Format(_version_template, _autogen_gits(m, nfs.MODULE, _autogen_mod(m, ice.GO_MOD), tcp.HOSTNAME, ice.Info.Hostname, aaa.USERNAME, ice.Info.Username)))
m.Cmd(cli.SYSTEM, "gofmt", "-w", ice.SRC_VERSION_GO)
m.Cmdy(nfs.DIR, ice.SRC_BINPACK_GO) m.Cmdy(nfs.DIR, ice.SRC_BINPACK_GO)
m.Cmdy(nfs.DIR, ice.SRC_VERSION_GO) m.Cmdy(nfs.DIR, ice.SRC_VERSION_GO)
m.Cmdy(nfs.DIR, ice.SRC_MAIN_GO) m.Cmdy(nfs.DIR, ice.SRC_MAIN_GO)

View File

@ -20,7 +20,7 @@ func _bench_http(m *ice.Message, target string, arg ...string) {
list := []*http.Request{} list := []*http.Request{}
for _, v := range strings.Split(target, ice.NL) { for _, v := range strings.Split(target, ice.NL) {
switch ls := kit.Split(v); ls[0] { switch ls := kit.Split(v); ls[0] {
case http.MethodPost: // POST,url,file case http.MethodPost:
if f, e := nfs.OpenFile(m, ls[2]); m.Assert(e) { if f, e := nfs.OpenFile(m, ls[2]); m.Assert(e) {
defer f.Close() defer f.Close()
if req, err := http.NewRequest(http.MethodPost, ls[1], f); m.Assert(err) { if req, err := http.NewRequest(http.MethodPost, ls[1], f); m.Assert(err) {

View File

@ -2,7 +2,6 @@ package code
import ( import (
"path" "path"
"strings"
ice "shylinux.com/x/icebergs" ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/cli" "shylinux.com/x/icebergs/base/cli"
@ -13,51 +12,47 @@ import (
func _c_show(m *ice.Message, arg ...string) { TagsList(m) } func _c_show(m *ice.Message, arg ...string) { TagsList(m) }
func _c_exec(m *ice.Message, arg ...string) { func _c_exec(m *ice.Message, arg ...string) {
name := strings.TrimSuffix(arg[1], path.Ext(arg[1])) + ".bin" target := path.Join(ice.BIN, kit.TrimExt(arg[1], arg[0]))
if msg := m.Cmd(cli.SYSTEM, "gcc", "-o", name, arg[1], kit.Dict(cli.CMD_DIR, arg[2])); !cli.IsSuccess(msg) { if msg := m.Cmd(cli.SYSTEM, "gcc", "-o", target, path.Join(arg[2], arg[1])); cli.IsSuccess(msg) {
m.Cmdy(cli.SYSTEM, target).StatusTime(nfs.PATH, target)
} else {
_vimer_make(m, arg[2], msg) _vimer_make(m, arg[2], msg)
return
} }
if m.Cmdy(cli.SYSTEM, path.Join(arg[2], name)); m.Append(cli.CMD_ERR) == "" {
m.Result(m.Append(cli.CMD_OUT))
m.SetAppend()
}
m.StatusTime()
} }
func _c_tags(m *ice.Message, man string, cmd ...string) { func _c_tags(m *ice.Message, man string, cmd ...string) {
if !nfs.ExistsFile(m, path.Join(m.Option(nfs.PATH), nfs.TAGS)) { if !nfs.ExistsFile(m, path.Join(m.Option(nfs.PATH), nfs.TAGS)) {
m.Cmd(cli.SYSTEM, cmd, kit.Dict(cli.CMD_DIR, m.Option(nfs.PATH))) m.Cmd(cli.SYSTEM, cmd, kit.Dict(cli.CMD_DIR, m.Option(nfs.PATH)))
} }
if _inner_tags(m, m.Option(nfs.PATH), m.Option(mdb.NAME)); !cli.IsSuccess(m) || m.Length() == 0 { if _inner_tags(m, m.Option(nfs.PATH), m.Option(mdb.NAME)); !cli.IsSuccess(m) || m.Length() == 0 {
m.Push(nfs.FILE, kit.Keys(m.Option(mdb.NAME), man)) m.Push(nfs.FILE, kit.Keys(m.Option(mdb.NAME), man)).Push(nfs.LINE, "1")
m.Push(nfs.LINE, "1")
} }
} }
const MAN = "man"
const H = "h" const H = "h"
const C = "c" const C = "c"
const MAN = "man"
func init() { func init() {
Index.MergeCommands(ice.Commands{ Index.MergeCommands(ice.Commands{
C: {Name: "c path auto", Help: "系统", Actions: ice.MergeActions(ice.Actions{ MAN: {Name: MAN, Help: "系统手册", Actions: ice.MergeActions(ice.Actions{
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) { m.Cmd(cli.SYSTEM, cli.MAN, kit.TrimExt(arg[1], arg[0])) }},
}, PlugAction())},
H: {Name: "h path auto", Help: "系统编程", Actions: ice.MergeActions(ice.Actions{
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) { _c_show(m, arg...) }},
NAVIGATE: {Hand: func(m *ice.Message, arg ...string) { _c_tags(m, MAN, "ctags", "-a", "-R", nfs.PWD) }},
}, PlugAction(), LangAction())},
C: {Name: "c path auto", Help: "系统编程", Actions: ice.MergeActions(ice.Actions{
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) { _c_show(m, arg...) }}, mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) { _c_show(m, arg...) }},
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) { _c_exec(m, arg...) }}, mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) { _c_exec(m, arg...) }},
NAVIGATE: {Hand: func(m *ice.Message, arg ...string) { _c_tags(m, MAN, "ctags", "-a", "-R", nfs.PWD) }}, NAVIGATE: {Hand: func(m *ice.Message, arg ...string) { _c_tags(m, MAN, "ctags", "-a", "-R", nfs.PWD) }},
TEMPLATE: {Hand: func(m *ice.Message, arg ...string) { kit.IfElse(arg[0] == C, func() { m.Echo(_c_template) }) }},
}, PlugAction(), LangAction())}, }, PlugAction(), LangAction())},
H: {Name: "h path auto", Help: "系统", Actions: ice.MergeActions(ice.Actions{
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) { _c_show(m, arg...) }},
NAVIGATE: {Hand: func(m *ice.Message, arg ...string) { _c_tags(m, MAN, "ctags", "-a", "-R", nfs.PWD) }},
}, PlugAction(), LangAction())},
MAN: {Name: MAN, Help: "手册", Actions: ice.MergeActions(ice.Actions{
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
if len(arg) == 1 {
arg = append(arg, "")
}
key := kit.TrimExt(arg[1], arg[0])
m.Option(cli.CMD_ENV, "COLUMNS", kit.Int(kit.Select("1920", m.Option("width")))/12)
m.Echo(cli.SystemCmds(m, "man %s %s|col -b", "", key))
}},
}, PlugAction())},
}) })
} }
var _c_template = `#include <stdio.h>
int main(int argc, char *argv[]) {
printf("hello world\n");
}
`

View File

@ -27,4 +27,4 @@ func init() {
) )
} }
func Prefix(arg ...string) string { return kit.Keys(web.WEB, CODE, arg) } func Prefix(arg ...string) string { return web.Prefix(CODE, kit.Keys(arg)) }

View File

@ -3,13 +3,13 @@ package code
import ( import (
"path" "path"
"runtime" "runtime"
"strings"
ice "shylinux.com/x/icebergs" ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/cli" "shylinux.com/x/icebergs/base/cli"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/mdb" "shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs" "shylinux.com/x/icebergs/base/nfs"
// "shylinux.com/x/icebergs/base/web"
kit "shylinux.com/x/toolkits" kit "shylinux.com/x/toolkits"
) )
@ -30,7 +30,7 @@ func _compile_target(m *ice.Message, arg ...string) (string, string, string, str
} }
} }
if file == "" { if file == "" {
file = path.Join(ice.USR_PUBLISH, kit.Keys(kit.Select(ice.ICE, kit.TrimExt(main), main != ice.SRC_MAIN_GO), goos, arch)) file = path.Join(ice.USR_PUBLISH, kit.Keys(kit.Select(ice.ICE, kit.TrimExt(main, GO), main != ice.SRC_MAIN_GO), goos, arch))
} }
return main, file, goos, arch return main, file, goos, arch
} }
@ -41,49 +41,35 @@ const (
const COMPILE = "compile" const COMPILE = "compile"
func init() { func init() {
Index.Merge(&ice.Context{Configs: ice.Configs{ Index.MergeCommands(ice.Commands{
COMPILE: {Value: kit.Data(cli.ENV, kit.Dict("GOPRIVATE", "shylinux.com,github.com", "GOPROXY", "https://goproxy.cn,direct", "CGO_ENABLED", "0"))}, COMPILE: {Name: "compile arch=amd64,386,mipsle,arm,arm64 os=linux,darwin,windows src=src/main.go@key run relay binpack", Help: "编译", Actions: ice.MergeActions(ice.Actions{
}, Commands: ice.Commands{
COMPILE: {Name: "compile arch=amd64,386,mipsle,arm,arm64 os=linux,darwin,windows src=src/main.go@key run binpack relay", Help: "编译", Actions: ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
cli.IsAlpine(m, "curl") kit.Fetch([]string{"curl", "make", "gcc", "vim", "tmux"}, func(cmd string) { cli.IsSystem(m, cmd) })
cli.IsAlpine(m, "make")
cli.IsAlpine(m, "gcc")
cli.IsAlpine(m, "vim")
cli.IsAlpine(m, "tmux")
if cli.IsAlpine(m, "git"); !cli.IsAlpine(m, "go", "go git") { if cli.IsAlpine(m, "git"); !cli.IsAlpine(m, "go", "go git") {
m.Cmd(mdb.INSERT, cli.CLI, "", mdb.ZONE, cli.CLI, "go", cli.CMD, kit.Format("install download https://golang.google.cn/dl/go1.15.5.%s-%s.tar.gz usr/local", runtime.GOOS, runtime.GOARCH)) m.Cmd(mdb.INSERT, cli.CLI, "", mdb.ZONE, cli.CLI, "go", cli.CMD, kit.Format("install download https://golang.google.cn/dl/go1.15.5.%s-%s.tar.gz usr/local", runtime.GOOS, runtime.GOARCH))
} }
}}, }},
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(nfs.DIR, ice.SRC, nfs.DIR_CLI_FIELDS, kit.Dict(nfs.DIR_REG, `.*\.go$`)).Sort(nfs.PATH) m.Cmdy(nfs.DIR, ice.SRC, nfs.DIR_CLI_FIELDS, kit.Dict(nfs.DIR_REG, kit.ExtReg(GO)))
}}, }},
BINPACK: {Help: "打包", Hand: func(m *ice.Message, arg ...string) { BINPACK: {Help: "打包", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(AUTOGEN, BINPACK) }},
m.Cmdy(AUTOGEN, BINPACK) RELAY: {Help: "跳板", Hand: func(m *ice.Message, arg ...string) { m.Cmdy("", ice.SRC_RELAY_GO, path.Join(ice.USR_PUBLISH, RELAY)) }},
}}, }, ctx.ConfAction(cli.ENV, kit.Dict("GOPRIVATE", "shylinux.com,github.com", "GOPROXY", "https://goproxy.cn,direct", "CGO_ENABLED", "0"))), Hand: func(m *ice.Message, arg ...string) {
RELAY: {Help: "跳板", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(COMPILE, ice.SRC_RELAY_GO, path.Join(ice.USR_PUBLISH, RELAY))
}},
}, Hand: func(m *ice.Message, arg ...string) {
_autogen_version(m.Spawn()) _autogen_version(m.Spawn())
// 执行编译
// web.PushStream(m)
main, file, goos, arch := _compile_target(m, arg...) main, file, goos, arch := _compile_target(m, arg...)
m.Optionv(cli.CMD_ENV, kit.Simple(cli.HOME, kit.Env(cli.HOME), cli.PATH, kit.Env(cli.PATH), m.Configv(cli.ENV), m.Optionv(cli.ENV), cli.GOOS, goos, cli.GOARCH, arch)) m.Optionv(cli.CMD_ENV, kit.Simple(cli.PATH, kit.Env(cli.PATH), cli.HOME, kit.Env(cli.HOME), m.Configv(cli.ENV), m.Optionv(cli.ENV), cli.GOOS, goos, cli.GOARCH, arch))
// m.Cmd(cli.SYSTEM, GO, "get", "shylinux.com/x/ice") if !strings.Contains(m.Cmdx(nfs.CAT, ice.GO_MOD), "shylinux.com/x/ice") {
m.Cmd(cli.SYSTEM, GO, "get", "shylinux.com/x/ice")
}
if msg := m.Cmd(cli.SYSTEM, GO, cli.BUILD, "-o", file, main, ice.SRC_VERSION_GO, ice.SRC_BINPACK_GO); !cli.IsSuccess(msg) { if msg := m.Cmd(cli.SYSTEM, GO, cli.BUILD, "-o", file, main, ice.SRC_VERSION_GO, ice.SRC_BINPACK_GO); !cli.IsSuccess(msg) {
m.Copy(msg) m.Copy(msg)
return return
} }
m.Option(cli.CMD_OUTPUT, "")
// 编译成功
m.Logs(mdb.EXPORT, nfs.SOURCE, main, nfs.TARGET, file) m.Logs(mdb.EXPORT, nfs.SOURCE, main, nfs.TARGET, file)
m.Cmdy(nfs.DIR, file, nfs.DIR_WEB_FIELDS) m.Cmdy(nfs.DIR, file, nfs.DIR_WEB_FIELDS).StatusTimeCount()
if strings.Contains(file, ice.ICE) {
m.Cmdy(PUBLISH, ice.CONTEXTS) m.Cmdy(PUBLISH, ice.CONTEXTS)
m.StatusTimeCount() }
m.Process("")
}}, }},
}}) })
} }

View File

@ -11,27 +11,24 @@ import (
kit "shylinux.com/x/toolkits" kit "shylinux.com/x/toolkits"
) )
func _css_stat(m *ice.Message, block string, stats map[string]int) { func _css_stat(m *ice.Message, zone string, stats map[string]int) {
msg := m.Spawn() msg := m.Spawn()
for k, v := range stats { for k, v := range stats {
msg.Push("name", k) msg.Push(mdb.NAME, k).Push(mdb.VALUE, v).Push(mdb.ZONE, zone)
msg.Push("value", v)
msg.Push("block", block)
} }
msg.SortIntR("value") msg.SortIntR(mdb.VALUE)
m.Copy(msg) m.Copy(msg)
} }
func _css_show(m *ice.Message, arg ...string) { func _css_show(m *ice.Message, arg ...string) {
// block := "" zone := ""
stats_key := map[string]int{} stats_key, stats_value := map[string]int{}, map[string]int{}
stats_value := map[string]int{}
m.Cmd(nfs.CAT, path.Join(arg[2], arg[1]), func(line string) { m.Cmd(nfs.CAT, path.Join(arg[2], arg[1]), func(line string) {
if line = strings.TrimSpace(line); line == "" || strings.HasPrefix(line, "//") || strings.HasPrefix(line, "/*") { if line = strings.TrimSpace(line); line == "" || strings.HasPrefix(line, "//") || strings.HasPrefix(line, "/*") {
return return
} }
switch { switch {
case strings.HasSuffix(line, "{"): case strings.HasSuffix(line, "{"):
// block = strings.TrimSuffix(line, "{") zone = strings.TrimSuffix(line, "{")
case strings.HasSuffix(line, "}"): case strings.HasSuffix(line, "}"):
if line == "}" { if line == "}" {
break break
@ -42,13 +39,17 @@ func _css_show(m *ice.Message, arg ...string) {
if len(list) < 2 { if len(list) < 2 {
continue continue
} }
m.Push("name", list[0]) m.Push(mdb.NAME, list[0])
m.Push("value", list[1]) m.Push(mdb.VALUE, list[1])
m.Push("block", ls[0]) m.Push(mdb.ZONE, ls[0])
stats_key[list[0]]++ stats_key[list[0]]++
stats_value[list[1]]++ stats_value[list[1]]++
} }
default: default:
list := kit.Split(line, "", ":;")
m.Push(mdb.NAME, list[0])
m.Push(mdb.VALUE, list[1])
m.Push(mdb.ZONE, zone)
} }
}) })
_css_stat(m, "stats.key", stats_key) _css_stat(m, "stats.key", stats_key)
@ -56,8 +57,8 @@ func _css_show(m *ice.Message, arg ...string) {
m.StatusTimeCount() m.StatusTimeCount()
} }
func _css_exec(m *ice.Message, arg ...string) { func _css_exec(m *ice.Message, arg ...string) {
if arg[2] == "usr/volcanos/" && strings.HasPrefix(arg[1], "plugin/local/") { if arg[2] == ice.USR_VOLCANOS && strings.HasPrefix(arg[1], ice.PLUGIN_LOCAL) {
key := "web." + strings.ReplaceAll(strings.TrimSuffix(strings.TrimPrefix(arg[1], "plugin/local/"), ".css"), ice.PS, ice.PT) key := ctx.GetFileCmd("/require/shylinux.com/x/icebergs/core/"+strings.TrimPrefix(arg[1], ice.PLUGIN_LOCAL))
ctx.ProcessCommand(m, kit.Select("can.plugin", key), kit.Simple()) ctx.ProcessCommand(m, kit.Select("can.plugin", key), kit.Simple())
return return
} }

View File

@ -1,6 +1,8 @@
package code package code
import ( import (
"strings"
ice "shylinux.com/x/icebergs" ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/cli" "shylinux.com/x/icebergs/base/cli"
"shylinux.com/x/icebergs/base/ctx" "shylinux.com/x/icebergs/base/ctx"
@ -14,25 +16,22 @@ const FAVOR = "favor"
func init() { func init() {
Index.MergeCommands(ice.Commands{ Index.MergeCommands(ice.Commands{
FAVOR: {Name: "favor zone id auto insert page", Help: "收藏夹", Actions: ice.MergeActions(ice.Actions{ FAVOR: {Name: "favor zone id auto insert page", Help: "收藏夹", Actions: ice.MergeActions(ice.Actions{
mdb.INSERT: {Name: "insert zone=数据结构 type=go name=hi text=hello path file line", Help: "添加"}, mdb.INSERT: {Name: "insert zone*=数据结构 type=go name*=hi text*=hello path file line"},
XTERM: {Name: "xterm", Help: "终端", Hand: func(m *ice.Message, arg ...string) { XTERM: {Help: "终端", Hand: func(m *ice.Message, arg ...string) {
ctx.Process(m, m.ActionKey(), m.OptionSimple(mdb.TYPE, mdb.NAME, mdb.TEXT), arg...) if msg := mdb.ZoneSelects(m.Spawn(), m.Option(mdb.ZONE), m.Option(mdb.ID)); strings.HasPrefix(msg.Option(mdb.TYPE), cli.OPEN) {
m.Cmdy(cli.SYSTEM, m.Option(mdb.TYPE)).ProcessHold()
} else {
ctx.Process(m, m.ActionKey(), msg.OptionSimple(mdb.TYPE, mdb.NAME, mdb.TEXT), arg...)
}
}}, }},
INNER: {Name: "inner", Help: "源码", Hand: func(m *ice.Message, arg ...string) { INNER: {Help: "源码", Hand: func(m *ice.Message, arg ...string) {
ctx.Process(m, m.ActionKey(), m.OptionSplit(nfs.PATH, nfs.FILE, nfs.LINE), arg...) msg := mdb.ZoneSelects(m, m.Option(mdb.ZONE), m.Option(mdb.ID))
ctx.Process(m, m.ActionKey(), msg.OptionSplit(nfs.PATH, nfs.FILE, nfs.LINE), arg...)
}}, }},
"click": {Name: "click", Help: "应用", Hand: func(m *ice.Message, arg ...string) { }, mdb.PageZoneAction(mdb.FIELD, "time,id,type,name,text,path,file,line"), ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
m.Cmd(cli.DAEMON, m.Option(mdb.TYPE))
}},
}, mdb.ZoneAction(mdb.SHORT, mdb.ZONE, mdb.FIELD, "time,id,type,name,text,path,file,line")), Hand: func(m *ice.Message, arg ...string) {
m.Option(mdb.CACHE_LIMIT, "30") m.Option(mdb.CACHE_LIMIT, "30")
if mdb.PageZoneSelect(m, arg...); len(arg) > 0 && arg[0] != "" { if mdb.PageZoneSelect(m, arg...); len(arg) > 0 && arg[0] != "" {
if arg[0] == "_recent_file" { m.Tables(func(value ice.Maps) { m.PushButton(kit.Select(INNER, XTERM, value[nfs.FILE] == "")) }).Option(ctx.STYLE, arg[0])
m.Sort(nfs.FILE)
}
m.Tables(func(value ice.Maps) {
m.PushButton(kit.Select(INNER, XTERM, value[mdb.TEXT] == "" || value[nfs.FILE] == ""))
}).Option(ctx.STYLE, arg[0])
} }
}}, }},
}) })