mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 01:24:05 +08:00
opt some
This commit is contained in:
parent
3a7338a425
commit
193e55602d
@ -64,7 +64,7 @@ func init() {
|
||||
mdb.CREATE: {Name: "create username", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||
_sess_create(m, m.Option(USERNAME))
|
||||
}},
|
||||
SESS_CREATE: {Name: "sess.create", Help: "检查", Hand: func(m *ice.Message, arg ...string) {
|
||||
SESS_CREATE: {Name: "sess.create", Help: "事件", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(mdb.EXPORT, m.Prefix(SESS), "", mdb.HASH)
|
||||
m.Cmd(mdb.IMPORT, m.Prefix(SESS), "", mdb.HASH)
|
||||
}},
|
||||
|
@ -14,14 +14,16 @@ func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
IFRAME: {Name: "iframe hash auto", Help: "浏览器", Actions: ice.MergeActions(ice.Actions{
|
||||
mdb.CREATE: {Name: "create link name type", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||
u := kit.ParseURL(m.Option(mdb.LINK))
|
||||
m.OptionDefault(mdb.NAME, u.Host)
|
||||
m.OptionDefault(mdb.NAME, kit.ParseURL(m.Option(mdb.LINK)).Host, mdb.TYPE, mdb.LINK)
|
||||
mdb.HashCreate(m, m.OptionSimple("link,name,type"))
|
||||
}},
|
||||
}, mdb.HashAction(mdb.SHORT, mdb.LINK, mdb.FIELD, "time,hash,type,name,link")), Hand: func(m *ice.Message, arg ...string) {
|
||||
if mdb.HashSelect(m, arg...); len(arg) == 0 || arg[0] == "" {
|
||||
m.Action(mdb.CREATE, mdb.PRUNES)
|
||||
} else {
|
||||
if m.Length() == 0 {
|
||||
m.Append(mdb.LINK, arg[0])
|
||||
}
|
||||
m.Action(cli.OPEN).StatusTime(mdb.LINK, m.Append(mdb.LINK))
|
||||
ctx.DisplayLocal(m, "")
|
||||
}
|
||||
|
@ -61,6 +61,10 @@ func init() {
|
||||
}
|
||||
gdb.Event(m, RIVER_CREATE, RIVER, m.Option(ice.MSG_RIVER, h), arg)
|
||||
}},
|
||||
RIVER_CREATE: {Name: "river.create", Help: "事件", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(mdb.EXPORT, m.Prefix(RIVER), "", mdb.HASH)
|
||||
m.Cmd(mdb.IMPORT, m.Prefix(RIVER), "", mdb.HASH)
|
||||
}},
|
||||
}, mdb.HashAction(mdb.FIELD, "time,hash,type,name,text,template"), web.ApiAction(web.P(RIVER))), Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Warn(m.Option(ice.MSG_USERNAME) == "", ice.ErrNotLogin) {
|
||||
m.RenderStatusUnauthorized()
|
||||
|
@ -1,6 +1,9 @@
|
||||
package code
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
@ -21,6 +24,29 @@ func init() {
|
||||
ctx.Process(m, m.ActionKey(), m.OptionSplit(nfs.PATH, nfs.FILE, nfs.LINE), 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 len(arg) == 0 || arg[0] == "" {
|
||||
m.Push(mdb.TIME, m.Time())
|
||||
m.Push(mdb.ZONE, "_history")
|
||||
m.Push(mdb.COUNT, "100")
|
||||
m.PushButton("")
|
||||
} else if arg[0] == "_history" {
|
||||
last := ""
|
||||
list := map[string]string{}
|
||||
m.Cmd(nfs.CAT, kit.HomePath(".bash_history"), func(line string) {
|
||||
if strings.HasPrefix(line, "#") {
|
||||
last = time.Unix(kit.Int64(line[1:]), 0).Format(ice.MOD_TIME)
|
||||
} else if last != "" {
|
||||
list[line] = last
|
||||
}
|
||||
})
|
||||
for k, v := range list {
|
||||
m.Push(mdb.TIME, v)
|
||||
m.Push(mdb.TYPE, k)
|
||||
}
|
||||
m.SortTimeR(mdb.TIME)
|
||||
m.StatusTimeCount()
|
||||
return
|
||||
}
|
||||
if mdb.ZoneSelectPage(m, arg...); len(arg) > 0 && arg[0] != "" {
|
||||
m.Tables(func(value ice.Maps) {
|
||||
m.PushButton(kit.Select(INNER, XTERM, value[mdb.TEXT] == "" || value[nfs.FILE] == ""))
|
||||
|
@ -84,12 +84,11 @@ func init() {
|
||||
}},
|
||||
ice.RUN: {Name: "run", Help: "执行", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Option(ice.POD, m.Option("task.pod"))
|
||||
m.Option("task.pod", "")
|
||||
if ctx.PodCmd(m, m.PrefixKey(), ice.RUN, arg) {
|
||||
if m.Option("task.pod", ""); ctx.PodCmd(m, m.PrefixKey(), ice.RUN, arg) {
|
||||
return
|
||||
}
|
||||
msg := m.Cmd(TASK, arg[0], arg[1])
|
||||
m.Cmdy(kit.Simple(kit.Keys(msg.Append(kit.KeyExtra(ice.CTX)), msg.Append(kit.KeyExtra(ice.CMD))), arg[2:]))
|
||||
msg := m.Cmd(TASK, arg[0], arg[1], ice.OptionFields(ice.CTX, ice.CMD))
|
||||
m.Cmdy(kit.Simple(kit.Keys(msg.Append(ice.CTX), msg.Append(ice.CMD)), arg[2:]))
|
||||
}},
|
||||
}, TASK), Hand: func(m *ice.Message, arg ...string) {
|
||||
arg = kit.Slice(arg, 0, 2)
|
||||
|
Loading…
x
Reference in New Issue
Block a user