1
0
mirror of https://shylinux.com/x/icebergs synced 2025-04-25 17:18:05 +08:00

opt tutor

This commit is contained in:
harveyshao 2022-02-13 14:24:26 +08:00
parent 5b80b021a9
commit c83cac512b
10 changed files with 24 additions and 12 deletions

View File

@ -101,7 +101,7 @@ func _system_exec(m *ice.Message, cmd *exec.Cmd) {
}
// 执行命令
if e := cmd.Run(); !m.Warn(e, ice.ErrNotFound, cmd.Args) {
if e := cmd.Run(); !m.Warn(e, ice.ErrNotFound, kit.Format(cmd.Args)) {
m.Cost(CODE, cmd.ProcessState.ExitCode(), ctx.ARGS, cmd.Args)
}

View File

@ -35,6 +35,7 @@ func _dream_show(m *ice.Message, name string) {
name = m.Time("20060102-") + kit.ReplaceAll(name, "-", "_")
}
defer m.ProcessOpen(m.MergePOD(m.Option(mdb.NAME, name)))
defer m.Echo(m.MergePOD(m.Option(mdb.NAME, name)))
// 任务目录
p := path.Join(m.Config(nfs.PATH), name)

View File

@ -171,11 +171,7 @@ func init() {
m.Cmd(code.PUBLISH, mdb.CREATE, nfs.FILE, ice.BIN_ICE_SH)
m.Cmd(code.PUBLISH, mdb.CREATE, nfs.FILE, ice.BIN_ICE_BIN)
}},
SHARE: {Name: "share", Help: "共享", Hand: func(m *ice.Message, arg ...string) {
_header_share(m, arg...)
}},
}, mdb.HashAction()), Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
mdb.HashSelect(m, arg...)
}},
SHARE: {Name: "share", Help: "共享", Hand: func(m *ice.Message, arg ...string) { _header_share(m, arg...) }},
}, mdb.HashAction())},
}})
}

View File

@ -59,6 +59,7 @@ func init() {
_action_domain(m, cmd, m.Option(mdb.HASH))
m.Cmdy(cmd, mdb.IMPORT)
}},
SHARE: {Name: "share", Help: "共享", Hand: func(m *ice.Message, arg ...string) { _header_share(m, arg...) }},
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
if len(arg) == 0 { // 应用列表
m.OptionFields("time,hash,type,name,count")

View File

@ -121,6 +121,8 @@ func init() {
res := _website_parse(m, m.Cmdx(nfs.CAT, path.Join(SRC_WEBSITE, arg[0])))
m.Echo(_website_template2, kit.Format(res))
}},
"inner": {Hand: func(m *ice.Message, arg ...string) {
}},
mdb.RENDER: {Hand: func(m *ice.Message, arg ...string) {
m.EchoIFrame(_website_url(m, strings.TrimPrefix(path.Join(arg[2], arg[1]), SRC_WEBSITE)))
}},

View File

@ -155,7 +155,7 @@ func init() {
mdb.CREATE: {Name: "create main=src/main.go@key zone name=hi help type=Hash,Zone,Lists,Data,Code list key", Help: "模块", Hand: func(m *ice.Message, arg ...string) {
_defs(m, mdb.ZONE, m.Option(mdb.NAME), mdb.HELP, m.Option(mdb.NAME))
_defs(m, mdb.KEY, kit.Keys("web.code", m.Option(mdb.ZONE), m.Option(mdb.NAME)))
switch m.Option(mdb.TYPE) {
switch kit.Select("Zone", m.Option(mdb.TYPE)) {
case "Hash":
_defs(m, "list", m.Option(mdb.NAME)+" hash auto create")
case "Zone":

View File

@ -35,7 +35,7 @@ func _field_show(m *ice.Message, name, text string, arg ...string) {
// 命令参数
meta, cmds := kit.Dict(), kit.Split(text)
m.Search(cmds[0], func(p *ice.Context, s *ice.Context, key string, cmd *ice.Command) {
if meta[FEATURE], meta[INPUTS] = cmd.Meta, cmd.List; name == "" {
if meta[FEATURE], meta[INPUTS] = kit.Dict(cmd.Meta), cmd.List; name == "" {
name = cmd.Help
}
})
@ -67,6 +67,7 @@ func _field_show(m *ice.Message, name, text string, arg ...string) {
case SPARK:
msg.Echo(strings.TrimSpace(arg[i+1]))
meta["msg"] = msg.FormatMeta()
kit.Value(meta, kit.Keys(FEATURE, "mode"), "simple")
case TABLE:
ls := kit.Split(arg[i+1], ice.NL, ice.NL, ice.NL)
@ -77,6 +78,7 @@ func _field_show(m *ice.Message, name, text string, arg ...string) {
}
}
meta["msg"] = msg.FormatMeta()
kit.Value(meta, kit.Keys(FEATURE, "mode"), "simple")
case ARGS:
args := kit.Simple(m.Optionv(arg[i]))
@ -95,6 +97,9 @@ func _field_show(m *ice.Message, name, text string, arg ...string) {
}
meta[INPUTS] = list
}
default:
msg.Option(arg[i], arg[i+1])
kit.Value(meta, kit.Keys(FEATURE, arg[i]), arg[i+1])
}
}
m.Option(mdb.META, meta)

View File

@ -24,7 +24,8 @@ func _spark_show(m *ice.Message, name, text string, arg ...string) {
m.Echo(`<div class="story" data-type="spark" data-name="%s" style="%s">`, name, m.Option("style"))
defer m.Echo("</div>")
if name == "inner" {
switch name {
case "inner", "field":
m.Echo(text)
return
}

View File

@ -89,8 +89,14 @@ func (m *Message) Warn(err interface{}, arg ...interface{}) bool {
case nil:
return false
}
m.meta[MSG_RESULT] = kit.Simple(ErrWarn, kit.Simple(arg...))
m.log(LOG_WARN, m.join(kit.Simple(arg...)))
if len(arg) == 0 {
arg = append(arg, "", "")
} else if len(arg) == 1 {
arg = append(arg, "")
}
m.meta[MSG_RESULT] = kit.Simple(ErrWarn, arg[0], arg[1], SP, m.join(kit.Simple(arg[2:]...)))
return true
}
func (m *Message) Error(err bool, str string, arg ...interface{}) bool {

View File

@ -154,7 +154,7 @@ func (m *Message) MergeURL2(url string, arg ...interface{}) string {
return kit.MergeURL2(m.Option(MSG_USERWEB), url, arg...)
}
func (m *Message) MergePOD(name string, arg ...interface{}) string {
return kit.MergePOD(m.Option(MSG_USERWEB), name, arg...)
return kit.MergePOD(kit.Select("http://localhost:9020", m.Option(MSG_USERWEB)), name, arg...)
}
func (m *Message) cmd(arg ...interface{}) *Message {