forked from x/icebergs
opt some
This commit is contained in:
parent
ecf3d4d888
commit
351809f085
@ -54,10 +54,10 @@ func _dream_show(m *ice.Message, name string) {
|
|||||||
defer ToastProcess(m)()
|
defer ToastProcess(m)()
|
||||||
defer m.Sleep3s()
|
defer m.Sleep3s()
|
||||||
m.Options(cli.CMD_DIR, kit.Path(p), cli.CMD_ENV, kit.Simple(
|
m.Options(cli.CMD_DIR, kit.Path(p), cli.CMD_ENV, kit.Simple(
|
||||||
cli.CTX_OPS, "http://localhost:"+m.CmdAppend(SERVE, tcp.PORT),
|
cli.CTX_OPS, "http://localhost:"+m.CmdAppend(SERVE, tcp.PORT), cli.CTX_LOG, ice.VAR_LOG_BOOT_LOG,
|
||||||
cli.PATH, cli.BinPath(kit.Path(p, ice.BIN)), cli.USER, ice.Info.Username,
|
cli.PATH, cli.BinPath(kit.Path(p, ice.BIN)), cli.USER, ice.Info.Username,
|
||||||
kit.EnvSimple(cli.HOME, cli.TERM, cli.SHELL), m.Configv(cli.ENV),
|
kit.EnvSimple(cli.HOME, cli.TERM, cli.SHELL), m.Configv(cli.ENV),
|
||||||
), cli.CMD_OUTPUT, path.Join(p, ice.BIN_BOOT_LOG))
|
), cli.CMD_OUTPUT, path.Join(p, ice.VAR_LOG_BOOT_LOG))
|
||||||
defer m.Options(cli.CMD_DIR, "", cli.CMD_ENV, "", cli.CMD_OUTPUT, "")
|
defer m.Options(cli.CMD_DIR, "", cli.CMD_ENV, "", cli.CMD_OUTPUT, "")
|
||||||
gdb.Event(m, DREAM_CREATE, m.OptionSimple(mdb.NAME, mdb.TYPE))
|
gdb.Event(m, DREAM_CREATE, m.OptionSimple(mdb.NAME, mdb.TYPE))
|
||||||
m.Cmd(cli.DAEMON, kit.Select(os.Args[0], cli.SystemFind(m, ice.ICE_BIN, nfs.PWD+path.Join(p, ice.BIN), nfs.PWD+ice.BIN)),
|
m.Cmd(cli.DAEMON, kit.Select(os.Args[0], cli.SystemFind(m, ice.ICE_BIN, nfs.PWD+path.Join(p, ice.BIN), nfs.PWD+ice.BIN)),
|
||||||
@ -107,6 +107,10 @@ func init() {
|
|||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case mdb.NAME, nfs.TEMPLATE:
|
case mdb.NAME, nfs.TEMPLATE:
|
||||||
_dream_list(m).Cut("name,status,time")
|
_dream_list(m).Cut("name,status,time")
|
||||||
|
case "repos":
|
||||||
|
m.Cmdy(SPIDE, ice.OPS, SPIDE_MSG, "/x/list")
|
||||||
|
// m.Cmdy(SPIDE, ice.DEV, SPIDE_MSG, "/x/list")
|
||||||
|
// m.Cmdy(SPIDE, ice.SHY, SPIDE_MSG, "/x/list")
|
||||||
default:
|
default:
|
||||||
gdb.Event(m, "", arg)
|
gdb.Event(m, "", arg)
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"path"
|
"path"
|
||||||
|
"regexp"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -137,7 +138,12 @@ func _serve_domain(m *ice.Message) string {
|
|||||||
func() string { return kit.Select("", m.R.Header.Get(Referer), m.R.Method == http.MethodPost) },
|
func() string { return kit.Select("", m.R.Header.Get(Referer), m.R.Method == http.MethodPost) },
|
||||||
func() string { return m.R.Header.Get("X-Host") },
|
func() string { return m.R.Header.Get("X-Host") },
|
||||||
func() string { return ice.Info.Domain },
|
func() string { return ice.Info.Domain },
|
||||||
func() string { return kit.Format("%s://%s", kit.Select("https", ice.HTTP, m.R.TLS == nil), m.R.Host) },
|
func() string {
|
||||||
|
if b, e := regexp.MatchString("^[0-9.]+$", m.R.Host); b && e == nil {
|
||||||
|
return kit.Format("%s://%s:%s", kit.Select("https", ice.HTTP, m.R.TLS == nil), m.R.Host, m.Option(tcp.PORT))
|
||||||
|
}
|
||||||
|
return kit.Format("%s://%s", kit.Select("https", ice.HTTP, m.R.TLS == nil), m.R.Host)
|
||||||
|
},
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
func _serve_login(m *ice.Message, key string, cmds []string, w http.ResponseWriter, r *http.Request) ([]string, bool) {
|
func _serve_login(m *ice.Message, key string, cmds []string, w http.ResponseWriter, r *http.Request) ([]string, bool) {
|
||||||
@ -178,7 +184,7 @@ func init() {
|
|||||||
_serve_start(m)
|
_serve_start(m)
|
||||||
}},
|
}},
|
||||||
SERVE_START: {Hand: func(m *ice.Message, arg ...string) {
|
SERVE_START: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if domain := m.Cmdx(SPACE, DOMAIN); ice.Info.Colors {
|
if domain := m.Cmdx(SPACE, DOMAIN); ice.Info.Colors && m.Option(ice.DEV) == "" {
|
||||||
m.Sleep30ms().Cmd(ssh.PRINTF, kit.Dict(nfs.CONTENT, "\r"+ice.Render(m, ice.RENDER_QRCODE, domain))).Cmd(ssh.PROMPT)
|
m.Sleep30ms().Cmd(ssh.PRINTF, kit.Dict(nfs.CONTENT, "\r"+ice.Render(m, ice.RENDER_QRCODE, domain))).Cmd(ssh.PROMPT)
|
||||||
}
|
}
|
||||||
switch runtime.GOOS {
|
switch runtime.GOOS {
|
||||||
@ -242,7 +248,6 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m.Debug("what %v", p)
|
|
||||||
m.RenderDownload(p)
|
m.RenderDownload(p)
|
||||||
}},
|
}},
|
||||||
PP(ice.REQUIRE, ice.NODE_MODULES): {Name: "/require/node_modules/", Help: "依赖库", Hand: func(m *ice.Message, arg ...string) {
|
PP(ice.REQUIRE, ice.NODE_MODULES): {Name: "/require/node_modules/", Help: "依赖库", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
@ -12,6 +12,8 @@ import (
|
|||||||
"shylinux.com/x/icebergs/base/ctx"
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
"shylinux.com/x/icebergs/base/gdb"
|
"shylinux.com/x/icebergs/base/gdb"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
|
"shylinux.com/x/icebergs/base/ssh"
|
||||||
"shylinux.com/x/icebergs/base/tcp"
|
"shylinux.com/x/icebergs/base/tcp"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
"shylinux.com/x/websocket"
|
"shylinux.com/x/websocket"
|
||||||
@ -21,6 +23,7 @@ func _space_dial(m *ice.Message, dev, name string, arg ...string) {
|
|||||||
msg := m.Cmd(SPIDE, tcp.CLIENT, dev, PP(SPACE))
|
msg := m.Cmd(SPIDE, tcp.CLIENT, dev, PP(SPACE))
|
||||||
uri := kit.ParseURL(strings.Replace(kit.MergeURL(msg.Append(DOMAIN), mdb.TYPE, ice.Info.NodeType, mdb.NAME, name, SHARE, ice.Info.CtxShare, RIVER, ice.Info.CtxRiver, arg), ice.HTTP, "ws", 1))
|
uri := kit.ParseURL(strings.Replace(kit.MergeURL(msg.Append(DOMAIN), mdb.TYPE, ice.Info.NodeType, mdb.NAME, name, SHARE, ice.Info.CtxShare, RIVER, ice.Info.CtxRiver, arg), ice.HTTP, "ws", 1))
|
||||||
args := kit.SimpleKV("type,name,host,port", msg.Append(tcp.PROTOCOL), dev, msg.Append(tcp.HOST), msg.Append(tcp.PORT))
|
args := kit.SimpleKV("type,name,host,port", msg.Append(tcp.PROTOCOL), dev, msg.Append(tcp.HOST), msg.Append(tcp.PORT))
|
||||||
|
prints := false
|
||||||
m.Go(func() {
|
m.Go(func() {
|
||||||
redial := kit.Dict(m.Configv(REDIAL))
|
redial := kit.Dict(m.Configv(REDIAL))
|
||||||
a, b, c := kit.Int(redial["a"]), kit.Int(redial["b"]), kit.Int(redial["c"])
|
a, b, c := kit.Int(redial["a"]), kit.Int(redial["b"]), kit.Int(redial["c"])
|
||||||
@ -29,6 +32,12 @@ func _space_dial(m *ice.Message, dev, name string, arg ...string) {
|
|||||||
m.Cmd(tcp.CLIENT, tcp.DIAL, args, func(c net.Conn) {
|
m.Cmd(tcp.CLIENT, tcp.DIAL, args, func(c net.Conn) {
|
||||||
if conn, _, e := websocket.NewClient(c, uri, nil, kit.Int(redial["r"]), kit.Int(redial["w"])); !m.Warn(e, tcp.DIAL, dev, SPACE, uri.String()) {
|
if conn, _, e := websocket.NewClient(c, uri, nil, kit.Int(redial["r"]), kit.Int(redial["w"])); !m.Warn(e, tcp.DIAL, dev, SPACE, uri.String()) {
|
||||||
defer mdb.HashCreateDeferRemove(m, kit.SimpleKV("", MASTER, dev, msg.Append(tcp.HOSTNAME)), kit.Dict(mdb.TARGET, conn))()
|
defer mdb.HashCreateDeferRemove(m, kit.SimpleKV("", MASTER, dev, msg.Append(tcp.HOSTNAME)), kit.Dict(mdb.TARGET, conn))()
|
||||||
|
if !prints {
|
||||||
|
m.Go(func() {
|
||||||
|
m.Sleep30ms().Cmd(ssh.PRINTF, kit.Dict(nfs.CONTENT, "\r"+ice.Render(m, ice.RENDER_QRCODE, m.CmdAppend(SPACE, dev, cli.PWD, mdb.LINK)))).Cmd(ssh.PROMPT)
|
||||||
|
})
|
||||||
|
prints = true
|
||||||
|
}
|
||||||
_space_handle(m.Spawn(), true, dev, conn)
|
_space_handle(m.Spawn(), true, dev, conn)
|
||||||
i = 0
|
i = 0
|
||||||
}
|
}
|
||||||
|
2
conf.go
2
conf.go
@ -120,6 +120,8 @@ const ( // DIR
|
|||||||
USR_LOCAL_EXPORT = "usr/local/export/"
|
USR_LOCAL_EXPORT = "usr/local/export/"
|
||||||
USR_LOCAL_REPOS = "usr/local/repos/"
|
USR_LOCAL_REPOS = "usr/local/repos/"
|
||||||
|
|
||||||
|
VAR_LOG_BOOT_LOG = "var/log/boot.log"
|
||||||
|
|
||||||
VAR_TMP = "var/tmp/"
|
VAR_TMP = "var/tmp/"
|
||||||
VAR_LOG = "var/log/"
|
VAR_LOG = "var/log/"
|
||||||
VAR_CONF = "var/conf/"
|
VAR_CONF = "var/conf/"
|
||||||
|
@ -54,9 +54,9 @@ func _autogen_version(m *ice.Message) {
|
|||||||
m.Cmdy(cli.SYSTEM, GIT, ice.INIT)
|
m.Cmdy(cli.SYSTEM, GIT, ice.INIT)
|
||||||
m.Cmd(cli.SYSTEM, GIT, "remote", "add", "origin", "https://"+mod)
|
m.Cmd(cli.SYSTEM, GIT, "remote", "add", "origin", "https://"+mod)
|
||||||
m.Cmd(cli.SYSTEM, GIT, "add", ice.GO_MOD, ice.SRC, ice.ETC_MISS_SH)
|
m.Cmd(cli.SYSTEM, GIT, "add", ice.GO_MOD, ice.SRC, ice.ETC_MISS_SH)
|
||||||
m.Cmd(nfs.DEFS, ".gitignore", _git_ignore)
|
|
||||||
m.Cmd("web.code.git.repos", mdb.CREATE, nfs.ORIGIN, "https://"+mod, mdb.NAME, path.Base(mod), nfs.PATH, nfs.PWD)
|
m.Cmd("web.code.git.repos", mdb.CREATE, nfs.ORIGIN, "https://"+mod, mdb.NAME, path.Base(mod), nfs.PATH, nfs.PWD)
|
||||||
}
|
}
|
||||||
|
m.Cmd(nfs.DEFS, ".gitignore", _git_ignore)
|
||||||
m.Cmd(nfs.DEFS, ice.SRC_BINPACK_GO, `package main`+ice.NL)
|
m.Cmd(nfs.DEFS, ice.SRC_BINPACK_GO, `package main`+ice.NL)
|
||||||
m.Cmd(nfs.SAVE, ice.SRC_VERSION_GO, kit.Format(_version_template, _autogen_gits(m, nfs.MODULE, _autogen_mod(m, ice.GO_MOD), tcp.HOSTNAME, ice.Info.Hostname, aaa.USERNAME, ice.Info.Username)))
|
m.Cmd(nfs.SAVE, ice.SRC_VERSION_GO, kit.Format(_version_template, _autogen_gits(m, nfs.MODULE, _autogen_mod(m, ice.GO_MOD), tcp.HOSTNAME, ice.Info.Hostname, aaa.USERNAME, ice.Info.Username)))
|
||||||
m.Cmd(cli.SYSTEM, "gofmt", "-w", ice.SRC_VERSION_GO)
|
m.Cmd(cli.SYSTEM, "gofmt", "-w", ice.SRC_VERSION_GO)
|
||||||
@ -162,7 +162,7 @@ fi
|
|||||||
require miss.sh
|
require miss.sh
|
||||||
ish_miss_prepare_compile
|
ish_miss_prepare_compile
|
||||||
ish_miss_prepare_develop
|
ish_miss_prepare_develop
|
||||||
ish_miss_prepare_operate
|
ish_miss_prepare_project
|
||||||
|
|
||||||
ish_miss_make; if [ -n "$*" ]; then ish_miss_serve "$@"; fi
|
ish_miss_make; if [ -n "$*" ]; then ish_miss_serve "$@"; fi
|
||||||
`
|
`
|
||||||
|
@ -87,14 +87,12 @@ func init() {
|
|||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
PUBLISH: {Name: "publish path auto create volcanos icebergs intshell", Help: "发布", Actions: ice.MergeActions(ice.Actions{
|
PUBLISH: {Name: "publish path auto create volcanos icebergs intshell", Help: "发布", Actions: ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { m.Config(ice.CONTEXTS, _contexts) }},
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { m.Config(ice.CONTEXTS, _contexts) }},
|
||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(nfs.DIR, arg[1:]).Cut("path,size,time").ProcessAgain() }},
|
||||||
m.Cmdy(nfs.DIR, arg[1:]).Cut("path,size,time").ProcessAgain()
|
|
||||||
}},
|
|
||||||
web.SERVE_START: {Hand: func(m *ice.Message, arg ...string) {
|
web.SERVE_START: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if runtime.GOOS == cli.WINDOWS {
|
if runtime.GOOS == cli.WINDOWS {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_publish_file(m, ice.ICE_BIN)
|
// _publish_file(m, ice.ICE_BIN)
|
||||||
}},
|
}},
|
||||||
ice.VOLCANOS: {Help: "火山架", Hand: func(m *ice.Message, arg ...string) {
|
ice.VOLCANOS: {Help: "火山架", Hand: func(m *ice.Message, arg ...string) {
|
||||||
defer func() { m.EchoQRCode(m.Option(ice.MSG_USERWEB)) }()
|
defer func() { m.EchoQRCode(m.Option(ice.MSG_USERWEB)) }()
|
||||||
|
@ -12,7 +12,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func _sh_exec(m *ice.Message, arg ...string) {
|
func _sh_exec(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(cli.SYSTEM, SH, "-c", kit.Format(_sh_template, m.Option(ice.MSG_USERHOST), m.Option(ice.MSG_USERPOD), path.Join(arg[2], arg[1]))).StatusTime()
|
m.Cmdy(cli.SYSTEM, SH, "-c", kit.Format(_sh_template, m.Option(ice.MSG_USERHOST), m.Option(ice.MSG_USERPOD), path.Join(arg[2], arg[1])))
|
||||||
|
m.StatusTime("script", kit.Renders(kit.Format(`export ctx_dev={{.Option "user.host"}}; temp=$(mktemp); wget -O $temp -q $ctx_dev; source $temp %s`, path.Join(arg[2], arg[1])), m))
|
||||||
}
|
}
|
||||||
|
|
||||||
const SH = nfs.SH
|
const SH = nfs.SH
|
||||||
|
6
misc.go
6
misc.go
@ -273,13 +273,17 @@ func (c *Context) _command(m *Message, cmd *Command, key string, arg ...string)
|
|||||||
return c._action(m, cmd, key, arg[1], h, arg[2:]...)
|
return c._action(m, cmd, key, arg[1], h, arg[2:]...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if len(arg) > 0 && arg[0] != COMMAND {
|
|
||||||
if len(arg) > 0 {
|
if len(arg) > 0 {
|
||||||
if h, ok := cmd.Actions[arg[0]]; ok {
|
if h, ok := cmd.Actions[arg[0]]; ok {
|
||||||
return c._action(m, cmd, key, arg[0], h, arg[1:]...)
|
return c._action(m, cmd, key, arg[0], h, arg[1:]...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if len(arg) > 0 && arg[0] == ACTION {
|
||||||
|
if arg[1] == "inputs" {
|
||||||
|
return m
|
||||||
|
}
|
||||||
|
}
|
||||||
return m.CmdHand(cmd, key, arg...)
|
return m.CmdHand(cmd, key, arg...)
|
||||||
}
|
}
|
||||||
func (c *Context) _action(m *Message, cmd *Command, key string, sub string, h *Action, arg ...string) *Message {
|
func (c *Context) _action(m *Message, cmd *Command, key string, sub string, h *Action, arg ...string) *Message {
|
||||||
|
@ -8,10 +8,11 @@ import (
|
|||||||
"shylinux.com/x/icebergs/base/nfs"
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
"shylinux.com/x/icebergs/core/code"
|
"shylinux.com/x/icebergs/core/code"
|
||||||
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
|
|
||||||
func _git_url(m *ice.Message, repos string) string {
|
func _git_url(m *ice.Message, repos string) string {
|
||||||
return web.MergeLink(m, "/x/"+path.Join(repos)+".git")
|
return kit.MergeURL2(m.Option(ice.MSG_USERHOST), "/x/"+path.Join(repos)+".git")
|
||||||
}
|
}
|
||||||
func _git_dir(arg ...string) string { return path.Join(path.Join(arg...), ".git") }
|
func _git_dir(arg ...string) string { return path.Join(path.Join(arg...), ".git") }
|
||||||
func _git_cmd(m *ice.Message, arg ...string) *ice.Message { return m.Cmd(cli.SYSTEM, GIT, arg) }
|
func _git_cmd(m *ice.Message, arg ...string) *ice.Message { return m.Cmd(cli.SYSTEM, GIT, arg) }
|
||||||
|
@ -104,7 +104,7 @@ func _repos_dir(m *ice.Message, dir, branch, commit, file string, cb func(*gogit
|
|||||||
file = ""
|
file = ""
|
||||||
}
|
}
|
||||||
if repos, e := gogit.OpenRepository(dir); !m.Warn(e, ice.ErrNotFound, dir) {
|
if repos, e := gogit.OpenRepository(dir); !m.Warn(e, ice.ErrNotFound, dir) {
|
||||||
if refer, e := repos.LookupReference(REFS_TAGS + commit); !m.Warn(e, ice.ErrNotFound, branch) {
|
if refer, e := repos.LookupReference(REFS_TAGS + commit); e == nil {
|
||||||
commit = refer.Oid.String()
|
commit = refer.Oid.String()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,6 +93,12 @@ const SERVER = "server"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
web.Index.MergeCommands(ice.Commands{"/x/": {Actions: ice.MergeActions(ctx.CmdAction(), aaa.WhiteAction(ctx.COMMAND, ice.RUN)), Hand: func(m *ice.Message, arg ...string) {
|
web.Index.MergeCommands(ice.Commands{"/x/": {Actions: ice.MergeActions(ctx.CmdAction(), aaa.WhiteAction(ctx.COMMAND, ice.RUN)), Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if arg[0] == ice.LIST {
|
||||||
|
m.Cmd("web.code.git.server", func(value ice.Maps) {
|
||||||
|
m.Push(nfs.REPOS, web.MergeLink(m, "/x/"+value[nfs.REPOS]+".git"))
|
||||||
|
})
|
||||||
|
return
|
||||||
|
}
|
||||||
if !m.IsCliUA() || strings.Contains(arg[0], ice.AT) {
|
if !m.IsCliUA() || strings.Contains(arg[0], ice.AT) {
|
||||||
if strings.Contains(arg[0], ice.AT) {
|
if strings.Contains(arg[0], ice.AT) {
|
||||||
ls := strings.Split(arg[0], ice.AT)
|
ls := strings.Split(arg[0], ice.AT)
|
||||||
@ -140,7 +146,7 @@ func init() {
|
|||||||
_repos_cat(m, dir, arg[1], arg[2], kit.Select("", arg, 3))
|
_repos_cat(m, dir, arg[1], arg[2], kit.Select("", arg, 3))
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
SERVER: {Name: "server repos branch commit path auto clone create import", Help: "服务器", Actions: ice.MergeActions(ice.Actions{
|
SERVER: {Name: "server repos branch commit path auto create import", Help: "服务器", Actions: ice.MergeActions(ice.Actions{
|
||||||
mdb.CREATE: {Name: "create name*", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create name*", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_repos_init(m, path.Join(ice.USR_LOCAL_REPOS, m.Option(mdb.NAME)))
|
_repos_init(m, path.Join(ice.USR_LOCAL_REPOS, m.Option(mdb.NAME)))
|
||||||
}},
|
}},
|
||||||
@ -153,8 +159,8 @@ func init() {
|
|||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) {
|
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Assert(m.Option(nfs.PATH) != "")
|
m.Assert(m.Option(nfs.REPOS) != "")
|
||||||
nfs.Trash(m, path.Join(ice.USR_LOCAL_REPOS, m.Option(nfs.PATH)))
|
nfs.Trash(m, path.Join(ice.USR_LOCAL_REPOS, m.Option(nfs.REPOS)))
|
||||||
}},
|
}},
|
||||||
web.DREAM_INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
web.DREAM_INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
@ -162,9 +168,6 @@ func init() {
|
|||||||
m.Cmd("", func(value ice.Maps) { m.Push(nfs.PATH, _git_url(m, value[nfs.PATH])) })
|
m.Cmd("", func(value ice.Maps) { m.Push(nfs.PATH, _git_url(m, value[nfs.PATH])) })
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
"clone": {Help: "克隆", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
m.EchoScript("git clone https://shylinux.com/x/contexts && cd contexts && source etc/miss.sh")
|
|
||||||
}},
|
|
||||||
"inner": {Help: "编辑器", Hand: func(m *ice.Message, arg ...string) {
|
"inner": {Help: "编辑器", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) == 0 || arg[0] != ice.RUN {
|
if len(arg) == 0 || arg[0] != ice.RUN {
|
||||||
arg = []string{path.Join(ice.USR_LOCAL_REPOS, arg[0]), kit.Select("README.md", arg, 3)}
|
arg = []string{path.Join(ice.USR_LOCAL_REPOS, arg[0]), kit.Select("README.md", arg, 3)}
|
||||||
@ -181,8 +184,9 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
}, gdb.EventAction(web.DREAM_INPUTS)), Hand: func(m *ice.Message, arg ...string) {
|
}, gdb.EventAction(web.DREAM_INPUTS)), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Option(nfs.DIR_ROOT, ice.USR_LOCAL_REPOS); len(arg) == 0 {
|
if m.Option(nfs.DIR_ROOT, ice.USR_LOCAL_REPOS); len(arg) == 0 {
|
||||||
m.Option(nfs.DIR_TYPE, nfs.TYPE_DIR)
|
m.Cmdy(nfs.DIR, nfs.PWD, "time,name,size,action", kit.Dict(nfs.DIR_TYPE, nfs.TYPE_DIR), func(value ice.Maps) {
|
||||||
m.Cmdy(nfs.DIR, nfs.PWD, func(value ice.Maps) { m.PushScript("git clone " + _git_url(m, value[nfs.PATH])) }).Cut("time,path,size,script,action").RenameAppend("path", "repos")
|
m.PushScript("git clone " + _git_url(m, value[mdb.NAME]))
|
||||||
|
}).Cut("time,name,size,script,action").RenameAppend(mdb.NAME, nfs.REPOS).SortStrR(mdb.TIME)
|
||||||
} else if dir := path.Join(m.Option(nfs.DIR_ROOT), arg[0]); len(arg) == 1 {
|
} else if dir := path.Join(m.Option(nfs.DIR_ROOT), arg[0]); len(arg) == 1 {
|
||||||
_repos_branch(m, dir)
|
_repos_branch(m, dir)
|
||||||
} else if len(arg) == 2 {
|
} else if len(arg) == 2 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user