forked from x/icebergs
opt some
This commit is contained in:
parent
c9b0addd91
commit
df37f1f977
@ -41,6 +41,7 @@ func _system_show(m *ice.Message, cmd *exec.Cmd) {
|
|||||||
m.Warn(e != nil, ErrRun, strings.Join(cmd.Args, " "), "\n", kit.Select(e.Error(), err.String()))
|
m.Warn(e != nil, ErrRun, strings.Join(cmd.Args, " "), "\n", kit.Select(e.Error(), err.String()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m.Push(kit.MDB_TIME, m.Time())
|
||||||
m.Push(CMD_CODE, int(cmd.ProcessState.ExitCode()))
|
m.Push(CMD_CODE, int(cmd.ProcessState.ExitCode()))
|
||||||
m.Push(CMD_ERR, err.String())
|
m.Push(CMD_ERR, err.String())
|
||||||
m.Push(CMD_OUT, out.String())
|
m.Push(CMD_OUT, out.String())
|
||||||
|
@ -97,6 +97,7 @@ const (
|
|||||||
START = "start"
|
START = "start"
|
||||||
STOP = "stop"
|
STOP = "stop"
|
||||||
|
|
||||||
|
RELOAD = "reload"
|
||||||
RESTART = "restart"
|
RESTART = "restart"
|
||||||
CHANGE = "change"
|
CHANGE = "change"
|
||||||
BUILD = "build"
|
BUILD = "build"
|
||||||
|
@ -48,18 +48,19 @@ func _inner_sub(m *ice.Message, action string, name string, arg ...string) bool
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func _inner_list(m *ice.Message, name string) {
|
func _inner_list(m *ice.Message, dir, file string) {
|
||||||
if _inner_sub(m, LIST, name) {
|
if _inner_sub(m, LIST, path.Join(dir, file)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if m.Set(ice.MSG_RESULT); strings.HasSuffix(name, "/") || _inner_source(m, name) {
|
if m.Set(ice.MSG_RESULT); file == "" || strings.HasSuffix(file, "/") || _inner_source(m, file) {
|
||||||
|
m.Option(nfs.DIR_ROOT, dir)
|
||||||
m.Option(nfs.DIR_DEEP, "true")
|
m.Option(nfs.DIR_DEEP, "true")
|
||||||
m.Option(nfs.DIR_TYPE, nfs.TYPE_FILE)
|
m.Option(nfs.DIR_TYPE, nfs.TYPE_FILE)
|
||||||
m.Cmdy(nfs.DIR, name, "path size time")
|
m.Cmdy(nfs.DIR, file, "path size time")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
m.Echo(name)
|
m.Echo(path.Join(dir, file))
|
||||||
}
|
}
|
||||||
func _inner_save(m *ice.Message, name, text string) {
|
func _inner_save(m *ice.Message, name, text string) {
|
||||||
if _inner_sub(m, SAVE, name) {
|
if _inner_sub(m, SAVE, name) {
|
||||||
@ -119,15 +120,12 @@ func _inner_show(m *ice.Message, dir, file string) {
|
|||||||
m.Echo(strings.ReplaceAll(strings.Join(m.Cmd("web.wiki.word", name).Resultv(), ""), "\n", " "))
|
m.Echo(strings.ReplaceAll(strings.Join(m.Cmd("web.wiki.word", name).Resultv(), ""), "\n", " "))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func _inner_main(m *ice.Message, arg ...string) {
|
func _inner_main(m *ice.Message, dir, file string) {
|
||||||
if len(arg) > 2 {
|
p := _inner_ext(file)
|
||||||
arg = arg[:2]
|
key := strings.TrimSuffix(path.Base(file), "."+p)
|
||||||
}
|
|
||||||
p := _inner_ext(arg[1])
|
|
||||||
key := strings.TrimSuffix(path.Base(arg[1]), "."+p)
|
|
||||||
switch p {
|
switch p {
|
||||||
case "godoc":
|
case "godoc":
|
||||||
m.Option(cli.CMD_DIR, arg[0])
|
m.Option(cli.CMD_DIR, dir)
|
||||||
m.Echo(m.Cmdx(cli.SYSTEM, "go", "doc", key))
|
m.Echo(m.Cmdx(cli.SYSTEM, "go", "doc", key))
|
||||||
|
|
||||||
case "man8", "man3", "man2", "man1":
|
case "man8", "man3", "man2", "man1":
|
||||||
@ -144,9 +142,9 @@ func _inner_main(m *ice.Message, arg ...string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
m.Echo(string(res))
|
m.Echo(string(res))
|
||||||
return
|
default:
|
||||||
|
_inner_list(m, dir, file)
|
||||||
}
|
}
|
||||||
_inner_list(m, path.Join(arg...))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -155,14 +153,16 @@ func init() {
|
|||||||
INNER: {Name: "inner", Help: "编辑器", Value: kit.Data(
|
INNER: {Name: "inner", Help: "编辑器", Value: kit.Data(
|
||||||
"protect", kit.Dict("etc", "true", "var", "true", "usr", "true"),
|
"protect", kit.Dict("etc", "true", "var", "true", "usr", "true"),
|
||||||
"source", kit.Dict(
|
"source", kit.Dict(
|
||||||
"txt", "true", "url", "true",
|
|
||||||
"sh", "true", "py", "true",
|
|
||||||
"shy", "true",
|
|
||||||
"go", "true", "js", "true",
|
|
||||||
"c", "true", "h", "true",
|
|
||||||
"makefile", "true",
|
"makefile", "true",
|
||||||
"mod", "true",
|
"c", "true", "h", "true",
|
||||||
"sum", "true",
|
"sh", "true", "shy", "true", "py", "true",
|
||||||
|
"mod", "true", "sum", "true",
|
||||||
|
"go", "true", "js", "true",
|
||||||
|
|
||||||
|
"md", "true", "csv", "true",
|
||||||
|
"txt", "true", "url", "true",
|
||||||
|
"conf", "true", "json", "true",
|
||||||
|
"ts", "true", "tsx", "true", "vue", "true", "sass", "true",
|
||||||
),
|
),
|
||||||
"plug", kit.Dict(
|
"plug", kit.Dict(
|
||||||
"py", kit.Dict(
|
"py", kit.Dict(
|
||||||
@ -171,6 +171,48 @@ func init() {
|
|||||||
),
|
),
|
||||||
"md", kit.Dict("display", true, "profile", true),
|
"md", kit.Dict("display", true, "profile", true),
|
||||||
"csv", kit.Dict("display", true),
|
"csv", kit.Dict("display", true),
|
||||||
|
"ts", kit.Dict(
|
||||||
|
"prefix", kit.Dict("//", "comment"),
|
||||||
|
"split", kit.Dict(
|
||||||
|
"space", " ",
|
||||||
|
"operator", "{[(.:,;!|)]}",
|
||||||
|
),
|
||||||
|
"keyword", kit.Dict(
|
||||||
|
"import", "keyword",
|
||||||
|
"from", "keyword",
|
||||||
|
"new", "keyword",
|
||||||
|
"as", "keyword",
|
||||||
|
"const", "keyword",
|
||||||
|
"export", "keyword",
|
||||||
|
"default", "keyword",
|
||||||
|
|
||||||
|
"if", "keyword",
|
||||||
|
"return", "keyword",
|
||||||
|
|
||||||
|
"class", "keyword",
|
||||||
|
"extends", "keyword",
|
||||||
|
"interface", "keyword",
|
||||||
|
"declare", "keyword",
|
||||||
|
"async", "keyword",
|
||||||
|
"await", "keyword",
|
||||||
|
"try", "keyword",
|
||||||
|
"catch", "keyword",
|
||||||
|
|
||||||
|
"function", "function",
|
||||||
|
"arguments", "function",
|
||||||
|
"console", "function",
|
||||||
|
"this", "function",
|
||||||
|
|
||||||
|
"string", "datatype",
|
||||||
|
"number", "datatype",
|
||||||
|
|
||||||
|
"true", "string",
|
||||||
|
"false", "string",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
"tsx", kit.Dict("link", "ts"),
|
||||||
|
"vue", kit.Dict("link", "ts"),
|
||||||
|
"sass", kit.Dict("link", "ts"),
|
||||||
),
|
),
|
||||||
"show", kit.Dict(
|
"show", kit.Dict(
|
||||||
"sh", []string{"sh"},
|
"sh", []string{"sh"},
|
||||||
@ -199,9 +241,6 @@ func init() {
|
|||||||
"find": {Name: "find word", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
"find": {Name: "find word", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
||||||
web.FavorList(m, arg[0], arg[1], arg[2:]...)
|
web.FavorList(m, arg[0], arg[1], arg[2:]...)
|
||||||
}},
|
}},
|
||||||
"project": {Name: "project path", Help: "项目", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
_inner_list(m, path.Join("./", kit.Select("", arg, 0))+"/")
|
|
||||||
}},
|
|
||||||
|
|
||||||
"history": {Name: "history path name", Help: "历史", Hand: func(m *ice.Message, arg ...string) {
|
"history": {Name: "history path name", Help: "历史", Hand: func(m *ice.Message, arg ...string) {
|
||||||
msg := m.Cmd(web.STORY, web.HISTORY, path.Join("./", arg[0], arg[1]))
|
msg := m.Cmd(web.STORY, web.HISTORY, path.Join("./", arg[0], arg[1]))
|
||||||
@ -248,7 +287,9 @@ func init() {
|
|||||||
mdb.SEARCH: {Name: "search type name text arg...", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
mdb.SEARCH: {Name: "search type name text arg...", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(mdb.SEARCH, arg)
|
m.Cmdy(mdb.SEARCH, arg)
|
||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) { _inner_main(m, arg...) }},
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
|
_inner_main(m, arg[0], kit.Select("", arg, 1))
|
||||||
|
}},
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
}
|
}
|
||||||
|
@ -360,7 +360,7 @@ func init() {
|
|||||||
_stack_show(m, arg[0], arg[1], arg[2:]...)
|
_stack_show(m, arg[0], arg[1], arg[2:]...)
|
||||||
}},
|
}},
|
||||||
|
|
||||||
WORD: {Name: "word path=hi.shy auto", Help: "语言文字", Meta: kit.Dict(
|
WORD: {Name: "word path=demo/hi.shy auto", Help: "语言文字", Meta: kit.Dict(
|
||||||
"display", "/plugin/local/wiki/word.js",
|
"display", "/plugin/local/wiki/word.js",
|
||||||
), Action: map[string]*ice.Action{
|
), Action: map[string]*ice.Action{
|
||||||
"story": {Name: "story", Help: "运行", Hand: func(m *ice.Message, arg ...string) {
|
"story": {Name: "story", Help: "运行", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user