mirror of
https://shylinux.com/x/icebergs
synced 2025-05-01 19:19:24 +08:00
opt some
This commit is contained in:
parent
11e5f1ba2c
commit
25edf639ae
@ -75,7 +75,7 @@ func _list_export(m *ice.Message, prefix, chain, file string) {
|
|||||||
head := kit.Split(m.OptionFields())
|
head := kit.Split(m.OptionFields())
|
||||||
m.Grows(prefix, chain, "", "", func(index int, val map[string]interface{}) {
|
m.Grows(prefix, chain, "", "", func(index int, val map[string]interface{}) {
|
||||||
if val = kit.GetMeta(val); index == 0 {
|
if val = kit.GetMeta(val); index == 0 {
|
||||||
if len(head) == 0 || head[0] == "detail" { // 默认表头
|
if len(head) == 0 || head[0] == ice.CACHE_DETAIL { // 默认表头
|
||||||
for k := range val {
|
for k := range val {
|
||||||
head = append(head, k)
|
head = append(head, k)
|
||||||
}
|
}
|
||||||
|
1
conf.go
1
conf.go
@ -205,6 +205,7 @@ const ( // MSG
|
|||||||
CACHE_FILTER = "cache.filter"
|
CACHE_FILTER = "cache.filter"
|
||||||
CACHE_VALUE = "cache.value"
|
CACHE_VALUE = "cache.value"
|
||||||
CACHE_FIELD = "cache.field"
|
CACHE_FIELD = "cache.field"
|
||||||
|
CACHE_DETAIL = "detail"
|
||||||
)
|
)
|
||||||
const ( // RENDER
|
const ( // RENDER
|
||||||
RENDER_RAW = "_raw"
|
RENDER_RAW = "_raw"
|
||||||
|
@ -112,6 +112,14 @@ func _go_show(m *ice.Message, arg ...string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func _sum_show(m *ice.Message, file string) {
|
||||||
|
m.Cmd(nfs.CAT, file, func(ls []string, line string) {
|
||||||
|
m.Push("repos", ls[0])
|
||||||
|
m.Push("version", ls[1])
|
||||||
|
m.Push("hash", ls[2])
|
||||||
|
})
|
||||||
|
m.StatusTimeCount()
|
||||||
|
}
|
||||||
func _mod_show(m *ice.Message, file string) {
|
func _mod_show(m *ice.Message, file string) {
|
||||||
const (
|
const (
|
||||||
MODULE = "module"
|
MODULE = "module"
|
||||||
@ -126,7 +134,7 @@ func _mod_show(m *ice.Message, file string) {
|
|||||||
m.Cmd(nfs.CAT, file, func(ls []string, line string) {
|
m.Cmd(nfs.CAT, file, func(ls []string, line string) {
|
||||||
switch {
|
switch {
|
||||||
case strings.HasPrefix(line, MODULE):
|
case strings.HasPrefix(line, MODULE):
|
||||||
require[ls[1]] = ""
|
require[ls[1]] = m.Cmdx(cli.SYSTEM, GIT, "describe", "--tags")
|
||||||
replace[ls[1]] = nfs.PWD
|
replace[ls[1]] = nfs.PWD
|
||||||
case strings.HasPrefix(line, REQUIRE+" ("):
|
case strings.HasPrefix(line, REQUIRE+" ("):
|
||||||
block = REQUIRE
|
block = REQUIRE
|
||||||
@ -155,6 +163,7 @@ func _mod_show(m *ice.Message, file string) {
|
|||||||
m.Push(REPLACE, kit.Select("", replace[k]))
|
m.Push(REPLACE, kit.Select("", replace[k]))
|
||||||
}
|
}
|
||||||
m.Sort(REPLACE)
|
m.Sort(REPLACE)
|
||||||
|
m.StatusTimeCount()
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -183,7 +192,9 @@ func init() {
|
|||||||
m.Cmdy(cli.SYSTEM, GO, "doc", strings.TrimSuffix(arg[1], ice.PT+arg[0]), kit.Dict(cli.CMD_DIR, arg[2])).SetAppend()
|
m.Cmdy(cli.SYSTEM, GO, "doc", strings.TrimSuffix(arg[1], ice.PT+arg[0]), kit.Dict(cli.CMD_DIR, arg[2])).SetAppend()
|
||||||
}},
|
}},
|
||||||
}, PlugAction())},
|
}, PlugAction())},
|
||||||
SUM: {Name: "sum", Help: "版本", Action: PlugAction()},
|
SUM: {Name: "sum", Help: "版本", Action: ice.MergeAction(map[string]*ice.Action{
|
||||||
|
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) { _sum_show(m, path.Join(arg[2], arg[1])) }},
|
||||||
|
}, PlugAction())},
|
||||||
MOD: {Name: "mod", Help: "模块", Action: ice.MergeAction(map[string]*ice.Action{
|
MOD: {Name: "mod", Help: "模块", Action: ice.MergeAction(map[string]*ice.Action{
|
||||||
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) { _mod_show(m, path.Join(arg[2], arg[1])) }},
|
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) { _mod_show(m, path.Join(arg[2], arg[1])) }},
|
||||||
}, PlugAction())},
|
}, PlugAction())},
|
||||||
|
@ -125,7 +125,10 @@ func init() {
|
|||||||
ice.RUN: {Name: "run", Help: "执行"},
|
ice.RUN: {Name: "run", Help: "执行"},
|
||||||
}, ctx.CmdAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, ctx.CmdAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
if arg = _name(m, arg); strings.Contains(arg[1], ice.NL) {
|
if arg = _name(m, arg); strings.Contains(arg[1], ice.NL) {
|
||||||
arg = append([]string{arg[0], "web.chat.div", "auto.cmd", "split", "opts.text", arg[1]}, arg[2:]...)
|
arg = kit.Simple(arg[0], "web.chat.div", "auto.cmd", "split", "opts.text", arg[1], arg[2:])
|
||||||
|
}
|
||||||
|
if arg[1] == "args" {
|
||||||
|
arg = kit.Simple("", arg)
|
||||||
}
|
}
|
||||||
_field_show(m, arg[0], arg[1], arg[2:]...)
|
_field_show(m, arg[0], arg[1], arg[2:]...)
|
||||||
}},
|
}},
|
||||||
|
4
meta.go
4
meta.go
@ -116,7 +116,7 @@ func (m *Message) Push(key string, value interface{}, arg ...interface{}) *Messa
|
|||||||
var v interface{}
|
var v interface{}
|
||||||
switch k {
|
switch k {
|
||||||
case KEY, HASH:
|
case KEY, HASH:
|
||||||
if key != "" && key != "detail" {
|
if key != "" && key != CACHE_DETAIL {
|
||||||
v = key
|
v = key
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -133,7 +133,7 @@ func (m *Message) Push(key string, value interface{}, arg ...interface{}) *Messa
|
|||||||
|
|
||||||
// 追加数据
|
// 追加数据
|
||||||
switch v := kit.Format(v); key {
|
switch v := kit.Format(v); key {
|
||||||
case "detail":
|
case CACHE_DETAIL:
|
||||||
m.Add(MSG_APPEND, KEY, k)
|
m.Add(MSG_APPEND, KEY, k)
|
||||||
m.Add(MSG_APPEND, VALUE, v)
|
m.Add(MSG_APPEND, VALUE, v)
|
||||||
default:
|
default:
|
||||||
|
4
misc.go
4
misc.go
@ -85,7 +85,7 @@ func (m *Message) Split(str string, arg ...string) *Message { // field sp nl
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *Message) FieldsIsDetail() bool {
|
func (m *Message) FieldsIsDetail() bool {
|
||||||
if m.OptionFields() == "detail" {
|
if m.OptionFields() == CACHE_DETAIL {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if len(m.meta[MSG_APPEND]) == 2 && m.meta[MSG_APPEND][0] == KEY && m.meta[MSG_APPEND][1] == VALUE {
|
if len(m.meta[MSG_APPEND]) == 2 && m.meta[MSG_APPEND][0] == KEY && m.meta[MSG_APPEND][1] == VALUE {
|
||||||
@ -95,7 +95,7 @@ func (m *Message) FieldsIsDetail() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *Message) PushDetail(value interface{}, arg ...interface{}) *Message {
|
func (m *Message) PushDetail(value interface{}, arg ...interface{}) *Message {
|
||||||
return m.Push("detail", value, arg...)
|
return m.Push(CACHE_DETAIL, value, arg...)
|
||||||
}
|
}
|
||||||
func (m *Message) IsErr(arg ...string) bool {
|
func (m *Message) IsErr(arg ...string) bool {
|
||||||
return len(arg) > 0 && m.Result(1) == arg[0] || m.Result(0) == ErrWarn
|
return len(arg) > 0 && m.Result(1) == arg[0] || m.Result(0) == ErrWarn
|
||||||
|
@ -81,7 +81,7 @@ func (m *Message) OptionTemplate() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *Message) Fields(length int, fields ...string) string {
|
func (m *Message) Fields(length int, fields ...string) string {
|
||||||
return m.Option(MSG_FIELDS, kit.Select(kit.Select("detail", fields, length), m.Option(MSG_FIELDS)))
|
return m.Option(MSG_FIELDS, kit.Select(kit.Select(CACHE_DETAIL, fields, length), m.Option(MSG_FIELDS)))
|
||||||
}
|
}
|
||||||
func (m *Message) Upload(dir string) {
|
func (m *Message) Upload(dir string) {
|
||||||
up := kit.Simple(m.Optionv(MSG_UPLOAD))
|
up := kit.Simple(m.Optionv(MSG_UPLOAD))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user