1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-04-03 14:15:30 +08:00
parent fd319e30e4
commit e4d0d98702
5 changed files with 14 additions and 4 deletions

View File

@ -110,7 +110,7 @@ func init() {
return
}
for i, v := range arg[1:] {
kit.Value(cmd.List, kit.Keys(i, "value"), v)
kit.Value(cmd.List, kit.Keys(i, mdb.VALUE), v)
}
})
}},

View File

@ -346,6 +346,8 @@ func init() {
kit.If(m.Option(mdb.NAME) == "", func() { m.Sleep("5s").Cmdy(ROUTE, cli.BUILD).ProcessInner() })
}},
"gowork": {Name: "gowork name", Help: "工作区", Hand: func(m *ice.Message, arg ...string) {
m.Cmd(cli.SYSTEM, cli.GO, "work", "init")
m.Cmd(cli.SYSTEM, cli.GO, "work", "use", ".")
DreamEach(m, m.Option(mdb.NAME), "", func(name string) {
m.Cmd(cli.SYSTEM, cli.GO, "work", "use", path.Join(ice.USR_LOCAL_WORK, name))
})

View File

@ -161,7 +161,7 @@ const CONNECT = "connect"
func init() {
psh.Index.MergeCommands(ice.Commands{
CONNECT: {Help: "连接", Actions: ice.MergeActions(ice.Actions{
tcp.OPEN: {Name: "open authfile username=shy host=shylinux.com port=22 cmds private=.ssh/id_rsa password verfiy", Help: "终端", Hand: func(m *ice.Message, arg ...string) {
tcp.OPEN: {Name: "open authfile username=shy host=shylinux.com port=22 cmds init private=.ssh/id_rsa password verfiy", Help: "终端", Hand: func(m *ice.Message, arg ...string) {
if m.Option(ctx.CMDS) == "" {
defer nfs.OptionLoad(m, m.Option(AUTHFILE)).Echo("exit %s@%s:%s\n", m.Option(aaa.USERNAME), m.Option(tcp.HOST), m.Option(tcp.PORT))
_ssh_open(m.SetResult(), arg...)

View File

@ -164,7 +164,11 @@ func (s relay) Publish(m *ice.Message, arg ...string) {
m.Cmdy(nfs.DIR, ice.USR_PUBLISH).PushAction()
return
}
m.Cmd(nfs.SAVE, kit.HomePath(".ssh/"+m.Option(MACHINE)+".json"), kit.Formats(kit.Dict(m.OptionSimple("username,host,port")))+ice.NL)
if m.Option(ice.INIT, ""); m.Option(web.PORTAL) != "" {
m.Option(ice.INIT, kit.Format("cd %s", path.Base(m.DreamPath(m.Option(web.DREAM)))))
}
m.Debug("what %v", m.Option(web.PORTAL))
m.Cmd(nfs.SAVE, kit.HomePath(".ssh/"+m.Option(MACHINE)+".json"), kit.Formats(kit.Dict(m.OptionSimple("username,host,port,init")))+ice.NL)
kit.If(!m.Exists(path.Join(ice.USR_PUBLISH, RELAY)), func() { s.Compile(m) })
os.Symlink(RELAY, ice.USR_PUBLISH+m.Option(MACHINE))
}

View File

@ -342,7 +342,11 @@ func (m *Message) Search(key string, cb Any) *Message {
}
key = ls[len(ls)-1]
} else if ctx, ok := Info.Index[key].(*Context); ok {
if _, ok := m.target.Commands[key]; ok {
p = m.target
} else {
p = ctx
}
} else {
p = m.target
}