mirror of
https://shylinux.com/x/icebergs
synced 2025-05-01 03:09:21 +08:00
opt some
This commit is contained in:
parent
f25a2b4220
commit
5959576cd7
@ -106,12 +106,13 @@ const (
|
||||
const (
|
||||
GOARCH = "GOARCH"
|
||||
GOOS = "GOOS"
|
||||
X386 = "386"
|
||||
AMD64 = "amd64"
|
||||
ARM64 = "arm64"
|
||||
ARM = "arm"
|
||||
LINUX = "linux"
|
||||
DARWIN = "darwin"
|
||||
WINDOWS = "windows"
|
||||
AMD64 = "amd64"
|
||||
I386 = "386"
|
||||
ARM = "arm"
|
||||
)
|
||||
const (
|
||||
CTX_SHY = "ctx_shy"
|
||||
|
@ -145,16 +145,6 @@ func HashAction(fields ...string) map[string]*ice.Action {
|
||||
}
|
||||
return kit.Select(kit.MDB_HASH, m.Config(kit.MDB_SHORT))
|
||||
}
|
||||
prunes := &ice.Action{Name: "prunes before@date", Help: "清理", Hand: func(m *ice.Message, arg ...string) {
|
||||
HashPrunes(m, nil)
|
||||
}}
|
||||
if len(fields) > 0 && fields[0] == "status" {
|
||||
prunes = &ice.Action{Name: "prunes", Help: "清理", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.OptionFields(m.Config(kit.MDB_FIELD))
|
||||
m.Cmdy(PRUNES, m.PrefixKey(), "", HASH, kit.MDB_STATUS, "error")
|
||||
m.Cmdy(PRUNES, m.PrefixKey(), "", HASH, kit.MDB_STATUS, "close")
|
||||
}}
|
||||
}
|
||||
return ice.SelectAction(map[string]*ice.Action{
|
||||
INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(INPUTS, m.PrefixKey(), "", HASH, arg)
|
||||
@ -175,7 +165,9 @@ func HashAction(fields ...string) map[string]*ice.Action {
|
||||
IMPORT: {Name: "import", Help: "导入", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(IMPORT, m.PrefixKey(), "", HASH, arg)
|
||||
}},
|
||||
PRUNES: prunes,
|
||||
PRUNES: &ice.Action{Name: "prunes before@date", Help: "清理", Hand: func(m *ice.Message, arg ...string) {
|
||||
HashPrunes(m, nil)
|
||||
}},
|
||||
}, fields...)
|
||||
}
|
||||
func HashActionStatus(fields ...string) map[string]*ice.Action {
|
||||
@ -202,7 +194,7 @@ func HashPrunes(m *ice.Message, cb func(map[string]string) bool) *ice.Message {
|
||||
return kit.Select(kit.MDB_HASH, m.Config(kit.MDB_SHORT))
|
||||
}
|
||||
before := kit.Time(kit.Select(m.Time("-72h"), m.Option(kit.MDB_BEFORE)))
|
||||
m.Cmd(m.PrefixKey()).Table(func(index int, value map[string]string, head []string) {
|
||||
m.Cmd(m.CommandKey()).Table(func(index int, value map[string]string, head []string) {
|
||||
if kit.Time(value[kit.MDB_TIME]) > before {
|
||||
return
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ func init() {
|
||||
kit.MDB_PATH, ice.VAR_TRASH,
|
||||
)},
|
||||
}, Commands: map[string]*ice.Command{
|
||||
TRASH: {Name: "trash file auto prunes", Help: "回收站", Action: ice.MergeAction(map[string]*ice.Action{
|
||||
TRASH: {Name: "trash hash auto prunes", Help: "回收站", Action: ice.MergeAction(map[string]*ice.Action{
|
||||
mdb.REVERT: {Name: "revert", Help: "恢复", Hand: func(m *ice.Message, arg ...string) {
|
||||
os.Rename(m.Option(kit.MDB_FILE), m.Option(kit.MDB_FROM))
|
||||
m.Cmd(mdb.DELETE, TRASH, "", mdb.HASH, m.OptionSimple(kit.MDB_HASH))
|
||||
@ -48,12 +48,14 @@ func init() {
|
||||
os.Remove(m.Option(kit.MDB_FILE))
|
||||
m.Cmd(mdb.DELETE, TRASH, "", mdb.HASH, m.OptionSimple(kit.MDB_HASH))
|
||||
}},
|
||||
mdb.PRUNES: {Name: "prunes", Help: "清理", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(mdb.DELETE, TRASH, "", mdb.HASH, m.OptionSimple(kit.MDB_HASH))
|
||||
mdb.PRUNES: {Name: "prunes before@date", Help: "清理", Hand: func(m *ice.Message, arg ...string) {
|
||||
mdb.HashPrunes(m, func(value map[string]string) bool {
|
||||
os.Remove(value[kit.MDB_FILE])
|
||||
return false
|
||||
})
|
||||
}},
|
||||
}, mdb.HashAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
mdb.HashSelect(m, arg...)
|
||||
if mdb.HashSelect(m, arg...); len(arg) == 0 || m.Length() > 0 {
|
||||
m.PushAction(mdb.REVERT, mdb.REMOVE)
|
||||
return
|
||||
}
|
||||
|
@ -27,10 +27,10 @@ func init() {
|
||||
if kit.Contains(arg[1], ";") {
|
||||
arg = kit.Split(arg[1], ";", ";", ";")
|
||||
}
|
||||
defer m.StatusTimeCount()
|
||||
if m.Cmdy(m.Space(m.Option(ice.POD)), mdb.SEARCH, arg); arg[1] == "" {
|
||||
return
|
||||
}
|
||||
m.StatusTimeCount()
|
||||
m.Cmd(mdb.INSERT, m.PrefixKey(), "", mdb.HASH,
|
||||
kit.MDB_NAME, arg[1], kit.MDB_TYPE, arg[0], kit.MDB_TEXT, kit.Select("", arg, 2))
|
||||
}},
|
||||
|
@ -41,10 +41,10 @@ func init() {
|
||||
arch := m.Conf(cli.RUNTIME, kit.Keys(tcp.HOST, cli.GOARCH))
|
||||
for _, k := range arg {
|
||||
switch k {
|
||||
case cli.LINUX, cli.DARWIN, cli.WINDOWS:
|
||||
goos = k
|
||||
case cli.AMD64, cli.I386, cli.ARM:
|
||||
case cli.X386, cli.AMD64, cli.ARM64, cli.ARM:
|
||||
arch = k
|
||||
case cli.WINDOWS, cli.DARWIN, cli.LINUX:
|
||||
goos = k
|
||||
default:
|
||||
if kit.Ext(k) == GO {
|
||||
main = k
|
||||
|
@ -79,6 +79,7 @@ func init() {
|
||||
if m.Cmdy(mdb.PLUGIN, arg); m.Result() == "" {
|
||||
m.Echo(kit.Select("{}", m.Config(kit.Keys(PLUG, arg[0]))))
|
||||
}
|
||||
m.Set(ice.MSG_STATUS)
|
||||
}},
|
||||
mdb.ENGINE: {Name: "engine", Help: "引擎", Hand: func(m *ice.Message, arg ...string) {
|
||||
_inner_exec(m, arg[0], arg[1], arg[2])
|
||||
@ -94,9 +95,11 @@ func init() {
|
||||
}
|
||||
if len(arg) < 2 {
|
||||
nfs.Dir(m, kit.MDB_PATH)
|
||||
m.Set(ice.MSG_STATUS)
|
||||
return
|
||||
}
|
||||
_inner_list(m, kit.Ext(arg[1]), arg[1], arg[0])
|
||||
m.Set(ice.MSG_STATUS)
|
||||
}},
|
||||
}, Configs: map[string]*ice.Config{
|
||||
INNER: {Name: "inner", Help: "源代码", Value: kit.Data(
|
||||
|
@ -26,7 +26,6 @@ func init() {
|
||||
}},
|
||||
mdb.REMOVE: {Name: "remove", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
||||
os.Remove(strings.TrimPrefix(arg[0], "/share/local/"))
|
||||
m.ProcessHold()
|
||||
}},
|
||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
_wiki_list(m, m.CommandKey(), kit.Select("./", arg, 0))
|
||||
|
6
meta.go
6
meta.go
@ -39,6 +39,9 @@ func (m *Message) Set(key string, arg ...string) *Message {
|
||||
return m
|
||||
}
|
||||
default:
|
||||
for _, k := range kit.Split(key) {
|
||||
delete(m.meta, k)
|
||||
}
|
||||
if m.FieldsIsDetail() {
|
||||
for i := 0; i < len(m.meta[kit.MDB_KEY]); i++ {
|
||||
if m.meta[kit.MDB_KEY][i] == key {
|
||||
@ -57,9 +60,6 @@ func (m *Message) Set(key string, arg ...string) *Message {
|
||||
}
|
||||
return m
|
||||
}
|
||||
for _, k := range kit.Split(key) {
|
||||
delete(m.meta, k)
|
||||
}
|
||||
}
|
||||
return m.Add(key, arg...)
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ const DUTY = "duty"
|
||||
|
||||
func init() {
|
||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
||||
DUTY: {Name: "duty [title] text auto", Help: "通告", Hand: func(m *ice.Message, c *ice.Context, key string, arg ...string) {
|
||||
DUTY: {Name: "duty [title] text run:button", Help: "通告", Hand: func(m *ice.Message, c *ice.Context, key string, arg ...string) {
|
||||
msg := m.Cmd(APP, m.Option(APP_ID))
|
||||
m.Cmdy(SEND, msg.Append(APPID), msg.Append(DUTY), arg)
|
||||
}},
|
||||
|
@ -20,6 +20,7 @@ field "会话" aaa.sess
|
||||
field "用户" aaa.user
|
||||
|
||||
chapter "项目"
|
||||
field "icebergs" web.code.git.trend args `icebergs`
|
||||
field "icebergs" web.code.inner args `usr/icebergs/ misc/mp/mp.go`
|
||||
field "源代码" web.code.inner args `usr/icebergs/ misc/mp/login.go`
|
||||
field "趋势图" web.code.git.trend args `icebergs`
|
||||
field "架构图" web.code.git.spide args `icebergs`
|
||||
|
||||
|
@ -26,7 +26,7 @@ chapter "企业微信"
|
||||
field "机器人" web.chat.wework.bot
|
||||
|
||||
chapter "项目"
|
||||
field "源代码" web.code.inner args `usr/icebergs/ misc/wx/wx.go`
|
||||
field "源代码" web.code.inner args `usr/icebergs/ misc/wx/login.go`
|
||||
field "趋势图" web.code.git.trend args `icebergs`
|
||||
field "架构图" web.code.git.spide args `icebergs`
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user