1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2022-08-14 22:13:50 +08:00
parent 6e1cc3119f
commit 70c4544bf7
43 changed files with 180 additions and 118 deletions

View File

@ -37,7 +37,7 @@ func init() {
} }
m.Cmd(FOREVER, STOP) m.Cmd(FOREVER, STOP)
m.Cmdy(FOREVER, kit.Select(os.Args[0], nfs.PWD+ice.BIN_ICE_BIN, kit.FileExists(ice.BIN_ICE_BIN)), m.Cmdy(FOREVER, kit.Select(os.Args[0], nfs.PWD+ice.BIN_ICE_BIN, nfs.ExistsFile(m, ice.BIN_ICE_BIN)),
"serve", START, ice.DEV, "", aaa.USERNAME, aaa.ROOT, aaa.PASSWORD, aaa.ROOT, arg) "serve", START, ice.DEV, "", aaa.USERNAME, aaa.ROOT, aaa.PASSWORD, aaa.ROOT, arg)
}}, }},
RESTART: {Name: "restart", Help: "重启", Hand: func(m *ice.Message, arg ...string) { RESTART: {Name: "restart", Help: "重启", Hand: func(m *ice.Message, arg ...string) {

View File

@ -35,15 +35,6 @@ func init() {
if IsAlpine(m, "git"); !IsAlpine(m, "go", "go git") { if IsAlpine(m, "git"); !IsAlpine(m, "go", "go git") {
mdb.ZoneInsert(m, CLI, "go", CMD, kit.Format("install download https://golang.google.cn/dl/go1.15.5.%s-%s.tar.gz usr/local", runtime.GOOS, runtime.GOARCH)) mdb.ZoneInsert(m, CLI, "go", CMD, kit.Format("install download https://golang.google.cn/dl/go1.15.5.%s-%s.tar.gz usr/local", runtime.GOOS, runtime.GOARCH))
} }
IsAlpine(m, "npm")
IsAlpine(m, "node", "nodejs")
IsAlpine(m, "java", "openjdk8")
IsAlpine(m, "javac", "openjdk8")
IsAlpine(m, "mvn", "maven openjdk8")
IsAlpine(m, "python", "python2")
IsAlpine(m, "python2")
IsAlpine(m, "python3")
}) })
}}, }},
mdb.INSERT: {Name: "insert cli osid cmd", Help: "添加"}, mdb.INSERT: {Name: "insert cli osid cmd", Help: "添加"},
@ -65,7 +56,16 @@ func init() {
func IsAlpine(m *ice.Message, arg ...string) bool { func IsAlpine(m *ice.Message, arg ...string) bool {
if strings.Contains(m.Conf(RUNTIME, kit.Keys(HOST, OSID)), ALPINE) { if strings.Contains(m.Conf(RUNTIME, kit.Keys(HOST, OSID)), ALPINE) {
if len(arg) > 0 { if len(arg) > 0 {
m.Cmd(mdb.INSERT, m.Prefix(MIRRORS), "", mdb.ZONE, arg[0], OSID, ALPINE, CMD, "system apk add "+kit.Select(arg[0], arg, 1)) m.Cmd(mdb.INSERT, kit.Keys(CLI, MIRRORS), "", mdb.ZONE, arg[0], OSID, ALPINE, CMD, "system apk add "+kit.Select(arg[0], arg, 1))
}
return true
}
return false
}
func IsCentos(m *ice.Message, arg ...string) bool {
if strings.Contains(m.Conf(RUNTIME, kit.Keys(HOST, OSID)), CENTOS) {
if len(arg) > 0 {
m.Cmd(mdb.INSERT, kit.Keys(CLI, MIRRORS), "", mdb.ZONE, arg[0], OSID, CENTOS, CMD, "yum install -y "+kit.Select(arg[0], arg, 1))
} }
return true return true
} }

View File

@ -27,6 +27,8 @@ func _runtime_init(m *ice.Message) {
m.Conf(RUNTIME, kit.Keys(HOST, PID), os.Getpid()) m.Conf(RUNTIME, kit.Keys(HOST, PID), os.Getpid())
m.Conf(RUNTIME, kit.Keys(HOST, HOME), kit.Env(HOME)) m.Conf(RUNTIME, kit.Keys(HOST, HOME), kit.Env(HOME))
m.Conf(RUNTIME, kit.Keys(HOST, MAXPROCS), runtime.GOMAXPROCS(0)) m.Conf(RUNTIME, kit.Keys(HOST, MAXPROCS), runtime.GOMAXPROCS(0))
m.Conf(RUNTIME, mdb.META, "")
m.Conf(RUNTIME, mdb.HASH, "")
// 启动目录 boot // 启动目录 boot
m.Conf(RUNTIME, kit.Keys(BOOT, HOSTNAME), kit.Env("HOSTNAME")) m.Conf(RUNTIME, kit.Keys(BOOT, HOSTNAME), kit.Env("HOSTNAME"))
@ -47,9 +49,9 @@ func _runtime_init(m *ice.Message) {
m.Conf(RUNTIME, kit.Keys(BOOT, mdb.COUNT), kit.Int(m.Conf(RUNTIME, kit.Keys(BOOT, mdb.COUNT)))+1) m.Conf(RUNTIME, kit.Keys(BOOT, mdb.COUNT), kit.Int(m.Conf(RUNTIME, kit.Keys(BOOT, mdb.COUNT)))+1)
bin := _system_find(m, os.Args[0]) bin := _system_find(m, os.Args[0])
m.Conf(RUNTIME, kit.Keys(BOOT, ice.BIN), bin) m.Conf(RUNTIME, kit.Keys(BOOT, ice.BIN), bin)
if s, e := os.Stat(bin); e == nil { if s, e := nfs.StatFile(m, bin); e == nil {
m.Conf(RUNTIME, kit.Keys(BOOT, nfs.SIZE), kit.FmtSize(s.Size())) m.Conf(RUNTIME, kit.Keys(BOOT, nfs.SIZE), kit.FmtSize(s.Size()))
if f, e := os.Open(bin); e == nil { if f, e := nfs.OpenFile(m, bin); e == nil {
defer f.Close() defer f.Close()
m.Conf(RUNTIME, kit.Keys(BOOT, mdb.HASH), kit.Hashs(f)) m.Conf(RUNTIME, kit.Keys(BOOT, mdb.HASH), kit.Hashs(f))
} }

View File

@ -42,7 +42,7 @@ func _system_cmd(m *ice.Message, arg ...string) *exec.Cmd {
// 运行目录 // 运行目录
if cmd.Dir = m.Option(CMD_DIR); len(cmd.Dir) > 0 { if cmd.Dir = m.Option(CMD_DIR); len(cmd.Dir) > 0 {
if m.Logs(mdb.EXPORT, CMD_DIR, cmd.Dir); !kit.FileExists(cmd.Dir) { if m.Logs(mdb.EXPORT, CMD_DIR, cmd.Dir); !nfs.ExistsFile(m, cmd.Dir) {
file.MkdirAll(cmd.Dir, ice.MOD_DIR) file.MkdirAll(cmd.Dir, ice.MOD_DIR)
} }
} }
@ -81,7 +81,7 @@ func _system_find(m *ice.Message, bin string, dir ...string) string {
dir = append(dir, strings.Split(kit.Env(PATH), ice.DF)...) dir = append(dir, strings.Split(kit.Env(PATH), ice.DF)...)
} }
for _, p := range dir { for _, p := range dir {
if kit.FileExists(path.Join(p, bin)) { if nfs.ExistsFile(m, path.Join(p, bin)) {
return kit.Path(path.Join(p, bin)) return kit.Path(path.Join(p, bin))
} }
} }

View File

@ -158,7 +158,7 @@ func FileURI(dir string) string {
if strings.HasPrefix(dir, ice.SRC) { if strings.HasPrefix(dir, ice.SRC) {
return path.Join("/require", dir) return path.Join("/require", dir)
} }
if kit.FileExists(path.Join(ice.SRC, dir)) { if nfs.ExistsFile(ice.Pulse, path.Join(ice.SRC, dir)) {
return path.Join("/require/src/", dir) return path.Join("/require/src/", dir)
} }
return dir return dir

View File

@ -173,19 +173,13 @@ const DIR = "dir"
func init() { func init() {
Index.MergeCommands(ice.Commands{ Index.MergeCommands(ice.Commands{
DIR: {Name: "dir path field auto upload what", Help: "目录", Actions: ice.Actions{ DIR: {Name: "dir path field auto upload", Help: "目录", Actions: ice.Actions{
mdb.UPLOAD: {Name: "upload", Help: "上传", Hand: func(m *ice.Message, arg ...string) { mdb.UPLOAD: {Name: "upload", Help: "上传", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy("web.cache", "upload_watch", m.Option(PATH)) m.Cmdy("web.cache", "upload_watch", m.Option(PATH))
}}, }},
TRASH: {Name: "trash", Help: "删除", Hand: func(m *ice.Message, arg ...string) { TRASH: {Name: "trash", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(TRASH, mdb.CREATE, m.Option(PATH)) m.Cmdy(TRASH, mdb.CREATE, m.Option(PATH))
}}, }},
"what": {Name: "trash", Help: "what", Hand: func(m *ice.Message, arg ...string) {
m.Option(DIR_ROOT, "usr/volcanos/plugin/local/code/inner/")
m.Option(DIR_DEEP, "true")
m.Cmdy(DIR, PWD)
m.Sort("path")
}},
}, Hand: func(m *ice.Message, arg ...string) { }, Hand: func(m *ice.Message, arg ...string) {
if m.Option(DIR_ROOT) != "" { if m.Option(DIR_ROOT) != "" {
m.Logs(mdb.SELECT, DIR_ROOT, m.Option(DIR_ROOT)) m.Logs(mdb.SELECT, DIR_ROOT, m.Option(DIR_ROOT))

View File

@ -37,7 +37,7 @@ func init() {
m.Cmdy("cli.system", "tar", "zcvf", arg) m.Cmdy("cli.system", "tar", "zcvf", arg)
return return
file, err := os.Create(arg[0]) file, _, err := CreateFile(m, arg[0])
m.Assert(err) m.Assert(err)
defer file.Close() defer file.Close()
@ -67,7 +67,7 @@ func init() {
return return
} }
file, err := os.Open(p) file, err := OpenFile(m, p)
if m.Warn(err) { if m.Warn(err) {
return return
} }

View File

@ -1,7 +1,6 @@
package web package web
import ( import (
"os"
"time" "time"
ice "shylinux.com/x/icebergs" ice "shylinux.com/x/icebergs"
@ -127,7 +126,7 @@ func _story_write(m *ice.Message, scene, name, text string, arg ...string) {
func _story_catch(m *ice.Message, scene, name string, arg ...string) { func _story_catch(m *ice.Message, scene, name string, arg ...string) {
if last := m.Richs(STORY, HEAD, name, nil); last != nil { if last := m.Richs(STORY, HEAD, name, nil); last != nil {
if t, e := time.ParseInLocation(ice.MOD_TIME, kit.Format(last[mdb.TIME]), time.Local); e == nil { if t, e := time.ParseInLocation(ice.MOD_TIME, kit.Format(last[mdb.TIME]), time.Local); e == nil {
if s, e := os.Stat(name); e == nil && s.ModTime().Before(t) { if s, e := nfs.StatFile(m, name); e == nil && s.ModTime().Before(t) {
m.Push(name, last, []string{mdb.TIME, mdb.COUNT, mdb.KEY}) m.Push(name, last, []string{mdb.TIME, mdb.COUNT, mdb.KEY})
m.Logs("info", "file", "exists") m.Logs("info", "file", "exists")
m.Echo("%s", last[LIST]) m.Echo("%s", last[LIST])

View File

@ -49,14 +49,14 @@ func _dream_list(m *ice.Message) *ice.Message {
func _dream_show(m *ice.Message, name string) { func _dream_show(m *ice.Message, name string) {
if !strings.Contains(name, "-") || !strings.HasPrefix(name, "20") { if !strings.Contains(name, "-") || !strings.HasPrefix(name, "20") {
name = m.Time("20060102-") + kit.ReplaceAll(name, "-", "_") name = m.Time("20060102-") + name
} }
defer m.ProcessOpen(MergePod(m, m.Option(mdb.NAME, name))) defer m.ProcessOpen(MergePod(m, m.Option(mdb.NAME, name)))
defer m.Echo(MergePod(m, m.Option(mdb.NAME, name))) defer m.Echo(MergePod(m, m.Option(mdb.NAME, name)))
// defer m.PushRefresh() // defer m.PushRefresh()
p := path.Join(ice.USR_LOCAL_WORK, name) p := path.Join(ice.USR_LOCAL_WORK, name)
if pid := m.Cmdx(nfs.CAT, path.Join(p, ice.Info.PidPath)); pid != "" && kit.FileExists("/proc/"+pid) { if pid := m.Cmdx(nfs.CAT, path.Join(p, ice.Info.PidPath)); pid != "" && nfs.ExistsFile(m, "/proc/"+pid) {
m.Info("already exists %v", pid) m.Info("already exists %v", pid)
return // 已经启动 return // 已经启动
} else if m.Cmd(SPACE, name).Length() > 0 { } else if m.Cmd(SPACE, name).Length() > 0 {
@ -117,18 +117,25 @@ const DREAM = "dream"
func init() { func init() {
Index.MergeCommands(ice.Commands{ Index.MergeCommands(ice.Commands{
DREAM: {Name: "dream name path auto start", Help: "梦想家", Actions: ice.MergeActions(ice.Actions{ DREAM: {Name: "dream name path auto create", Help: "梦想家", Actions: ice.MergeActions(ice.Actions{
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { m.Config(nfs.SCRIPT, _dream_script) }}, ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { m.Config(nfs.SCRIPT, _dream_script) }},
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 nfs.REPOS: case nfs.REPOS:
m.Cmd("web.code.git.server", func(value ice.Maps) {
m.Push(nfs.PATH, MergeLink(m, path.Join("/x/", value[nfs.PATH]+".git")))
})
m.Sort(nfs.PATH)
default: default:
_dream_list(m).Cut("name,status,time") _dream_list(m).Cut("name,status,time")
} }
}}, }},
cli.START: {Name: "start name=hi repos", Help: "启动", Hand: func(m *ice.Message, arg ...string) { mdb.CREATE: {Name: "create name=hi repos", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
_dream_show(m, m.Option(mdb.NAME, kit.Select(path.Base(m.Option(nfs.REPOS)), m.Option(mdb.NAME)))) _dream_show(m, m.Option(mdb.NAME, kit.Select(path.Base(m.Option(nfs.REPOS)), m.Option(mdb.NAME))))
}}, }},
cli.START: {Name: "start", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
_dream_show(m, m.Option(mdb.NAME))
}},
cli.OPEN: {Name: "open", Help: "打开", Hand: func(m *ice.Message, arg ...string) { cli.OPEN: {Name: "open", Help: "打开", Hand: func(m *ice.Message, arg ...string) {
m.ProcessOpen(MergePod(m, m.Option(mdb.NAME), "", "")) m.ProcessOpen(MergePod(m, m.Option(mdb.NAME), "", ""))
}}, }},
@ -141,7 +148,7 @@ func init() {
cli.STOP: {Name: "stop", Help: "停止", Hand: func(m *ice.Message, arg ...string) { cli.STOP: {Name: "stop", Help: "停止", Hand: func(m *ice.Message, arg ...string) {
m.Cmd(SPACE, mdb.MODIFY, m.OptionSimple(mdb.NAME), mdb.STATUS, cli.STOP) m.Cmd(SPACE, mdb.MODIFY, m.OptionSimple(mdb.NAME), mdb.STATUS, cli.STOP)
m.Cmd(SPACE, m.Option(mdb.NAME), ice.EXIT) m.Cmd(SPACE, m.Option(mdb.NAME), ice.EXIT)
m.ProcessRefresh30ms() m.ProcessRefresh3s()
}}, }},
DREAM_STOP: {Name: "dream.stop type name", Help: "停止", Hand: func(m *ice.Message, arg ...string) { DREAM_STOP: {Name: "dream.stop type name", Help: "停止", Hand: func(m *ice.Message, arg ...string) {
if m.CmdAppend(SPACE, m.Option(mdb.NAME), mdb.STATUS) == cli.STOP { if m.CmdAppend(SPACE, m.Option(mdb.NAME), mdb.STATUS) == cli.STOP {

View File

@ -8,7 +8,6 @@ import (
"mime/multipart" "mime/multipart"
"net/http" "net/http"
"net/url" "net/url"
"os"
"path" "path"
"strings" "strings"
"time" "time"
@ -141,7 +140,7 @@ func _spide_body(m *ice.Message, method string, arg ...string) (io.Reader, ice.M
head[ContentType] = ContentJSON head[ContentType] = ContentJSON
case SPIDE_FILE: case SPIDE_FILE:
if f, e := os.Open(arg[1]); m.Assert(e) { if f, e := nfs.OpenFile(m, arg[1]); m.Assert(e) {
defer f.Close() defer f.Close()
body, arg = f, arg[2:] body, arg = f, arg[2:]
} }

View File

@ -93,6 +93,7 @@ const ( // DIR
PAGE = "page" PAGE = "page"
PANEL = "panel" PANEL = "panel"
PLUGIN = "plugin" PLUGIN = "plugin"
STORY = "story"
FAVICON = "favicon.ico" FAVICON = "favicon.ico"
PROTO_JS = "proto.js" PROTO_JS = "proto.js"

View File

@ -38,7 +38,7 @@ func _cmd_file(m *ice.Message, arg ...string) bool {
web.RenderCmd(m, "can.parse", m.Cmdx(nfs.CAT, p)) web.RenderCmd(m, "can.parse", m.Cmdx(nfs.CAT, p))
default: default:
if p = strings.TrimPrefix(p, ice.SRC+ice.PS); kit.FileExists(path.Join(ice.SRC, p)) { if p = strings.TrimPrefix(p, ice.SRC+ice.PS); nfs.ExistsFile(m, path.Join(ice.SRC, p)) {
if msg := m.Cmd(mdb.RENDER, kit.Ext(p)); msg.Length() > 0 { if msg := m.Cmd(mdb.RENDER, kit.Ext(p)); msg.Length() > 0 {
m.Cmdy(mdb.RENDER, kit.Ext(p), p, ice.SRC+ice.PS).RenderResult() m.Cmdy(mdb.RENDER, kit.Ext(p), p, ice.SRC+ice.PS).RenderResult()
break break

View File

@ -131,7 +131,7 @@ body.{{.Option "topic"}} fieldset.panel.Header>div.output div:hover { background
}) })
m.PushAction("choose", "form", mdb.REMOVE) m.PushAction("choose", "form", mdb.REMOVE)
} else { } else {
if p := "src/website/topic/" + arg[0]; kit.FileExists(p) { if p := "src/website/topic/" + arg[0]; nfs.ExistsFile(m, p) {
m.Cmdy(nfs.CAT, p) m.Cmdy(nfs.CAT, p)
} else { } else {
m.Tables(func(value ice.Maps) { m.Tables(func(value ice.Maps) {
@ -141,7 +141,7 @@ body.{{.Option "topic"}} fieldset.panel.Header>div.output div:hover { background
} }
}}, }},
"/topic/": {Name: "/topic/", Help: "主题", Hand: func(m *ice.Message, arg ...string) { "/topic/": {Name: "/topic/", Help: "主题", Hand: func(m *ice.Message, arg ...string) {
if p := "src/website/topic/" + arg[0]; kit.FileExists(p) { if p := "src/website/topic/" + arg[0]; nfs.ExistsFile(m, p) {
m.RenderDownload(p) m.RenderDownload(p)
return return
} }

View File

@ -62,6 +62,7 @@ func _binpack_ctx(m *ice.Message, w io.Writer) {
_binpack_dir(m, w, ice.SRC) _binpack_dir(m, w, ice.SRC)
} }
func _binpack_all(m *ice.Message) { func _binpack_all(m *ice.Message) {
nfs.OptionFiles(m, nfs.DiskFile)
if w, p, e := nfs.CreateFile(m, ice.SRC_BINPACK_GO); m.Assert(e) { if w, p, e := nfs.CreateFile(m, ice.SRC_BINPACK_GO); m.Assert(e) {
defer w.Close() defer w.Close()
defer m.Echo(p) defer m.Echo(p)
@ -79,6 +80,7 @@ func init() {
defer fmt.Fprintln(w, `}`) defer fmt.Fprintln(w, `}`)
defer fmt.Fprintln(w, ` defer fmt.Fprintln(w, `
nfs.PackFile.RemoveAll(ice.SRC)
for k, v := range pack { for k, v := range pack {
if b, e := base64.StdEncoding.DecodeString(v); e == nil { if b, e := base64.StdEncoding.DecodeString(v); e == nil {
nfs.PackFile.WriteFile(k, b) nfs.PackFile.WriteFile(k, b)

View File

@ -12,7 +12,7 @@ import (
) )
func _c_tags(m *ice.Message, key string) { func _c_tags(m *ice.Message, key string) {
if !kit.FileExists(path.Join(m.Option(cli.CMD_DIR), TAGS)) { if !nfs.ExistsFile(m, path.Join(m.Option(cli.CMD_DIR), TAGS)) {
m.Cmd(cli.SYSTEM, "ctags", "-R", "-f", TAGS, nfs.PWD) m.Cmd(cli.SYSTEM, "ctags", "-R", "-f", TAGS, nfs.PWD)
} }
_go_tags(m, key) _go_tags(m, key)

View File

@ -17,7 +17,7 @@ import (
) )
func _go_tags(m *ice.Message, key string) { func _go_tags(m *ice.Message, key string) {
if s, e := os.Stat(path.Join(m.Option(cli.CMD_DIR), TAGS)); os.IsNotExist(e) || s.ModTime().Before(time.Now().Add(kit.Duration("-72h"))) { if s, e := nfs.StatFile(m, path.Join(m.Option(cli.CMD_DIR), TAGS)); os.IsNotExist(e) || s.ModTime().Before(time.Now().Add(kit.Duration("-72h"))) {
m.Cmd(cli.SYSTEM, "gotags", "-R", "-f", TAGS, nfs.PWD) m.Cmd(cli.SYSTEM, "gotags", "-R", "-f", TAGS, nfs.PWD)
} }
@ -36,7 +36,7 @@ func _go_tags(m *ice.Message, key string) {
text := strings.TrimSuffix(strings.TrimPrefix(ls[0], "/^"), "$/") text := strings.TrimSuffix(strings.TrimPrefix(ls[0], "/^"), "$/")
line := kit.Int(text) line := kit.Int(text)
f, e := os.Open(path.Join(m.Option(cli.CMD_DIR), file)) f, e := nfs.OpenFile(m, path.Join(m.Option(cli.CMD_DIR), file))
m.Assert(e) m.Assert(e)
defer f.Close() defer f.Close()

View File

@ -32,8 +32,8 @@ func _install_download(m *ice.Message) {
file := path.Join(kit.Select(ice.USR_INSTALL, m.Option(nfs.PATH)), name) file := path.Join(kit.Select(ice.USR_INSTALL, m.Option(nfs.PATH)), name)
if nfs.ExistsFile(m, file) { if nfs.ExistsFile(m, file) {
web.ToastSuccess(m)
m.Cmdy(nfs.DIR, file) m.Cmdy(nfs.DIR, file)
web.ToastSuccess(m)
return // 文件存在 return // 文件存在
} }

View File

@ -24,7 +24,7 @@ func _publish_file(m *ice.Message, file string, arg ...string) string {
} else if s, e := nfs.StatFile(m, file); m.Assert(e) && s.IsDir() { } else if s, e := nfs.StatFile(m, file); m.Assert(e) && s.IsDir() {
file = m.Cmdx(nfs.TAR, mdb.IMPORT, path.Base(file), file) file = m.Cmdx(nfs.TAR, mdb.IMPORT, path.Base(file), file)
defer func() { os.Remove(file) }() defer func() { nfs.Remove(m, file) }()
} }
// 发布文件 // 发布文件
@ -43,7 +43,7 @@ func _publish_bin_list(m *ice.Message, dir string) {
p := m.Option(cli.CMD_DIR, dir) p := m.Option(cli.CMD_DIR, dir)
for _, ls := range strings.Split(strings.TrimSpace(m.Cmd(cli.SYSTEM, "bash", "-c", "ls |xargs file |grep executable").Append(cli.CMD_OUT)), ice.NL) { for _, ls := range strings.Split(strings.TrimSpace(m.Cmd(cli.SYSTEM, "bash", "-c", "ls |xargs file |grep executable").Append(cli.CMD_OUT)), ice.NL) {
if file := strings.TrimSpace(strings.Split(ls, ":")[0]); file != "" { if file := strings.TrimSpace(strings.Split(ls, ":")[0]); file != "" {
if s, e := os.Stat(path.Join(p, file)); e == nil { if s, e := nfs.StatFile(m, path.Join(p, file)); e == nil {
m.Push(mdb.TIME, s.ModTime()) m.Push(mdb.TIME, s.ModTime())
m.Push(nfs.SIZE, kit.FmtSize(s.Size())) m.Push(nfs.SIZE, kit.FmtSize(s.Size()))
m.Push(nfs.FILE, file) m.Push(nfs.FILE, file)

View File

@ -31,6 +31,12 @@ func init() {
Index.Merge(&ice.Context{Commands: ice.Commands{ Index.Merge(&ice.Context{Commands: ice.Commands{
PY: {Name: "py path auto", Help: "脚本", Actions: ice.MergeActions(ice.Actions{ PY: {Name: "py path 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.Go(func() {
m.Sleep300ms() // after runtime init
cli.IsAlpine(m, "python", "python2")
cli.IsAlpine(m, "python2")
cli.IsAlpine(m, "python3")
})
m.Cmd(mdb.ENGINE, mdb.CREATE, PY, m.PrefixKey()) m.Cmd(mdb.ENGINE, mdb.CREATE, PY, m.PrefixKey())
m.Cmd(mdb.RENDER, mdb.CREATE, PY, m.PrefixKey()) m.Cmd(mdb.RENDER, mdb.CREATE, PY, m.PrefixKey())
}}, }},

View File

@ -26,7 +26,7 @@ chapter "hi"
print "hello world" print "hello world"
`, `,
nfs.JS, ` nfs.JS, `
Volcanos("onimport", {help: "导入数据", _init: function(can, msg) { Volcanos(chat.ONIMPORT, {help: "导入数据", _init: function(can, msg) {
msg.Echo("hello world") msg.Echo("hello world")
msg.Dump(can) msg.Dump(can)
}}) }})

View File

@ -29,7 +29,9 @@ func _xterm_get(m *ice.Message, h string, must bool) *os.File {
return nil return nil
} }
cmd := exec.Command(cli.SystemFind(m, kit.Select("sh", m.Option(mdb.TYPE)))) ls := kit.Split(kit.Select("sh", m.Option(mdb.TYPE)))
m.Debug("what %v", kit.Format(ls))
cmd := exec.Command(cli.SystemFind(m, ls[0]), ls[1:]...)
cmd.Env = append(os.Environ(), "TERM=xterm") cmd.Env = append(os.Environ(), "TERM=xterm")
m.Option(mdb.HASH, h) m.Option(mdb.HASH, h)

View File

@ -66,7 +66,7 @@ func _field_show(m *ice.Message, name, text string, arg ...string) {
meta[arg[i]] = arg[i+1] meta[arg[i]] = arg[i+1]
case SPARK: case SPARK:
if arg[i+1][0] == '@' && kit.FileExists(arg[i+1][1:]) { if arg[i+1][0] == '@' && nfs.ExistsFile(m, arg[i+1][1:]) {
msg.Cmdy(nfs.CAT, arg[i+1][1:]) msg.Cmdy(nfs.CAT, arg[i+1][1:])
} else { } else {
msg.Echo(strings.TrimSpace(arg[i+1])) msg.Echo(strings.TrimSpace(arg[i+1]))

View File

@ -74,11 +74,12 @@ 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) {
m.Cmdy(nfs.DIR, "src/", kit.Dict(nfs.DIR_DEEP, ice.TRUE, nfs.DIR_REG, ".*\\.shy"), nfs.DIR_CLI_FIELDS) for _, p := range []string{"src/", "src/help/", "usr/icebergs/"} {
m.Cmdy(nfs.DIR, "src/help/", kit.Dict(nfs.DIR_DEEP, ice.TRUE, nfs.DIR_REG, ".*\\.shy"), nfs.DIR_CLI_FIELDS) m.Cmdy(nfs.DIR, p, kit.Dict(nfs.DIR_DEEP, ice.TRUE, nfs.DIR_REG, ".*\\.shy"), nfs.DIR_CLI_FIELDS)
}
}}, }},
"story": {Name: "story", Help: "运行", Hand: func(m *ice.Message, arg ...string) { ice.STORY: {Name: "story", Help: "运行", Hand: func(m *ice.Message, arg ...string) {
m.Cmdy(arg[0], ctx.ACTION, ice.RUN, arg[2:]) m.Cmdy(arg[0], ice.RUN, arg[2:])
}}, }},
ice.PLAY: {Name: "play", Help: "演示"}, ice.PLAY: {Name: "play", Help: "演示"},
}, ctx.CmdAction(), mdb.HashAction()), Hand: func(m *ice.Message, arg ...string) { }, ctx.CmdAction(), mdb.HashAction()), Hand: func(m *ice.Message, arg ...string) {
@ -87,7 +88,7 @@ func init() {
arg = append(arg, "src/") arg = append(arg, "src/")
} }
if m.Option(nfs.DIR_DEEP, ice.TRUE); !_wiki_list(m, m.CommandKey(), arg...) { if m.Option(nfs.DIR_DEEP, ice.TRUE); !_wiki_list(m, m.CommandKey(), arg...) {
if !kit.FileExists(arg[0]) && kit.FileExists(path.Join("src", arg[0])) { if !nfs.ExistsFile(m, arg[0]) && nfs.ExistsFile(m, path.Join("src", arg[0])) {
arg[0] = path.Join("src/", arg[0]) arg[0] = path.Join("src/", arg[0])
} }
ctx.DisplayLocal(m, "") ctx.DisplayLocal(m, "")

1
go.mod
View File

@ -5,6 +5,7 @@ go 1.11
require ( require (
shylinux.com/x/creackpty v0.0.1 shylinux.com/x/creackpty v0.0.1
shylinux.com/x/go-qrcode v0.0.1 shylinux.com/x/go-qrcode v0.0.1
shylinux.com/x/ice v1.0.7
shylinux.com/x/toolkits v0.6.6 shylinux.com/x/toolkits v0.6.6
shylinux.com/x/websocket v0.0.1 shylinux.com/x/websocket v0.0.1
) )

4
go.sum
View File

@ -2,6 +2,10 @@ shylinux.com/x/creackpty v0.0.1 h1:o+qDE39jFsHLZB9BRAm0EI6qScjw5PuvdkROqhTcupM=
shylinux.com/x/creackpty v0.0.1/go.mod h1:d7DnPv3oGc23WlzrN8hW7p88wNLPAO/XG4ICVEq96i0= shylinux.com/x/creackpty v0.0.1/go.mod h1:d7DnPv3oGc23WlzrN8hW7p88wNLPAO/XG4ICVEq96i0=
shylinux.com/x/go-qrcode v0.0.1 h1:/eOGqMj1qtgs9Ymd12zTUa1gcJZs9S92kj2lb0QzKsE= shylinux.com/x/go-qrcode v0.0.1 h1:/eOGqMj1qtgs9Ymd12zTUa1gcJZs9S92kj2lb0QzKsE=
shylinux.com/x/go-qrcode v0.0.1/go.mod h1:KAbtU+KwiiABMZ/CJ0zh9PI2AX82Uf9rRYcQ4ODm4po= shylinux.com/x/go-qrcode v0.0.1/go.mod h1:KAbtU+KwiiABMZ/CJ0zh9PI2AX82Uf9rRYcQ4ODm4po=
shylinux.com/x/ice v1.0.7 h1:prm2IiOJ7nevt9pSmTEXGHq/Vjeo1n+gDfo54G5OPtI=
shylinux.com/x/ice v1.0.7/go.mod h1:9ErxoqjwAzbcOkJAD7+OPuRrQ12/kduO7arHipUCry0=
shylinux.com/x/icebergs v1.3.0/go.mod h1:HhX/7lagVsvO80yYbfpf7FW4ddLOFv8kUwjBr8STRUQ=
shylinux.com/x/toolkits v0.6.5/go.mod h1:8LbYHe7oxBIqb6s4MSOD+4d28QvPdvkyCVtwB/JW7AA=
shylinux.com/x/toolkits v0.6.6 h1:OcuGs4PLj9qynf14o8UE1wndT3+tnum0wpOo0KFq/tM= shylinux.com/x/toolkits v0.6.6 h1:OcuGs4PLj9qynf14o8UE1wndT3+tnum0wpOo0KFq/tM=
shylinux.com/x/toolkits v0.6.6/go.mod h1:8LbYHe7oxBIqb6s4MSOD+4d28QvPdvkyCVtwB/JW7AA= shylinux.com/x/toolkits v0.6.6/go.mod h1:8LbYHe7oxBIqb6s4MSOD+4d28QvPdvkyCVtwB/JW7AA=
shylinux.com/x/websocket v0.0.1 h1:OBc21DxqsGlQ2+Pz76xqLyDNo1LV+PUUqfWi+1PZPDE= shylinux.com/x/websocket v0.0.1 h1:OBc21DxqsGlQ2+Pz76xqLyDNo1LV+PUUqfWi+1PZPDE=

View File

@ -195,7 +195,7 @@ func (m *Message) FormatStack(s, n int) string {
name := kit.Slice(kit.Split(frame.Function, PS, PS), -1)[0] name := kit.Slice(kit.Split(frame.Function, PS, PS), -1)[0]
switch ls := kit.Split(name, PT, PT); kit.Select("", ls, 0) { switch ls := kit.Split(name, PT, PT); kit.Select("", ls, 0) {
// case "reflect", "runtime", "http", "task", "icebergs": case "reflect", "runtime", "http", "task", "icebergs":
default: default:
list = append(list, kit.Format("%s:%d\t%s", file, frame.Line, name)) list = append(list, kit.Format("%s:%d\t%s", file, frame.Line, name))
} }

View File

@ -159,7 +159,11 @@ func (m *Message) Push(key string, value Any, arg ...Any) *Message {
// 追加数据 // 追加数据
switch v := kit.Format(v); key { switch v := kit.Format(v); key {
case FIELDS_DETAIL: case FIELDS_DETAIL:
m.Add(MSG_APPEND, KEY, k) switch k {
case "_target":
continue
}
m.Add(MSG_APPEND, KEY, strings.TrimPrefix(k, "extra."))
m.Add(MSG_APPEND, VALUE, v) m.Add(MSG_APPEND, VALUE, v)
default: default:
m.Add(MSG_APPEND, k, v) m.Add(MSG_APPEND, k, v)

View File

@ -1,7 +1,6 @@
package alpha package alpha
import ( import (
"os"
"path" "path"
"strings" "strings"
@ -34,7 +33,7 @@ func (a alpha) Load(m *ice.Message, arg ...string) {
name := m.Option(mdb.NAME) name := m.Option(mdb.NAME)
// 清空数据 // 清空数据
meta := m.Confm(m.PrefixKey(), mdb.META) meta := m.Confm(m.PrefixKey(), mdb.META)
m.Assert(os.RemoveAll(path.Join(kit.Format(meta[mdb.STORE]), name))) m.Assert(nfs.RemoveAll(m.Message, path.Join(kit.Format(meta[mdb.STORE]), name)))
m.Conf(m.PrefixKey(), name, "") m.Conf(m.PrefixKey(), name, "")
// 缓存配置 // 缓存配置

View File

@ -1,8 +1,6 @@
package bash package bash
import ( import (
"os"
ice "shylinux.com/x/icebergs" ice "shylinux.com/x/icebergs"
"shylinux.com/x/icebergs/base/aaa" "shylinux.com/x/icebergs/base/aaa"
"shylinux.com/x/icebergs/base/cli" "shylinux.com/x/icebergs/base/cli"
@ -39,7 +37,7 @@ func init() {
}}, }},
mdb.PRUNES: {Name: "prunes before@date", Help: "清理", Hand: func(m *ice.Message, arg ...string) { mdb.PRUNES: {Name: "prunes before@date", Help: "清理", Hand: func(m *ice.Message, arg ...string) {
mdb.HashPrunes(m, func(value ice.Maps) bool { mdb.HashPrunes(m, func(value ice.Maps) bool {
os.RemoveAll(value[TO]) nfs.RemoveAll(m, value[TO])
return true return true
}) })
}}, }},

View File

@ -1,15 +1,18 @@
chapter "codeserver" section "code-server"
refer ` refer `
https://coder.com/ 官网 https://coder.com/
https://github.com/coder/code-server/ 源码 https://github.com/coder/code-server/
https://github.com/microsoft/vscode
https://code.visualstudio.com/
https://geek-docs.com/vscode/vscode-tutorials/what-is-vscode.html
` `
spark shell ` spark shell `
wget https://github.com/coder/code-server/releases/download/v4.4.0/code-server-4.4.0-linux-amd64.tar.gz wget https://github.com/coder/code-server/releases/download/v4.4.0/code-server-4.4.0-linux-amd64.tar.gz
tar xvf code-server-4.4.0-linux-amd64.tar.gz tar xvf code-server-4.4.0-linux-amd64.tar.gz && cd code-server-4.4.0-linux-amd64
cd code-server-4.4.0-linux-amd64
./bin/code-server ./bin/code-server
` `
field web.code.coder.server
refer `
官网 https://code.visualstudio.com/
源码 https://github.com/microsoft/vscode
入门 https://geek-docs.com/vscode/vscode-tutorials/what-is-vscode.html
`

View File

@ -1,7 +1,6 @@
package git package git
import ( import (
"os"
"path" "path"
"strings" "strings"
@ -23,7 +22,7 @@ func _repos_path(name string) string {
return kit.Select(path.Join(ice.USR, name)+ice.PS, nfs.PWD, name == path.Base(kit.Pwd())) return kit.Select(path.Join(ice.USR, name)+ice.PS, nfs.PWD, name == path.Base(kit.Pwd()))
} }
func _repos_insert(m *ice.Message, name string, dir string) { func _repos_insert(m *ice.Message, name string, dir string) {
if s, e := os.Stat(m.Option(cli.CMD_DIR, path.Join(dir, ".git"))); e == nil && s.IsDir() { if s, e := nfs.StatFile(m, m.Option(cli.CMD_DIR, path.Join(dir, ".git"))); e == nil && s.IsDir() {
ls := strings.SplitN(strings.Trim(m.Cmdx(cli.SYSTEM, GIT, "log", "-n1", `--pretty=format:"%ad %s"`, "--date=iso"), `"`), ice.SP, 4) ls := strings.SplitN(strings.Trim(m.Cmdx(cli.SYSTEM, GIT, "log", "-n1", `--pretty=format:"%ad %s"`, "--date=iso"), `"`), ice.SP, 4)
mdb.Rich(m, REPOS, nil, kit.Data(mdb.NAME, name, nfs.PATH, dir, mdb.Rich(m, REPOS, nil, kit.Data(mdb.NAME, name, nfs.PATH, dir,
COMMIT, kit.Select("", ls, 3), mdb.TIME, strings.Join(ls[:2], ice.SP), COMMIT, kit.Select("", ls, 3), mdb.TIME, strings.Join(ls[:2], ice.SP),
@ -71,12 +70,12 @@ func init() {
// } // }
_repos_insert(m, m.Option(mdb.NAME), m.Option(nfs.PATH)) _repos_insert(m, m.Option(mdb.NAME), m.Option(nfs.PATH))
if s, e := os.Stat(path.Join(m.Option(nfs.PATH), ".git")); e == nil && s.IsDir() { if s, e := nfs.StatFile(m, path.Join(m.Option(nfs.PATH), ".git")); e == nil && s.IsDir() {
return return
} }
// 下载仓库 // 下载仓库
if s, e := os.Stat(m.Option(nfs.PATH)); e == nil && s.IsDir() { if s, e := nfs.StatFile(m, m.Option(nfs.PATH)); e == nil && s.IsDir() {
m.Option(cli.CMD_DIR, m.Option(nfs.PATH)) m.Option(cli.CMD_DIR, m.Option(nfs.PATH))
m.Cmd(cli.SYSTEM, GIT, INIT) m.Cmd(cli.SYSTEM, GIT, INIT)
m.Cmd(cli.SYSTEM, GIT, REMOTE, ADD, ORIGIN, m.Option(REPOS)) m.Cmd(cli.SYSTEM, GIT, REMOTE, ADD, ORIGIN, m.Option(REPOS))

View File

@ -155,7 +155,7 @@ func init() {
web.RenderStatus(m.W, 401, err.Error()) web.RenderStatus(m.W, 401, err.Error())
return // 没有权限 return // 没有权限
} }
if !kit.FileExists(path.Join(repos)) { if !nfs.ExistsFile(m, path.Join(repos)) {
m.Cmd(cli.SYSTEM, GIT, INIT, "--bare", repos) // 创建仓库 m.Cmd(cli.SYSTEM, GIT, INIT, "--bare", repos) // 创建仓库
m.Logs(mdb.CREATE, REPOS, repos) m.Logs(mdb.CREATE, REPOS, repos)
} }
@ -164,7 +164,7 @@ func init() {
if kit.Select("", arg, 1) == "info" && m.Cmd(web.DREAM, arg[0]).Length() > 0 { if kit.Select("", arg, 1) == "info" && m.Cmd(web.DREAM, arg[0]).Length() > 0 {
m.Cmd(web.SPACE, arg[0], "web.code.git.status", "submit", web.MergeURL2(m, "/x/")+arg[0]) m.Cmd(web.SPACE, arg[0], "web.code.git.status", "submit", web.MergeURL2(m, "/x/")+arg[0])
} }
if !kit.FileExists(path.Join(repos)) { if !nfs.ExistsFile(m, path.Join(repos)) {
web.RenderStatus(m.W, 404, kit.Format("not found: %s", arg[0])) web.RenderStatus(m.W, 404, kit.Format("not found: %s", arg[0]))
return return
} }

View File

@ -1,7 +1,6 @@
package git package git
import ( import (
"os"
"path" "path"
"strings" "strings"
"sync" "sync"
@ -88,10 +87,10 @@ func init() {
}}, }},
"_sum": {Name: "_sum [path] [total] [count|date] args...", Help: "统计量", Hand: func(m *ice.Message, arg ...string) { "_sum": {Name: "_sum [path] [total] [count|date] args...", Help: "统计量", Hand: func(m *ice.Message, arg ...string) {
if len(arg) > 0 { if len(arg) > 0 {
if s, e := os.Stat(path.Join(arg[0], ".git")); e == nil && s.IsDir() { if s, e := nfs.StatFile(m, path.Join(arg[0], ".git")); e == nil && s.IsDir() {
m.Option(cli.CMD_DIR, arg[0]) m.Option(cli.CMD_DIR, arg[0])
arg = arg[1:] arg = arg[1:]
} else if s, e := os.Stat(path.Join(arg[0], "refs")); e == nil && s.IsDir() { } else if s, e := nfs.StatFile(m, path.Join(arg[0], "refs")); e == nil && s.IsDir() {
m.Option(cli.CMD_DIR, arg[0]) m.Option(cli.CMD_DIR, arg[0])
arg = arg[1:] arg = arg[1:]
} }

View File

@ -5,7 +5,6 @@ import (
"bytes" "bytes"
"encoding/csv" "encoding/csv"
"fmt" "fmt"
"os"
"path" "path"
"strings" "strings"
@ -34,12 +33,12 @@ type input struct {
} }
func (i input) Load(m *ice.Message, arg ...string) { func (i input) Load(m *ice.Message, arg ...string) {
if f, e := os.Open(m.Option(nfs.FILE)); m.Assert(e) { if f, e := nfs.OpenFile(m.Message, m.Option(nfs.FILE)); m.Assert(e) {
defer f.Close() defer f.Close()
// 清空数据 // 清空数据
lib := kit.Select(path.Base(m.Option(nfs.FILE)), m.Option(mdb.ZONE)) lib := kit.Select(path.Base(m.Option(nfs.FILE)), m.Option(mdb.ZONE))
m.Assert(os.RemoveAll(path.Join(m.Config(mdb.STORE), lib))) m.Assert(nfs.RemoveAll(m.Message, path.Join(m.Config(mdb.STORE), lib)))
m.Cmd(mdb.DELETE, m.PrefixKey(), "", mdb.HASH, mdb.ZONE, lib) m.Cmd(mdb.DELETE, m.PrefixKey(), "", mdb.HASH, mdb.ZONE, lib)
prefix := kit.Keys(mdb.HASH, mdb.Rich(m.Message, m.PrefixKey(), "", kit.Data( prefix := kit.Keys(mdb.HASH, mdb.Rich(m.Message, m.PrefixKey(), "", kit.Data(
mdb.STORE, path.Join(m.Config(mdb.STORE), lib), mdb.STORE, path.Join(m.Config(mdb.STORE), lib),

View File

@ -10,27 +10,40 @@ import (
) )
const ( const (
MVN = "mvn"
JAVA = "java" JAVA = "java"
JAVAC = "javac" JAVAC = "javac"
) )
type server struct { type compile struct {
ice.Code ice.Code
regexp string `data:".*.java"` regexp string `data:".*.java"`
linux string `data:"https://mirrors.tencent.com/repository/generic/konajdk/8/0/10/linux-x86_64/b1/TencentKona8.0.10.b1_jdk_linux-x86_64_8u332.tar.gz"` linux string `data:"https://mirrors.tencent.com/repository/generic/konajdk/8/0/10/linux-x86_64/b1/TencentKona8.0.10.b1_jdk_linux-x86_64_8u332.tar.gz"`
list string `name:"list path auto listScript order install" help:"编译执行"` list string `name:"list path auto listScript order install" help:"编译"`
} }
func (s server) Order(m *ice.Message) { func (s compile) Init(m *ice.Message) {
m.Go(func() {
m.Sleep300ms() // after runtime init
cli.IsAlpine(m.Message, JAVA, "openjdk8")
cli.IsAlpine(m.Message, JAVAC, "openjdk8")
cli.IsAlpine(m.Message, MVN, "maven openjdk8")
cli.IsCentos(m.Message, JAVA, "java-1.8.0-openjdk-devel.x86_64")
cli.IsCentos(m.Message, JAVAC, "java-1.8.0-openjdk-devel.x86_64")
cli.IsCentos(m.Message, MVN, "maven java-1.8.0-openjdk-devel.x86_64")
})
}
func (s compile) Order(m *ice.Message) {
s.Code.Order(m, "", ice.BIN) s.Code.Order(m, "", ice.BIN)
} }
func (s server) List(m *ice.Message, arg ...string) { func (s compile) List(m *ice.Message, arg ...string) {
s.Code.Source(m, "", arg...) s.Code.Source(m, "", arg...)
} }
func (s server) RunScript(m *ice.Message) { func (s compile) RunScript(m *ice.Message) {
if s.Code.System(m, nfs.PWD, JAVAC, "-d", ice.BIN, m.Option(nfs.PATH)); cli.IsSuccess(m.Message) { if s.Code.System(m, nfs.PWD, JAVAC, "-d", ice.BIN, m.Option(nfs.PATH)); cli.IsSuccess(m.Message) {
s.Code.System(m, nfs.PWD, JAVA, "-cp", kit.Path(ice.BIN), strings.TrimPrefix(strings.TrimSuffix(m.Option(nfs.PATH), ".java"), "src/")) s.Code.System(m, nfs.PWD, JAVA, "-cp", kit.Path(ice.BIN), strings.TrimPrefix(strings.TrimSuffix(m.Option(nfs.PATH), ".java"), "src/"))
} }
} }
func init() { ice.CodeCtxCmd(server{}) } func init() { ice.CodeCtxCmd(compile{}) }

9
misc/java/compile.shy Normal file
View File

@ -0,0 +1,9 @@
section "java"
refer `
官网 https://www.java.com/
文档 https://docs.oracle.com/javase/tutorial/
源码 https://github.com/openjdk/jdk
开源 https://openjdk.org/
`
field web.code.java.compile

View File

@ -1,6 +1,7 @@
section "spring" section "spring"
refer ` refer `
官网 https://spring.io/projects/spring-boot 官网 https://spring.io/projects/spring-boot
源码 https://github.com/spring-projects/spring-boot
入门 https://spring.io/quickstart 入门 https://spring.io/quickstart
向导 https://start.spring.io/ 向导 https://start.spring.io/
参数 https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html 参数 https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html

37
misc/node/compile.go Normal file
View File

@ -0,0 +1,37 @@
package node
import (
"shylinux.com/x/ice"
"shylinux.com/x/icebergs/base/cli"
)
const (
NPM = "npm"
NODE = "node"
)
type compile struct {
ice.Code
regexp string `data:".*.js"`
linux string `data:"https://mirrors.tencent.com/nodejs-release/v16.15.1/node-v16.15.1-linux-x64.tar.xz"`
list string `name:"list path auto xterm listScript order install" help:"编译器"`
}
func (s compile) Init(m *ice.Message) {
m.Go(func() {
m.Sleep300ms() // after runtime init
cli.IsAlpine(m.Message, NPM)
cli.IsAlpine(m.Message, NODE, "nodejs")
})
}
func (s compile) Order(m *ice.Message) {
s.Code.Order(m, "", ice.BIN)
}
func (s compile) Xterm(m *ice.Message, arg ...string) {
s.Code.Xterm(m, NODE, arg...)
}
func (s compile) List(m *ice.Message, arg ...string) {
s.Code.Source(m, "", arg...)
}
func init() { ice.CodeCtxCmd(compile{}) }

8
misc/node/compile.shy Normal file
View File

@ -0,0 +1,8 @@
section "node"
refer `
官网 https://nodejs.org/
文档 https://nodejs.org/docs/latest-v6.x/api/
源码 https://github.com/nodejs/node
`
field web.code.node.compile

View File

@ -1,22 +0,0 @@
package node
import (
"shylinux.com/x/ice"
)
type server struct {
ice.Code
command string `data:"node"`
regexp string `data:".*.js"`
linux string `data:"https://mirrors.tencent.com/nodejs-release/v16.15.1/node-v16.15.1-linux-x64.tar.xz"`
list string `name:"list path auto listScript order install" help:"编译执行"`
}
func (s server) Order(m *ice.Message) {
s.Code.Order(m, "", ice.BIN)
}
func (s server) List(m *ice.Message, arg ...string) {
s.Code.Source(m, "", arg...)
}
func init() { ice.CodeCtxCmd(server{}) }

View File

@ -1,5 +1,6 @@
section "vue" section "vue"
refer ` refer `
官网 https://vuejs.org/ 官网 https://vuejs.org/
源码 https://github.com/vuejs/vue
入门 https://vuejs.org/guide/quick-start.html 入门 https://vuejs.org/guide/quick-start.html
` `

View File

@ -45,17 +45,17 @@ func _ssh_open(m *ice.Message, arg ...string) {
} }
func _ssh_dial(m *ice.Message, cb func(net.Conn), arg ...string) { func _ssh_dial(m *ice.Message, cb func(net.Conn), arg ...string) {
p := path.Join(kit.Env(cli.HOME), ".ssh/", fmt.Sprintf("%s@%s:%s", m.Option(aaa.USERNAME), m.Option(tcp.HOST), m.Option(tcp.PORT))) p := path.Join(kit.Env(cli.HOME), ".ssh/", fmt.Sprintf("%s@%s:%s", m.Option(aaa.USERNAME), m.Option(tcp.HOST), m.Option(tcp.PORT)))
if kit.FileExists(p) { if nfs.FileExists(m, p) {
if c, e := net.Dial("unix", p); e == nil { if c, e := net.Dial("unix", p); e == nil {
cb(c) // 会话连接 cb(c) // 会话连接
return return
} }
os.Remove(p) nfs.Remove(m, p)
} }
_ssh_conn(m, func(client *ssh.Client) { _ssh_conn(m, func(client *ssh.Client) {
if l, e := net.Listen("unix", p); m.Assert(e) { if l, e := net.Listen("unix", p); m.Assert(e) {
defer func() { os.Remove(p) }() defer func() { nfs.Remove(m, p) }()
defer l.Close() defer l.Close()
m.Go(func() { m.Go(func() {

View File

@ -79,18 +79,14 @@ func init() {
} else { // 创建会话 } else { // 创建会话
m.Option(cli.CMD_DIR, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME))) m.Option(cli.CMD_DIR, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME)))
ls := kit.Split(m.Option(mdb.NAME), "-_") ls := kit.Split(strings.TrimSuffix(m.Option(mdb.NAME), "-story"), "-")
name := ls[len(ls)-1] name := ls[len(ls)-1]
m.Cmdy(cli.SYSTEM, TMUX, "new-session", "-ds", m.Option(mdb.NAME), "-n", name) m.Cmdy(cli.SYSTEM, TMUX, "new-session", "-ds", m.Option(mdb.NAME), "-n", name)
name = _tmux_key(m.Option(mdb.NAME), ls[len(ls)-1]) name = _tmux_key(m.Option(mdb.NAME), ls[len(ls)-1])
m.Cmdy(cli.SYSTEM, TMUX, "split-window", "-t", kit.Keys(name, "1"), "-p", "20") m.Cmd(cli.SYSTEM, TMUX, "split-window", "-t", kit.Keys(name, "1"), "-p", "40")
m.Cmdy(cli.SYSTEM, TMUX, "split-window", "-t", kit.Keys(name, "2"), "-h") m.Cmd(cli.SYSTEM, TMUX, "send-keys", "-t", kit.Keys(name, "2"), "ish_miss_log", "Enter")
m.Cmd(cli.SYSTEM, TMUX, "send-keys", "-t", kit.Keys(name, "3"), "ish_miss_log", "Enter")
// m.Cmd(cli.SYSTEM, TMUX, "send-keys", "-t", kit.Keys(name, "2"), "ish_miss_space", "Enter")
m.Cmd(cli.SYSTEM, TMUX, "send-keys", "-t", kit.Keys(name, "2"), "ish_miss_space")
m.Cmd(cli.SYSTEM, TMUX, "send-keys", "-t", kit.Keys(name, "1"), "vi etc/miss.sh", "Enter") m.Cmd(cli.SYSTEM, TMUX, "send-keys", "-t", kit.Keys(name, "1"), "vi etc/miss.sh", "Enter")
m.Cmdy(cli.SYSTEM, TMUX, "link-window", "-s", name, "-t", "miss:") m.Cmdy(cli.SYSTEM, TMUX, "link-window", "-s", name, "-t", "miss:")