mirror of
https://shylinux.com/x/icebergs
synced 2025-04-28 18:22:02 +08:00
opt some
This commit is contained in:
parent
5669803c4f
commit
56ce985dad
@ -61,22 +61,19 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
logs.Println("run %s", kit.Join(arg, ice.SP))
|
if logs.Println("run %s", kit.Join(arg, ice.SP)); IsSuccess(m.Cmd(SYSTEM, arg)) {
|
||||||
if IsSuccess(m.Cmd(SYSTEM, arg)) {
|
|
||||||
logs.Println(ice.EXIT) // 正常退出
|
logs.Println(ice.EXIT) // 正常退出
|
||||||
break
|
break
|
||||||
} else {
|
|
||||||
if m.Config("log.save") == ice.TRUE {
|
|
||||||
back := kit.Format("var/log.%s", logs.Now().Format("20060102_150405"))
|
|
||||||
m.Cmd(SYSTEM, "cp", "-r", "var/log", back, ice.Maps{CMD_OUTPUT: ""})
|
|
||||||
m.Cmd(SYSTEM, "cp", "bin/boot.log", path.Join(back, "boot.log"), ice.Maps{CMD_OUTPUT: ""})
|
|
||||||
// if IsSuccess(m.Cmd(SYSTEM, "grep", "fatal error: concurrent map read and map write", "bin/boot.log", ice.Maps{CMD_OUTPUT: ""})) {
|
|
||||||
// m.Cmd(SYSTEM, "cp", "bin/boot.log", path.Join(back, "boot.log"), ice.Maps{CMD_OUTPUT: ""})
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
logs.Println()
|
|
||||||
m.Sleep("1s")
|
|
||||||
}
|
}
|
||||||
|
if logs.Println(); m.Config("log.save") == ice.TRUE {
|
||||||
|
back := kit.Format("var/log.%s", logs.Now().Format("20060102_150405"))
|
||||||
|
m.Cmd(SYSTEM, "cp", "-r", "var/log", back, ice.Maps{CMD_OUTPUT: ""})
|
||||||
|
m.Cmd(SYSTEM, "cp", "bin/boot.log", path.Join(back, "boot.log"), ice.Maps{CMD_OUTPUT: ""})
|
||||||
|
// if IsSuccess(m.Cmd(SYSTEM, "grep", "fatal error: concurrent map read and map write", "bin/boot.log", ice.Maps{CMD_OUTPUT: ""})) {
|
||||||
|
// m.Cmd(SYSTEM, "cp", "bin/boot.log", path.Join(back, "boot.log"), ice.Maps{CMD_OUTPUT: ""})
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
m.Sleep("1s")
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
|
@ -6,9 +6,9 @@ const GREP = "grep"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
GREP: {Name: "grep path word auto", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
GREP: {Name: "grep word path auto", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Option("cmd_dir", arg[0])
|
m.Option("cmd_dir", arg[1])
|
||||||
m.Split(m.Cmdx("cli.system", GREP, "--exclude=.[a-z]*", "--exclude-dir=.[a-z]*", "-rni", arg[1], "."), "file:line:text", ":")
|
m.Split(m.Cmdx("cli.system", GREP, "--exclude=.[a-z]*", "--exclude-dir=.[a-z]*", "-rni", arg[0], ice.PT), "file:line:text", ice.DF)
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ func init() {
|
|||||||
// 执行编译
|
// 执行编译
|
||||||
web.PushStream(m)
|
web.PushStream(m)
|
||||||
main, file, goos, arch := _compile_target(m, arg...)
|
main, file, goos, arch := _compile_target(m, arg...)
|
||||||
m.Optionv(cli.CMD_ENV, kit.Simple(m.Configv(cli.ENV), m.Optionv(cli.CMD_ENV), cli.HOME, kit.Env(cli.HOME), cli.PATH, kit.Env(cli.PATH), cli.GOOS, goos, cli.GOARCH, arch))
|
m.Optionv(cli.CMD_ENV, kit.Simple(cli.HOME, kit.Env(cli.HOME), cli.PATH, kit.Env(cli.PATH), m.Configv(cli.ENV), m.Optionv(cli.ENV), cli.GOOS, goos, cli.GOARCH, arch))
|
||||||
m.Cmd(cli.SYSTEM, GO, "get", "shylinux.com/x/ice")
|
m.Cmd(cli.SYSTEM, GO, "get", "shylinux.com/x/ice")
|
||||||
if msg := m.Cmd(cli.SYSTEM, GO, cli.BUILD, "-o", file, main, ice.SRC_VERSION_GO, ice.SRC_BINPACK_GO); !cli.IsSuccess(msg) {
|
if msg := m.Cmd(cli.SYSTEM, GO, cli.BUILD, "-o", file, main, ice.SRC_VERSION_GO, ice.SRC_BINPACK_GO); !cli.IsSuccess(msg) {
|
||||||
m.Copy(msg)
|
m.Copy(msg)
|
||||||
|
@ -70,13 +70,6 @@ func _inner_line(m *ice.Message, file, text string) (string, int) {
|
|||||||
return "", 0
|
return "", 0
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
|
||||||
COMMENT = "comment"
|
|
||||||
KEYWORD = "keyword"
|
|
||||||
CONSTANT = "constant"
|
|
||||||
DATATYPE = "datatype"
|
|
||||||
FUNCTION = "function"
|
|
||||||
)
|
|
||||||
const (
|
const (
|
||||||
SPLIT = lex.SPLIT
|
SPLIT = lex.SPLIT
|
||||||
SPACE = lex.SPACE
|
SPACE = lex.SPACE
|
||||||
@ -84,6 +77,13 @@ const (
|
|||||||
PREFIX = lex.PREFIX
|
PREFIX = lex.PREFIX
|
||||||
SUFFIX = lex.SUFFIX
|
SUFFIX = lex.SUFFIX
|
||||||
)
|
)
|
||||||
|
const (
|
||||||
|
COMMENT = "comment"
|
||||||
|
KEYWORD = "keyword"
|
||||||
|
CONSTANT = "constant"
|
||||||
|
DATATYPE = "datatype"
|
||||||
|
FUNCTION = "function"
|
||||||
|
)
|
||||||
const (
|
const (
|
||||||
PLUG = "plug"
|
PLUG = "plug"
|
||||||
SHOW = "show"
|
SHOW = "show"
|
||||||
@ -92,7 +92,7 @@ const (
|
|||||||
const INNER = "inner"
|
const INNER = "inner"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
INNER: {Name: "inner path=src/@key file=main.go@key line=1 auto", Help: "源代码", Actions: ice.MergeActions(ice.Actions{
|
INNER: {Name: "inner path=src/@key file=main.go@key line=1 auto", Help: "源代码", Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(aaa.ROLE, aaa.WHITE, aaa.VOID, m.PrefixKey())
|
m.Cmd(aaa.ROLE, aaa.WHITE, aaa.VOID, m.PrefixKey())
|
||||||
@ -115,7 +115,7 @@ func init() {
|
|||||||
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) { _inner_exec(m, arg[0], arg[1], arg[2]) }},
|
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) { _inner_exec(m, arg[0], arg[1], arg[2]) }},
|
||||||
|
|
||||||
nfs.GREP: {Name: "grep", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
nfs.GREP: {Name: "grep", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(nfs.GREP, m.Option(nfs.PATH), arg[0]).StatusTimeCount(mdb.INDEX, 0)
|
m.Cmdy(nfs.GREP, arg[0], m.Option(nfs.PATH)).StatusTimeCount(mdb.INDEX, 0)
|
||||||
}},
|
}},
|
||||||
nfs.TAGS: {Name: "tags", Help: "索引", Hand: func(m *ice.Message, arg ...string) {
|
nfs.TAGS: {Name: "tags", Help: "索引", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if _inner_tags(m, m.Option(nfs.PATH), arg[0]); m.Length() == 0 {
|
if _inner_tags(m, m.Option(nfs.PATH), arg[0]); m.Length() == 0 {
|
||||||
@ -155,7 +155,7 @@ func init() {
|
|||||||
m.Option("exts", m.Config("show.exts"))
|
m.Option("exts", m.Config("show.exts"))
|
||||||
ctx.DisplayLocal(m, "")
|
ctx.DisplayLocal(m, "")
|
||||||
}},
|
}},
|
||||||
}})
|
})
|
||||||
}
|
}
|
||||||
func PlugAction() ice.Actions {
|
func PlugAction() ice.Actions {
|
||||||
return ice.Actions{
|
return ice.Actions{
|
||||||
|
@ -138,8 +138,9 @@ func init() {
|
|||||||
COMPILE: {Name: "compile", Help: "编译", Hand: func(m *ice.Message, arg ...string) {
|
COMPILE: {Name: "compile", Help: "编译", Hand: func(m *ice.Message, arg ...string) {
|
||||||
cmds := []string{COMPILE, ice.SRC_MAIN_GO, ice.BIN_ICE_BIN}
|
cmds := []string{COMPILE, ice.SRC_MAIN_GO, ice.BIN_ICE_BIN}
|
||||||
if strings.HasSuffix(os.Args[0], "contexts.app/Contents/MacOS/contexts") {
|
if strings.HasSuffix(os.Args[0], "contexts.app/Contents/MacOS/contexts") {
|
||||||
m.Option(cli.CMD_ENV, nfs.PATH, kit.Path("usr/local/go/bin"))
|
m.Option(cli.ENV, "CGO_ENABLED", "1", cli.HOME, kit.Env(cli.HOME), cli.PATH, kit.Path("usr/local/go/bin")+ice.DF+kit.Env(cli.PATH))
|
||||||
cmds = []string{cli.SYSTEM, "make", "app"}
|
cmds = []string{COMPILE, "src/webview.go", "usr/publish/contexts.app/Contents/MacOS/contexts"}
|
||||||
|
// cmds = []string{cli.SYSTEM, cli.MAKE, "app"}
|
||||||
}
|
}
|
||||||
if msg := m.Cmd(cmds); cli.IsSuccess(msg) {
|
if msg := m.Cmd(cmds); cli.IsSuccess(msg) {
|
||||||
m.Cmd(UPGRADE, cli.RESTART)
|
m.Cmd(UPGRADE, cli.RESTART)
|
||||||
|
2
exec.go
2
exec.go
@ -51,7 +51,7 @@ func (m *Message) Assert(expr Any) bool {
|
|||||||
m.Result(ErrWarn, expr)
|
m.Result(ErrWarn, expr)
|
||||||
panic(expr)
|
panic(expr)
|
||||||
}
|
}
|
||||||
func (m *Message) Sleep(d string, arg ...Any) *Message {
|
func (m *Message) Sleep(d Any, arg ...Any) *Message {
|
||||||
if time.Sleep(kit.Duration(d)); len(arg) > 0 {
|
if time.Sleep(kit.Duration(d)); len(arg) > 0 {
|
||||||
m.Cmdy(arg...)
|
m.Cmdy(arg...)
|
||||||
}
|
}
|
||||||
|
@ -234,8 +234,8 @@ func init() {
|
|||||||
PULL: {Name: "pull", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
|
PULL: {Name: "pull", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_status_each(m, PULL, cli.SYSTEM, GIT, PULL)
|
_status_each(m, PULL, cli.SYSTEM, GIT, PULL)
|
||||||
}},
|
}},
|
||||||
MAKE: {Name: "make", Help: "编译", Hand: func(m *ice.Message, arg ...string) {
|
code.COMPILE: {Name: "compile", Help: "编译", Hand: func(m *ice.Message, arg ...string) {
|
||||||
web.PushStream(m, cli.SYSTEM, MAKE)
|
m.Cmdy(code.VIMER, code.COMPILE)
|
||||||
}},
|
}},
|
||||||
PUSH: {Name: "push", Help: "上传", Hand: func(m *ice.Message, arg ...string) {
|
PUSH: {Name: "push", Help: "上传", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Option(REPOS) == "" {
|
if m.Option(REPOS) == "" {
|
||||||
@ -322,8 +322,8 @@ func init() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
web.ToastProcess(m)
|
web.ToastProcess(m, "status")
|
||||||
m.Action(PULL, MAKE, PUSH, TAGS, PIE, code.PUBLISH)
|
m.Action(PULL, code.COMPILE, PUSH, TAGS, PIE, code.PUBLISH)
|
||||||
files, adds, dels, last := _status_list(m)
|
files, adds, dels, last := _status_list(m)
|
||||||
m.Status("cost", m.FormatCost(), "repos", m.Length(), "files", files, "adds", adds, "dels", dels, "last", last.Format(ice.MOD_TIME))
|
m.Status("cost", m.FormatCost(), "repos", m.Length(), "files", files, "adds", adds, "dels", dels, "last", last.Format(ice.MOD_TIME))
|
||||||
web.Toast3s(m, kit.Format("files: %d, adds: %d, dels: %d", files, adds, dels), ice.CONTEXTS)
|
web.Toast3s(m, kit.Format("files: %d, adds: %d, dels: %d", files, adds, dels), ice.CONTEXTS)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user