1
0
mirror of https://shylinux.com/x/icebergs synced 2025-06-26 18:37:29 +08:00
This commit is contained in:
harveyshao 2022-03-03 14:40:49 +08:00
parent 16b8cb1ded
commit a3a764d0d6
5 changed files with 27 additions and 5 deletions

View File

@ -155,6 +155,10 @@ func init() {
if len(arg) == 1 { if len(arg) == 1 {
arg = kit.Split(arg[0]) arg = kit.Split(arg[0])
} }
if strings.HasSuffix(arg[0], ".sh") {
arg = []string{"sh", path.Join("src", arg[0])}
}
m.Debug("arg %v", arg)
_system_exec(m, _system_cmd(m, arg...)) _system_exec(m, _system_cmd(m, arg...))
}}, }},
}}) }})

View File

@ -55,10 +55,22 @@ func _website_parse(m *ice.Message, text string, args ...string) (map[string]int
ls[0] = kit.Select("can.code.inner.plugin", key) ls[0] = kit.Select("can.code.inner.plugin", key)
data[ctx.DISPLAY] = display data[ctx.DISPLAY] = display
case nfs.GO: case nfs.GO:
ls[0] = ice.GetFileKey(display) key := ice.GetFileKey(display)
if key == "" {
for k, v := range ice.Info.File {
if strings.HasSuffix(k, ls[0]) {
key = v
}
}
}
ls[0] = key
case nfs.SH: case nfs.SH:
ls[0] = ice.GetFileKey(display) key := ice.GetFileKey(display)
data[ctx.DISPLAY] = display if key == "" {
key = "cli.system"
}
data[ctx.ARGS] = kit.List(ls[0])
ls[0] = key
} }
if ls[0] == "" { if ls[0] == "" {

View File

@ -76,7 +76,7 @@ func init() {
m.Cmd(BINPACK, mdb.REMOVE) m.Cmd(BINPACK, mdb.REMOVE)
} }
if kit.FileExists("src/website/index.txt") { if kit.FileExists("src/website/index.txt") {
if s := m.Cmdx("web.chat.website", "show", "index.txt", "Header.style.display", "block"); s != "" { if s := m.Cmdx("web.chat.website", "show", "index.txt", "Header", "", "River", "", "Action", "", "Footer", ""); s != "" {
ice.Info.Pack["/page/index.html"] = []byte(s) ice.Info.Pack["/page/index.html"] = []byte(s)
} }
} }

View File

@ -31,7 +31,6 @@ func init() {
}}, }},
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) { mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(cli.SYSTEM, SH, "-c", kit.Join(_sh_main_script(m, arg...), ice.NL)).SetAppend() m.Cmdy(cli.SYSTEM, SH, "-c", kit.Join(_sh_main_script(m, arg...), ice.NL)).SetAppend()
}}, }},
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) { mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
if arg[0] == mdb.FOREACH { if arg[0] == mdb.FOREACH {

View File

@ -2,6 +2,7 @@ package code
import ( import (
"path" "path"
"strings"
ice "shylinux.com/x/icebergs" ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/cli" "shylinux.com/x/icebergs/base/cli"
@ -22,6 +23,12 @@ func init() {
m.Cmdy(AUTOGEN, mdb.CREATE, arg) m.Cmdy(AUTOGEN, mdb.CREATE, arg)
}}, }},
"script": {Name: "script file=hi/hi.js text=", Help: "脚本", Hand: func(m *ice.Message, arg ...string) { "script": {Name: "script file=hi/hi.js text=", Help: "脚本", Hand: func(m *ice.Message, arg ...string) {
m.Option(mdb.TEXT, strings.TrimSpace(m.Option(mdb.TEXT)))
m.Cmdy(TEMPLATE, nfs.DEFS)
}},
"website": {Name: "script file=hi.txt text=", Help: "网页", Hand: func(m *ice.Message, arg ...string) {
m.Option(nfs.FILE, path.Join("website", m.Option(nfs.FILE)))
m.Option(mdb.TEXT, strings.TrimSpace(m.Option(mdb.TEXT)))
m.Cmdy(TEMPLATE, nfs.DEFS) m.Cmdy(TEMPLATE, nfs.DEFS)
}}, }},
COMPILE: {Name: "compile", Help: "编译", Hand: func(m *ice.Message, arg ...string) { COMPILE: {Name: "compile", Help: "编译", Hand: func(m *ice.Message, arg ...string) {