mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 09:34:05 +08:00
opt vimer.js
This commit is contained in:
parent
05c4c401e6
commit
475250ec71
@ -169,21 +169,22 @@ func init() {
|
|||||||
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case cli.MAIN:
|
case cli.MAIN:
|
||||||
m.Cmdy(nfs.DIR, ice.SRC, nfs.DIR_CLI_FIELDS, kit.Dict(nfs.DIR_REG, `.*\.go`)).RenameAppend(nfs.PATH, arg[0])
|
m.Option(nfs.DIR_ROOT, ice.SRC)
|
||||||
|
m.Cmdy(nfs.DIR, nfs.PWD, nfs.DIR_CLI_FIELDS, kit.Dict(nfs.DIR_REG, `.*\.go`)).RenameAppend(nfs.PATH, arg[0])
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
mdb.CREATE: {Name: "create main=src/main.go@key zone name=hi help type=Hash,Zone,Lists,Data,Code key", Help: "模块", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create name=hi help type=Hash,Zone,Lists,Data,Code main=main.go@key zone 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.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)))
|
_defs(m, mdb.KEY, kit.Keys("web.code", m.Option(mdb.ZONE), m.Option(mdb.NAME)))
|
||||||
m.Option(mdb.TEXT, kit.Format("`name:\"%s\" help:\"%s\"`", _defs_list(m), m.Option(mdb.HELP)))
|
m.Option(mdb.TEXT, kit.Format("`name:\"%s\" help:\"%s\"`", _defs_list(m), m.Option(mdb.HELP)))
|
||||||
|
|
||||||
if p := path.Join(ice.SRC, m.Option(mdb.ZONE), kit.Keys(m.Option(mdb.NAME), GO)); !kit.FileExists(p) {
|
if p := path.Join(ice.SRC, m.Option(mdb.ZONE), kit.Keys(m.Option(mdb.NAME), GO)); !kit.FileExists(p) {
|
||||||
_autogen_module(m, p)
|
_autogen_module(m, p)
|
||||||
_autogen_import(m, m.Option(cli.MAIN), m.Option(mdb.ZONE), _autogen_mod(m, ice.GO_MOD))
|
_autogen_import(m, path.Join(ice.SRC, m.Option(cli.MAIN)), m.Option(mdb.ZONE), _autogen_mod(m, ice.GO_MOD))
|
||||||
}
|
}
|
||||||
if p := path.Join(ice.SRC, m.Option(mdb.ZONE), kit.Keys(m.Option(mdb.NAME), SHY)); !kit.FileExists(p) {
|
if p := path.Join(ice.SRC, m.Option(mdb.ZONE), kit.Keys(m.Option(mdb.NAME), SHY)); !kit.FileExists(p) {
|
||||||
_autogen_script(m, p)
|
_autogen_script(m, p)
|
||||||
_autogen_source(m, m.Option(cli.MAIN), p)
|
_autogen_source(m, path.Join(ice.SRC, m.Option(cli.MAIN)), p)
|
||||||
}
|
}
|
||||||
m.Option(nfs.FILE, path.Join(m.Option(mdb.ZONE), kit.Keys(m.Option(mdb.NAME), GO)))
|
m.Option(nfs.FILE, path.Join(m.Option(mdb.ZONE), kit.Keys(m.Option(mdb.NAME), GO)))
|
||||||
_autogen_version(m.Spawn())
|
_autogen_version(m.Spawn())
|
||||||
|
@ -73,15 +73,15 @@ func init() {
|
|||||||
_autogen_version(m.Spawn())
|
_autogen_version(m.Spawn())
|
||||||
m.Cmd(cli.SYSTEM, GO, "get", "shylinux.com/x/ice")
|
m.Cmd(cli.SYSTEM, GO, "get", "shylinux.com/x/ice")
|
||||||
|
|
||||||
cli.PushStream(m)
|
|
||||||
|
|
||||||
// 执行编译
|
// 执行编译
|
||||||
|
cli.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), 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(m.Configv(cli.ENV), cli.HOME, kit.Env(cli.HOME), cli.PATH, kit.Env(cli.PATH), cli.GOOS, goos, cli.GOARCH, arch))
|
||||||
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)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
m.Option(cli.CMD_OUTPUT, "")
|
||||||
|
|
||||||
// 编译成功
|
// 编译成功
|
||||||
m.Log_EXPORT(nfs.SOURCE, main, nfs.TARGET, file)
|
m.Log_EXPORT(nfs.SOURCE, main, nfs.TARGET, file)
|
||||||
|
@ -83,7 +83,10 @@ func _go_doc(m *ice.Message, mod string, pkg string) *ice.Message {
|
|||||||
|
|
||||||
func _go_exec(m *ice.Message, arg ...string) {
|
func _go_exec(m *ice.Message, arg ...string) {
|
||||||
if m.Option("some") == "run" {
|
if m.Option("some") == "run" {
|
||||||
m.Cmdy(cli.SYSTEM, "./bin/ice.bin", ice.GetFileCmd(path.Join(arg[2], arg[1])))
|
args := []string{"./bin/ice.bin", ice.GetFileCmd(path.Join(arg[2], arg[1]))}
|
||||||
|
m.Cmdy(cli.SYSTEM, args)
|
||||||
|
m.StatusTime("args", kit.Join(args, " "))
|
||||||
|
m.Debug(m.FormatsMeta())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if m.Option(mdb.TEXT) == "" {
|
if m.Option(mdb.TEXT) == "" {
|
||||||
|
@ -33,7 +33,7 @@ func _inner_exec(m *ice.Message, ext, file, dir string, arg ...string) {
|
|||||||
if !m.Right(dir, file) {
|
if !m.Right(dir, file) {
|
||||||
return // 没有权限
|
return // 没有权限
|
||||||
}
|
}
|
||||||
defer m.StatusTime()
|
// defer m.StatusTime()
|
||||||
if m.Cmdy(mdb.ENGINE, ext, file, dir, arg); m.Result() != "" {
|
if m.Cmdy(mdb.ENGINE, ext, file, dir, arg); m.Result() != "" {
|
||||||
return // 执行成功
|
return // 执行成功
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ import (
|
|||||||
func _js_main_script(m *ice.Message, arg ...string) (res []string) {
|
func _js_main_script(m *ice.Message, arg ...string) (res []string) {
|
||||||
if res = append(res, kit.Format(`global.plugin = "%s"`, kit.Path(arg[2], arg[1]))); len(ice.Info.Pack) == 0 {
|
if res = append(res, kit.Format(`global.plugin = "%s"`, kit.Path(arg[2], arg[1]))); len(ice.Info.Pack) == 0 {
|
||||||
res = append(res, kit.Format(`require("%s")`, kit.Path("usr/volcanos/proto.js")))
|
res = append(res, kit.Format(`require("%s")`, kit.Path("usr/volcanos/proto.js")))
|
||||||
|
res = append(res, kit.Format(`require("%s")`, kit.Path("usr/volcanos/publish/client/nodejs/proto.js")))
|
||||||
} else {
|
} else {
|
||||||
for _, file := range []string{"proto.js", "frame.js", "lib/base.js", "lib/core.js", "lib/misc.js", "lib/page.js", "publish/client/nodejs/proto.js"} {
|
for _, file := range []string{"proto.js", "frame.js", "lib/base.js", "lib/core.js", "lib/misc.js", "lib/page.js", "publish/client/nodejs/proto.js"} {
|
||||||
res = append(res, `_can_name = "./`+file+`"`)
|
res = append(res, `_can_name = "./`+file+`"`)
|
||||||
@ -29,6 +30,14 @@ func _js_main_script(m *ice.Message, arg ...string) (res []string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func _js_exec(m *ice.Message, arg ...string) {
|
func _js_exec(m *ice.Message, arg ...string) {
|
||||||
|
if m.Option("some") == "run" {
|
||||||
|
args := kit.Simple("node", "-e", kit.Join(_js_main_script(m, arg...), ice.NL))
|
||||||
|
m.Cmdy(cli.SYSTEM, args)
|
||||||
|
m.StatusTime("args", kit.Join([]string{"./bin/ice.bin", "web.code.js.js", "exec", path.Join(arg[2], arg[1])}, " "))
|
||||||
|
m.Debug(m.FormatsMeta())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if m.Option(mdb.NAME) == ice.PT {
|
if m.Option(mdb.NAME) == ice.PT {
|
||||||
switch m.Option(mdb.TYPE) {
|
switch m.Option(mdb.TYPE) {
|
||||||
case "msg":
|
case "msg":
|
||||||
@ -70,11 +79,16 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m.Display(path.Join("/require", path.Join(arg[2], arg[1])))
|
m.Display(path.Join("/require", path.Join(arg[2], arg[1])))
|
||||||
m.ProcessCommand(kit.Select("can.code.inner.plugin", key), kit.Simple())
|
m.ProcessCommand(kit.Select("can.code.inner._plugin", key), kit.Simple())
|
||||||
}},
|
}},
|
||||||
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.ENGINE: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
_js_exec(m, arg...)
|
_js_exec(m, arg...)
|
||||||
}},
|
}},
|
||||||
|
"exec": {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Option("some", "run")
|
||||||
|
_js_exec(m, "", arg[0], "")
|
||||||
|
}},
|
||||||
|
|
||||||
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 {
|
||||||
return
|
return
|
||||||
|
@ -89,6 +89,8 @@ func _vimer_inputs(m *ice.Message, arg ...string) {
|
|||||||
|
|
||||||
case web.DREAM:
|
case web.DREAM:
|
||||||
m.Cmdy(web.DREAM, mdb.INPUTS, arg)
|
m.Cmdy(web.DREAM, mdb.INPUTS, arg)
|
||||||
|
case AUTOGEN:
|
||||||
|
m.Cmdy(AUTOGEN, mdb.INPUTS, arg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,70 +147,82 @@ func _vimer_go_complete(m *ice.Message, name string, arg ...string) *ice.Message
|
|||||||
const VIMER = "vimer"
|
const VIMER = "vimer"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: ice.Commands{
|
Index.Merge(&ice.Context{
|
||||||
VIMER: {Name: "vimer path=src/ file=main.go line=1 list", Help: "编辑器", Meta: kit.Dict(ice.DisplayLocal("", INNER)), Actions: ice.Actions{
|
Configs: ice.Configs{
|
||||||
nfs.SAVE: {Name: "save type file path", Help: "保存", Hand: func(m *ice.Message, arg ...string) {
|
VIMER: {Name: VIMER, Help: "编辑器", Value: kit.Data()},
|
||||||
m.Option(nfs.CONTENT, kit.Select(_vimer_defs(m, kit.Ext(m.Option(nfs.FILE))), m.Option(nfs.CONTENT)))
|
},
|
||||||
m.Cmdy(nfs.SAVE, path.Join(m.Option(nfs.PATH), m.Option(nfs.FILE)))
|
Commands: ice.Commands{
|
||||||
}},
|
VIMER: {Name: "vimer path=src/ file=main.go line=1 list", Help: "编辑器", Meta: kit.Dict(ice.DisplayLocal("", INNER)), Actions: ice.Actions{
|
||||||
AUTOGEN: {Name: "create main=src/main.go zone name=hi help=示例 type=Zone,Hash,Lists,Data,Code key", Help: "模块", Hand: func(m *ice.Message, arg ...string) {
|
nfs.SAVE: {Name: "save type file path", Help: "保存", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(AUTOGEN, mdb.CREATE, arg)
|
m.Option(nfs.CONTENT, kit.Select(_vimer_defs(m, kit.Ext(m.Option(nfs.FILE))), m.Option(nfs.CONTENT)))
|
||||||
}},
|
m.Cmdy(nfs.SAVE, path.Join(m.Option(nfs.PATH), m.Option(nfs.FILE)))
|
||||||
COMPILE: {Name: "compile", Help: "编译", Hand: func(m *ice.Message, arg ...string) {
|
}},
|
||||||
if msg := m.Cmd(COMPILE, ice.SRC_MAIN_GO, ice.BIN_ICE_BIN); cli.IsSuccess(msg) {
|
nfs.TRASH: {Name: "trash path", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(UPGRADE, cli.RESTART)
|
m.Cmdy(nfs.TRASH, arg[0])
|
||||||
} else {
|
}},
|
||||||
_inner_make(m, msg)
|
AUTOGEN: {Name: "create name=hi help=示例 type=Zone,Hash,Lists,Data,Code main=main.go zone key", Help: "模块", Hand: func(m *ice.Message, arg ...string) {
|
||||||
}
|
m.Cmdy(AUTOGEN, mdb.CREATE, arg)
|
||||||
}},
|
}},
|
||||||
nfs.SCRIPT: {Name: "script file=hi/hi.js", Help: "脚本", Hand: func(m *ice.Message, arg ...string) {
|
COMPILE: {Name: "compile", Help: "编译", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Option(mdb.TEXT, strings.TrimSpace(kit.Select(_vimer_defs(m, kit.Ext(m.Option(nfs.FILE))), m.Option(mdb.TEXT))))
|
if msg := m.Cmd(COMPILE, ice.SRC_MAIN_GO, ice.BIN_ICE_BIN); cli.IsSuccess(msg) {
|
||||||
m.Cmdy(TEMPLATE, nfs.DEFS)
|
m.Cmd(UPGRADE, cli.RESTART)
|
||||||
}},
|
} else {
|
||||||
nfs.WEBSITE: {Name: "website file=hi.zml", Help: "网页", Hand: func(m *ice.Message, arg ...string) {
|
_inner_make(m, msg)
|
||||||
m.Option(mdb.TEXT, strings.TrimSpace(kit.Select(_vimer_defs(m, kit.Ext(m.Option(nfs.FILE))), m.Option(mdb.TEXT))))
|
}
|
||||||
m.Option(nfs.FILE, path.Join(nfs.WEBSITE, m.Option(nfs.FILE)))
|
}},
|
||||||
m.Cmdy(TEMPLATE, nfs.DEFS)
|
nfs.SCRIPT: {Name: "script file=hi/hi.js", Help: "脚本", Hand: func(m *ice.Message, arg ...string) {
|
||||||
}},
|
m.Option(mdb.TEXT, strings.TrimSpace(kit.Select(_vimer_defs(m, kit.Ext(m.Option(nfs.FILE))), m.Option(mdb.TEXT))))
|
||||||
web.DREAM: {Name: "dream name=hi repos", Help: "空间", Hand: func(m *ice.Message, arg ...string) {
|
m.Cmdy(TEMPLATE, nfs.DEFS)
|
||||||
m.Cmdy(web.DREAM, cli.START, arg)
|
}},
|
||||||
}},
|
nfs.WEBSITE: {Name: "website file=hi.zml", Help: "网页", Hand: func(m *ice.Message, arg ...string) {
|
||||||
PUBLISH: {Name: "publish", Help: "发布", Hand: func(m *ice.Message, arg ...string) {
|
m.Option(mdb.TEXT, strings.TrimSpace(kit.Select(_vimer_defs(m, kit.Ext(m.Option(nfs.FILE))), m.Option(mdb.TEXT))))
|
||||||
m.Cmdy(PUBLISH, ice.CONTEXTS)
|
m.Option(nfs.FILE, path.Join(nfs.WEBSITE, m.Option(nfs.FILE)))
|
||||||
}},
|
m.Cmdy(TEMPLATE, nfs.DEFS)
|
||||||
|
}},
|
||||||
|
web.DREAM: {Name: "dream name=hi repos", Help: "空间", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmdy(web.DREAM, cli.START, arg)
|
||||||
|
}},
|
||||||
|
PUBLISH: {Name: "publish", Help: "发布", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmdy(PUBLISH, ice.CONTEXTS)
|
||||||
|
}},
|
||||||
|
|
||||||
mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
mdb.SEARCH: {Name: "search type name text", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if arg[0] == mdb.FOREACH && arg[1] == "" {
|
if arg[0] == mdb.FOREACH && arg[1] == "" {
|
||||||
m.PushSearch(mdb.TYPE, "go", mdb.NAME, "src/main.go", mdb.TEXT, m.MergeCmd(""))
|
m.PushSearch(mdb.TYPE, "go", mdb.NAME, "src/main.go", mdb.TEXT, m.MergeCmd(""))
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_vimer_inputs(m, arg...)
|
_vimer_inputs(m, arg...)
|
||||||
}},
|
}},
|
||||||
"complete": {Name: "complete", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
"complete": {Name: "complete", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_vimer_complete(m, arg...)
|
_vimer_complete(m, arg...)
|
||||||
}},
|
}},
|
||||||
"listTags": {Name: "listTags", Help: "索引", Hand: func(m *ice.Message, arg ...string) {
|
"listTags": {Name: "listTags", Help: "索引", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy("web.code.vim.tags", "listTags", arg)
|
m.Cmdy("web.code.vim.tags", "listTags", arg)
|
||||||
}},
|
}},
|
||||||
|
|
||||||
"unpack": {Name: "unpack", Help: "导出文件", Hand: func(m *ice.Message, arg ...string) {
|
"unpack": {Name: "unpack", Help: "导出文件", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(BINPACK, mdb.EXPORT)
|
m.Cmdy(BINPACK, mdb.EXPORT)
|
||||||
|
}},
|
||||||
|
DEVPACK: {Name: "devpack", Help: "开发模式", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmd(nfs.LINK, ice.GO_SUM, path.Join(ice.SRC_DEBUG, ice.GO_SUM))
|
||||||
|
m.Cmd(nfs.LINK, ice.GO_MOD, path.Join(ice.SRC_DEBUG, ice.GO_MOD))
|
||||||
|
m.Cmdy(nfs.CAT, ice.GO_MOD)
|
||||||
|
m.Cmdy(WEBPACK, mdb.REMOVE)
|
||||||
|
m.ProcessInner()
|
||||||
|
m.ToastSuccess()
|
||||||
|
}},
|
||||||
|
BINPACK: {Name: "binpack", Help: "打包模式", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmdy(WEBPACK, mdb.CREATE)
|
||||||
|
m.Cmdy(AUTOGEN, BINPACK)
|
||||||
|
m.ProcessInner()
|
||||||
|
m.ToastSuccess()
|
||||||
|
}},
|
||||||
|
}, Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmdy(INNER, arg)
|
||||||
|
m.Option("plug", m.Config("show.plug"))
|
||||||
|
m.Option("exts", m.Config("show.exts"))
|
||||||
|
m.Option("tabs", m.Config("show.tabs"))
|
||||||
}},
|
}},
|
||||||
DEVPACK: {Name: "devpack", Help: "开发模式", Hand: func(m *ice.Message, arg ...string) {
|
}})
|
||||||
m.Cmd(nfs.LINK, ice.GO_SUM, path.Join(ice.SRC_DEBUG, ice.GO_SUM))
|
|
||||||
m.Cmd(nfs.LINK, ice.GO_MOD, path.Join(ice.SRC_DEBUG, ice.GO_MOD))
|
|
||||||
m.Cmdy(nfs.CAT, ice.GO_MOD)
|
|
||||||
m.Cmdy(WEBPACK, mdb.REMOVE)
|
|
||||||
m.ProcessInner()
|
|
||||||
m.ToastSuccess()
|
|
||||||
}},
|
|
||||||
BINPACK: {Name: "binpack", Help: "打包模式", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
m.Cmdy(WEBPACK, mdb.CREATE)
|
|
||||||
m.Cmdy(AUTOGEN, BINPACK)
|
|
||||||
m.ProcessInner()
|
|
||||||
m.ToastSuccess()
|
|
||||||
}},
|
|
||||||
}, Hand: func(m *ice.Message, arg ...string) { m.Cmdy(INNER, arg) }},
|
|
||||||
}})
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user