mirror of
https://shylinux.com/x/icebergs
synced 2025-04-25 17:18:05 +08:00
opt some
This commit is contained in:
parent
c6002519fd
commit
12e30f99c3
@ -107,7 +107,6 @@ func _system_exec(m *ice.Message, cmd *exec.Cmd) {
|
||||
if IsSuccess(m) && err.String() == "" {
|
||||
m.SetAppend()
|
||||
}
|
||||
m.Debug("what %v %v", out.String(), err.String())
|
||||
m.Echo(strings.TrimRight(out.String(), ice.NL))
|
||||
}()
|
||||
}
|
||||
|
@ -266,8 +266,6 @@ 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))),
|
||||
|
@ -3,7 +3,6 @@ package web
|
||||
import (
|
||||
"math/rand"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@ -324,32 +323,6 @@ func init() {
|
||||
DOMAIN: {Name: "domain", Help: "域名", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Echo(_space_domain(m))
|
||||
}},
|
||||
"hostinfo": {Name: "hostinfo", Help: "域名", Hand: func(m *ice.Message, arg ...string) {
|
||||
ncpu := 0
|
||||
nmem := 0.0
|
||||
m.Cmd("").Tables(func(value ice.Maps) {
|
||||
if value[mdb.TYPE] == SERVER {
|
||||
msg := m.Cmd("", value[mdb.NAME], cli.RUNTIME, cli.HOSTINFO)
|
||||
if msg.Append("nCPU") != "" {
|
||||
ncpu += kit.Int(msg.Append("nCPU"))
|
||||
m.Push("nCPU", msg.Append("nCPU"))
|
||||
m.Push("MemTotal", msg.Append("MemTotal"))
|
||||
m.Push("name", value[mdb.NAME])
|
||||
base, raw := 1.0, ""
|
||||
if strings.HasSuffix(msg.Append("MemTotal"), "M") {
|
||||
raw = strings.TrimSuffix(msg.Append("MemTotal"), "M")
|
||||
} else if strings.HasSuffix(msg.Append("MemTotal"), "G") {
|
||||
base, raw = 1000, strings.TrimSuffix(msg.Append("MemTotal"), "G")
|
||||
}
|
||||
n, e := strconv.ParseFloat(raw, 32)
|
||||
m.Debug("what %v", e)
|
||||
nmem += n * base
|
||||
}
|
||||
}
|
||||
})
|
||||
m.StatusTimeCount("nCPU", ncpu, "nmem", kit.Format("%.2fG", nmem/1000.0))
|
||||
m.Debug("what %v", m.FormatMeta())
|
||||
}},
|
||||
cli.OPEN: {Name: "open", Help: "系统", Hand: func(m *ice.Message, arg ...string) {
|
||||
ProcessIframe(m, MergePod(m, m.Option(mdb.NAME), "", ""), arg...)
|
||||
}},
|
||||
|
@ -120,6 +120,12 @@ func init() {
|
||||
m.Cmdy(NAVIGATE, kit.Ext(m.Option(mdb.FILE)), m.Option(nfs.FILE), m.Option(nfs.PATH))
|
||||
}},
|
||||
FAVOR: {Name: "favor", Help: "收藏"},
|
||||
ctx.COMMAND: {Name: "command", Help: "命令", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(FAVOR, mdb.INSERT, mdb.ZONE, "_vimer", nfs.FILE, arg[0])
|
||||
if !ctx.PodCmd(m, ctx.COMMAND, arg) {
|
||||
m.Cmdy(ctx.COMMAND, arg)
|
||||
}
|
||||
}},
|
||||
}, ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
if arg[0] = strings.Split(arg[0], ice.FS)[0]; !strings.HasSuffix(arg[0], ice.PS) && len(arg) == 1 {
|
||||
arg[1] = kit.Slice(strings.Split(arg[0], ice.PS), -1)[0]
|
||||
@ -138,6 +144,7 @@ func init() {
|
||||
m.Option("plug", m.Config("show.plug"))
|
||||
m.Option("exts", m.Config("show.exts"))
|
||||
ctx.DisplayLocal(m, "")
|
||||
m.Cmd(FAVOR, mdb.INSERT, mdb.ZONE, "_recent", nfs.PATH, arg[0], nfs.FILE, arg[1])
|
||||
}},
|
||||
}})
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package code
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
@ -102,6 +103,9 @@ func init() {
|
||||
XTERM: {Name: "xterm type=sh name text", Help: "终端", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(XTERM, mdb.CREATE, arg)
|
||||
}},
|
||||
FAVOR: {Name: "favor", Help: "收藏", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(FAVOR, arg)
|
||||
}},
|
||||
|
||||
"keyboard": {Name: "keyboard", Help: "远程控制", Hand: func(m *ice.Message, arg ...string) {
|
||||
hash := m.Cmdx("web.chat.keyboard", mdb.CREATE, web.SPACE, m.Option(ice.MSG_DAEMON), ctx.INDEX, m.Option(ctx.INDEX), "input", "")
|
||||
@ -145,7 +149,12 @@ func init() {
|
||||
m.Cmdy(AUTOGEN, mdb.CREATE, arg)
|
||||
}},
|
||||
COMPILE: {Name: "compile", Help: "编译", Hand: func(m *ice.Message, arg ...string) {
|
||||
if msg := m.Cmd(COMPILE, ice.SRC_MAIN_GO, ice.BIN_ICE_BIN); cli.IsSuccess(msg) {
|
||||
cmds := []string{COMPILE, ice.SRC_MAIN_GO, ice.BIN_ICE_BIN}
|
||||
if strings.HasSuffix(os.Args[0], "contexts.app/Contents/MacOS/contexts") {
|
||||
m.Option(cli.CMD_ENV, kit.Path("usr/local/go/bin"))
|
||||
cmds = []string{cli.SYSTEM, "make", "app"}
|
||||
}
|
||||
if msg := m.Cmd(cmds); cli.IsSuccess(msg) {
|
||||
m.Cmd(UPGRADE, cli.RESTART)
|
||||
} else {
|
||||
_vimer_make(m, nfs.PWD, msg)
|
||||
|
@ -48,6 +48,8 @@ func (w WebView) Menu() bool {
|
||||
func (w WebView) Title(text string) { w.WebView.SetTitle(text) }
|
||||
func (w WebView) Webview(url string) { w.WebView.Navigate(url) }
|
||||
func (w WebView) Open(url string) { w.WebView.Navigate(url) }
|
||||
func (w WebView) OutOpen(url string) { ice.Pulse.Cmd("system", "open", url) }
|
||||
func (w WebView) Terminal(url string) { ice.Pulse.Cmd("system", "open", "-a", "Terminal") }
|
||||
func (w WebView) Terminate() { w.WebView.Terminate() }
|
||||
func (w WebView) Close() {
|
||||
if !w.Menu() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user