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-09-20 12:42:35 +08:00
parent 987e84f428
commit 2ec04c32be
3 changed files with 8 additions and 7 deletions

View File

@ -25,6 +25,7 @@ const (
LOAD = "load"
AUTO = "auto"
VIEW = "view"
LIST = "list"
BACK = "back"
EXEC = "exec"

View File

@ -18,7 +18,7 @@ func init() {
ctx.Process(m, m.ActionKey(), m.OptionSplit(nfs.PATH, nfs.FILE, nfs.LINE), arg...)
}},
XTERM: {Name: "xterm", Help: "命令", Hand: func(m *ice.Message, arg ...string) {
ctx.Process(m, m.ActionKey(), append(m.OptionSimple(mdb.TYPE, mdb.NAME), ice.INIT, m.Option(mdb.TEXT)), arg...)
ctx.Process(m, m.ActionKey(), m.OptionSimple(mdb.TYPE, mdb.NAME, mdb.TEXT), arg...)
}},
}, mdb.ZoneAction(mdb.SHORT, mdb.ZONE, mdb.FIELD, "time,id,type,name,text,path,file,line")), Hand: func(m *ice.Message, arg ...string) {
if mdb.ZoneSelectPage(m, arg...); len(arg) > 0 && arg[0] != "" {

View File

@ -37,7 +37,7 @@ func _xterm_get(m *ice.Message, h string) _xterm {
m.Assert(h != "")
t := mdb.HashSelectField(m, m.Option(mdb.HASH, h), mdb.TYPE)
mdb.HashModify(m, mdb.TEXT, m.Option(ice.MSG_DAEMON))
mdb.HashModify(m, ice.VIEW, m.Option(ice.MSG_DAEMON))
return mdb.HashTarget(m, h, func() ice.Any {
ls := kit.Split(kit.Select(nfs.SH, t))
cmd := exec.Command(cli.SystemFind(m, ls[0]), ls[1:]...)
@ -53,7 +53,7 @@ func _xterm_get(m *ice.Message, h string) _xterm {
buf := make([]byte, ice.MOD_BUFS)
for {
if n, e := tty.Read(buf); !m.Warn(e) && e == nil {
m.Option(ice.MSG_DAEMON, mdb.HashSelectField(m, h, mdb.TEXT))
m.Option(ice.MSG_DAEMON, mdb.HashSelectField(m, h, ice.VIEW))
m.Option(mdb.TEXT, string(buf[:n]))
web.PushNoticeGrow(m)
} else {
@ -79,13 +79,13 @@ func init() {
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
switch mdb.HashInputs(m, arg); arg[0] {
case mdb.TYPE:
m.Push(arg[0], "ice.bin source stdio", "tmux attach -t miss", "docker run -w /root -it alpine", "python", "node", "bash", "sh")
m.Cmdy(FAVOR, "_xterm").Cut(mdb.TYPE).Push(arg[0], "bash", "sh")
case mdb.NAME:
m.Push(arg[0], ice.Info.HostName, path.Base(m.Option(mdb.TYPE)))
}
}},
mdb.CREATE: {Name: "create type=sh name init", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
mdb.HashCreate(m, mdb.NAME, kit.Split(m.Option(mdb.TYPE))[0], m.OptionSimple(mdb.TYPE, mdb.NAME, ice.INIT))
mdb.CREATE: {Name: "create type=sh name text", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
mdb.HashCreate(m, mdb.NAME, kit.Split(m.Option(mdb.TYPE))[0], m.OptionSimple(mdb.TYPE, mdb.NAME, mdb.TEXT))
ctx.ProcessRefresh(m)
}},
"resize": {Name: "resize", Help: "大小", Hand: func(m *ice.Message, arg ...string) {
@ -103,7 +103,7 @@ func init() {
web.WEBSITE: {Name: "website", Help: "打开", Hand: func(m *ice.Message, arg ...string) {
web.ProcessWebsite(m, "", "", m.OptionSimple(mdb.HASH))
}},
}, mdb.HashAction(mdb.FIELD, "time,hash,type,name,text,init", mdb.TOOLS, FAVOR), ctx.ProcessAction()), Hand: func(m *ice.Message, arg ...string) {
}, mdb.HashAction(mdb.FIELD, "time,hash,type,name,text,view", mdb.TOOLS, FAVOR), ctx.ProcessAction()), Hand: func(m *ice.Message, arg ...string) {
if mdb.HashSelect(m, arg...); len(arg) == 0 {
m.PushAction(web.WEBSITE, mdb.REMOVE)
m.Action(mdb.CREATE, mdb.PRUNES)