1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-26 01:24:05 +08:00
This commit is contained in:
shaoying 2022-10-04 22:59:23 +08:00
parent ff410adcc5
commit 484a2acf77
4 changed files with 25 additions and 4 deletions

View File

@ -185,7 +185,7 @@ const RUNTIME = "runtime"
func init() {
Index.MergeCommands(ice.Commands{
RUNTIME: {Name: "runtime info=ifconfig,hostinfo,hostname,userinfo,procinfo,diskinfo,bootinfo,api,cli,cmd,env auto", Help: "运行环境", Actions: ice.Actions{
RUNTIME: {Name: "runtime info=ifconfig,hostinfo,hostname,userinfo,procinfo,diskinfo,bootinfo,api,cli,cmd,env auto Terminal Chrome", Help: "运行环境", Actions: ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
cs := m.Target().Configs
if _, ok := cs[RUNTIME]; !ok {
@ -220,6 +220,12 @@ func init() {
DISKINFO: {Name: "diskinfo", Help: "磁盘信息", Hand: func(m *ice.Message, arg ...string) {
_runtime_diskinfo(m)
}},
"Terminal": {Name: "Terminal", Help: "终端", Hand: func(m *ice.Message, arg ...string) {
m.Cmd(SYSTEM, "open", "-a", "Terminal")
}},
"Chrome": {Name: "Chrome", Help: "浏览器", Hand: func(m *ice.Message, arg ...string) {
m.Cmd(SYSTEM, "open", "-a", "Google Chrome")
}},
MAXPROCS: {Name: "maxprocs", Help: "最大并发", Hand: func(m *ice.Message, arg ...string) {
if len(arg) > 0 {
runtime.GOMAXPROCS(kit.Int(m.Conf(RUNTIME, kit.Keys(HOST, MAXPROCS), kit.Select("1", arg, 0))))

View File

@ -219,9 +219,9 @@ func NextPageLimit(m *ice.Message, total string, arg ...string) {
}
func OptionPages(m *ice.Message, arg ...string) (page int, size int) {
m.Option(CACHE_LIMIT, kit.Select("", arg, 0))
m.Option(CACHE_OFFEND, kit.Select("", arg, 1))
m.Option(CACHE_FILTER, kit.Select("", arg, 2))
m.Option(CACHE_LIMIT, kit.Select(m.Option(CACHE_LIMIT), arg, 0))
m.Option(CACHE_OFFEND, kit.Select(m.Option(CACHE_OFFEND), arg, 1))
m.Option(CACHE_FILTER, kit.Select(m.Option(CACHE_FILTER), arg, 2))
m.Option(LIMIT, kit.Select(m.Option(LIMIT), arg, 0))
m.Option(OFFEND, kit.Select(m.Option(OFFEND), arg, 1))
size = kit.Int(kit.Select("10", m.Option(LIMIT)))
@ -266,6 +266,8 @@ func Grows(m *ice.Message, prefix string, chain Any, match string, value string,
m.Option(CACHE_OFFEND, -begin-limit)
}
}
m.Debug("what %v", m.Option(CACHE_LIMIT))
m.Debug("what %v", m.Option(CACHE_OFFEND))
return miss.Grows(path.Join(prefix, kit.Keys(chain)), cache,
kit.Int(kit.Select("0", strings.TrimPrefix(m.Option(CACHE_OFFEND), "-"))),
kit.Int(kit.Select("10", m.Option(CACHE_LIMIT))),

View File

@ -5,6 +5,7 @@ import (
"time"
ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/cli"
"shylinux.com/x/icebergs/base/ctx"
"shylinux.com/x/icebergs/base/mdb"
"shylinux.com/x/icebergs/base/nfs"
@ -23,6 +24,9 @@ func init() {
INNER: {Name: "inner", Help: "源码", Hand: func(m *ice.Message, arg ...string) {
ctx.Process(m, m.ActionKey(), m.OptionSplit(nfs.PATH, nfs.FILE, nfs.LINE), arg...)
}},
"click": {Name: "click", Help: "源码", 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) {
if len(arg) == 0 || arg[0] == "" {
m.Push(mdb.TIME, m.Time())
@ -47,7 +51,10 @@ func init() {
m.StatusTimeCount()
return
}
m.Option(mdb.CACHE_LIMIT, "30")
m.Option(mdb.LIMIT, "30")
if mdb.ZoneSelectPage(m, arg...); len(arg) > 0 && arg[0] != "" {
m.Option(ctx.STYLE, arg[0])
m.Tables(func(value ice.Maps) {
m.PushButton(kit.Select(INNER, XTERM, value[mdb.TEXT] == "" || value[nfs.FILE] == ""))
})

View File

@ -72,6 +72,9 @@ func init() {
m.Cmd(web.DREAM).Tables(func(value ice.Maps) {
m.Push(nfs.PATH, "dream:"+value[mdb.NAME])
})
m.Cmd(FAVOR, "_open").Tables(func(value ice.Maps) {
m.Push(nfs.PATH, "_open:"+strings.ToLower(value[mdb.NAME]))
})
}
}
}},
@ -106,6 +109,9 @@ func init() {
m.PushQRCode(mdb.TEXT, link)
m.Push(mdb.NAME, link)
}},
"_open": {Name: "_open", Help: "索引", Hand: func(m *ice.Message, arg ...string) {
m.Cmd(cli.DAEMON, "open", "-a", kit.Split(arg[0], ".", ".")[0])
}},
"listTags": {Name: "listTags", Help: "索引", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy("web.code.vim.tags", "listTags", arg)
}},