mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 17:44:05 +08:00
opt some
This commit is contained in:
parent
a17a4ebfec
commit
6cf4b75d5f
@ -76,6 +76,7 @@ func _link_file(m *ice.Message, name string, from string) {
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
CONTENT = "content"
|
CONTENT = "content"
|
||||||
|
ALIAS = "alias"
|
||||||
)
|
)
|
||||||
const LOAD = "load"
|
const LOAD = "load"
|
||||||
const DEFS = "defs"
|
const DEFS = "defs"
|
||||||
|
@ -290,7 +290,7 @@ func init() {
|
|||||||
MERGE: {Hand: func(m *ice.Message, arg ...string) {
|
MERGE: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Echo(kit.MergeURL2(m.CmdAppend("", arg[0], CLIENT_URL), arg[1], arg[2:]))
|
m.Echo(kit.MergeURL2(m.CmdAppend("", arg[0], CLIENT_URL), arg[1], arg[2:]))
|
||||||
}},
|
}},
|
||||||
}, mdb.HashAction(mdb.SHORT, CLIENT_NAME, mdb.FIELD, "time,client.name,client.url,client.origin", LOGHEADERS, ice.FALSE), mdb.ClearHashOnExitAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.HashAction(mdb.SHORT, CLIENT_NAME, mdb.FIELD, "time,client.name,client.url", LOGHEADERS, ice.FALSE), mdb.ClearHashOnExitAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) < 2 || arg[0] == "" || (len(arg) > 3 && arg[3] == "") {
|
if len(arg) < 2 || arg[0] == "" || (len(arg) > 3 && arg[3] == "") {
|
||||||
mdb.HashSelect(m, kit.Slice(arg, 0, 1)...).Sort(CLIENT_NAME)
|
mdb.HashSelect(m, kit.Slice(arg, 0, 1)...).Sort(CLIENT_NAME)
|
||||||
} else {
|
} else {
|
||||||
|
@ -7,6 +7,7 @@ import (
|
|||||||
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"
|
||||||
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
"shylinux.com/x/icebergs/base/ssh"
|
"shylinux.com/x/icebergs/base/ssh"
|
||||||
@ -105,6 +106,23 @@ func init() {
|
|||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
AUTOGEN: {Name: "autogen path auto module binpack script relay", Help: "生成", Actions: ice.Actions{
|
AUTOGEN: {Name: "autogen path auto module binpack script relay", Help: "生成", Actions: ice.Actions{
|
||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if m.Option(ctx.ACTION) == RELAY {
|
||||||
|
switch arg[0] {
|
||||||
|
case nfs.ALIAS:
|
||||||
|
m.Cmdy(web.SPIDE).CutTo("client.name", arg[0])
|
||||||
|
case aaa.USERNAME:
|
||||||
|
m.Cmdy(aaa.USER).Cut(aaa.USERNAME)
|
||||||
|
m.Push(arg[0], "shy")
|
||||||
|
case tcp.HOST:
|
||||||
|
m.Option(ice.MSG_FIELDS, "client.hostname")
|
||||||
|
m.Cmdy(web.SPIDE)
|
||||||
|
case tcp.PORT:
|
||||||
|
m.Push(arg[0], "22")
|
||||||
|
case ice.INIT:
|
||||||
|
m.Push(arg[0], "tmux attach -t miss")
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case cli.MAIN:
|
case cli.MAIN:
|
||||||
m.Cmdy(nfs.DIR, nfs.PWD, nfs.DIR_CLI_FIELDS, kit.Dict(nfs.DIR_ROOT, m.Option(nfs.PATH), nfs.DIR_REG, `.*\.go$`)).RenameAppend(nfs.PATH, arg[0])
|
m.Cmdy(nfs.DIR, nfs.PWD, nfs.DIR_CLI_FIELDS, kit.Dict(nfs.DIR_ROOT, m.Option(nfs.PATH), nfs.DIR_REG, `.*\.go$`)).RenameAppend(nfs.PATH, arg[0])
|
||||||
@ -147,7 +165,7 @@ func init() {
|
|||||||
_autogen_version(m)
|
_autogen_version(m)
|
||||||
m.Cmdy(nfs.CAT, ice.SRC_VERSION_GO)
|
m.Cmdy(nfs.CAT, ice.SRC_VERSION_GO)
|
||||||
}},
|
}},
|
||||||
RELAY: {Name: "relay alias username host port init", Help: "跳板", Hand: func(m *ice.Message, arg ...string) {
|
RELAY: {Name: "relay alias username host port=22 init", Help: "跳板", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(COMPILE, RELAY)
|
m.Cmdy(COMPILE, RELAY)
|
||||||
m.Cmdy(nfs.LINK, ice.USR_PUBLISH+m.Option(mdb.ALIAS), ice.USR_PUBLISH+RELAY)
|
m.Cmdy(nfs.LINK, ice.USR_PUBLISH+m.Option(mdb.ALIAS), ice.USR_PUBLISH+RELAY)
|
||||||
m.Cmd(nfs.SAVE, path.Join(kit.Env(cli.HOME), ".ssh/"+m.Option(mdb.ALIAS)+".json"),
|
m.Cmd(nfs.SAVE, path.Join(kit.Env(cli.HOME), ".ssh/"+m.Option(mdb.ALIAS)+".json"),
|
||||||
|
@ -67,9 +67,9 @@ func _publish_contexts(m *ice.Message, arg ...string) {
|
|||||||
case ice.MISC:
|
case ice.MISC:
|
||||||
_publish_file(m, ice.ICE_BIN)
|
_publish_file(m, ice.ICE_BIN)
|
||||||
case ice.CORE:
|
case ice.CORE:
|
||||||
m.Option(web.DOMAIN, m.Cmdx(web.SPIDE, ice.SHY, "client.origin"))
|
m.Option(web.DOMAIN, m.Cmd(web.SPIDE, ice.SHY).Append("client.origin"))
|
||||||
case ice.BASE:
|
case ice.BASE:
|
||||||
m.Option(web.DOMAIN, m.Cmdx(web.SPIDE, ice.SHY, "client.origin"))
|
m.Option(web.DOMAIN, m.Cmd(web.SPIDE, ice.SHY).Append("client.origin"))
|
||||||
m.Option(nfs.REMOTE, kit.Select(ice.Info.Make.Remote, cli.SystemExec(m, "git", "config", "remote.origin.url")))
|
m.Option(nfs.REMOTE, kit.Select(ice.Info.Make.Remote, cli.SystemExec(m, "git", "config", "remote.origin.url")))
|
||||||
}
|
}
|
||||||
if buf, err := kit.Render(m.Config(kit.Keys(ice.CONTEXTS, k)), m); m.Assert(err) {
|
if buf, err := kit.Render(m.Config(kit.Keys(ice.CONTEXTS, k)), m); m.Assert(err) {
|
||||||
@ -85,8 +85,15 @@ const PUBLISH = "publish"
|
|||||||
|
|
||||||
func init() {
|
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 relay", 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) {
|
||||||
|
if m.Option(ctx.ACTION) == RELAY {
|
||||||
|
m.Cmdy(AUTOGEN, mdb.INPUTS, arg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
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
|
||||||
@ -107,9 +114,11 @@ func init() {
|
|||||||
_publish_list(m, kit.ExtReg(`(sh|vim|conf)`))
|
_publish_list(m, kit.ExtReg(`(sh|vim|conf)`))
|
||||||
}},
|
}},
|
||||||
ice.CONTEXTS: {Hand: func(m *ice.Message, arg ...string) { _publish_contexts(m, arg...) }},
|
ice.CONTEXTS: {Hand: func(m *ice.Message, arg ...string) { _publish_contexts(m, arg...) }},
|
||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(nfs.DIR, arg[1:]).Cut("path,size,time").ProcessAgain() }},
|
|
||||||
mdb.CREATE: {Name: "create file", Help: "添加", Hand: func(m *ice.Message, arg ...string) { _publish_file(m, m.Option(nfs.FILE)) }},
|
mdb.CREATE: {Name: "create file", Help: "添加", Hand: func(m *ice.Message, arg ...string) { _publish_file(m, m.Option(nfs.FILE)) }},
|
||||||
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) { nfs.Trash(m, path.Join(ice.USR_PUBLISH, m.Option(nfs.PATH))) }},
|
RELAY: {Name: "relay alias username host port=22 init", Help: "跳板", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmdy(AUTOGEN, RELAY, arg)
|
||||||
|
}},
|
||||||
|
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) { nfs.Trash(m, path.Join(ice.USR_PUBLISH, m.Option(nfs.PATH))) }},
|
||||||
}, ctx.ConfAction(ice.CONTEXTS, _contexts), aaa.RoleAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, ctx.ConfAction(ice.CONTEXTS, _contexts), aaa.RoleAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(nfs.DIR, kit.Select("", arg, 0), nfs.DIR_WEB_FIELDS, kit.Dict(nfs.DIR_ROOT, ice.USR_PUBLISH)).SortTimeR(mdb.TIME)
|
m.Cmdy(nfs.DIR, kit.Select("", arg, 0), nfs.DIR_WEB_FIELDS, kit.Dict(nfs.DIR_ROOT, ice.USR_PUBLISH)).SortTimeR(mdb.TIME)
|
||||||
}},
|
}},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user