1
0
forked from x/icebergs

opt index

This commit is contained in:
harveyshao 2021-05-12 11:13:26 +08:00
parent a3575a65e9
commit a42766ddb2
3 changed files with 17 additions and 8 deletions

View File

@ -202,6 +202,9 @@ func _space_search(m *ice.Message, kind, name, text string, arg ...string) {
if name == "" { if name == "" {
port := m.Cmd(SERVE, ice.Option{mdb.FIELDS, tcp.PORT}).Append(tcp.PORT) port := m.Cmd(SERVE, ice.Option{mdb.FIELDS, tcp.PORT}).Append(tcp.PORT)
if port == "" {
return
}
m.Cmd(tcp.HOST).Table(func(index int, value map[string]string, head []string) { m.Cmd(tcp.HOST).Table(func(index int, value map[string]string, head []string) {
m.PushSearch(kit.SSH_CMD, SPACE, kit.MDB_TYPE, MYSELF, kit.MDB_NAME, value[kit.MDB_NAME], m.PushSearch(kit.SSH_CMD, SPACE, kit.MDB_TYPE, MYSELF, kit.MDB_NAME, value[kit.MDB_NAME],
kit.MDB_TEXT, kit.Format("http://%s:%s", value[tcp.IP], port), kit.SSH_POD, kit.Keys(m.Option(ice.MSG_USERPOD), value)) kit.MDB_TEXT, kit.Format("http://%s:%s", value[tcp.IP], port), kit.SSH_POD, kit.Keys(m.Option(ice.MSG_USERPOD), value))

View File

@ -322,7 +322,7 @@ func init() {
m.Cmdy(mdb.IMPORT, RIVER, "", mdb.HASH) m.Cmdy(mdb.IMPORT, RIVER, "", mdb.HASH)
}}, }},
aaa.INVITE: {Name: "invite", Help: "脚本", Hand: func(m *ice.Message, arg ...string) { aaa.INVITE: {Name: "invite", Help: "脚本", Hand: func(m *ice.Message, arg ...string) {
for _, k := range []string{"tmux", "base", "miss"} { for _, k := range []string{"tmux", "base", "miss", "binary", "source"} {
m.Cmdy("web.code.publish", "contexts", k) m.Cmdy("web.code.publish", "contexts", k)
} }
}}, }},

View File

@ -1,6 +1,12 @@
package code package code
import ( import (
"fmt"
"os"
"path"
"runtime"
"strings"
ice "github.com/shylinux/icebergs" ice "github.com/shylinux/icebergs"
"github.com/shylinux/icebergs/base/cli" "github.com/shylinux/icebergs/base/cli"
"github.com/shylinux/icebergs/base/mdb" "github.com/shylinux/icebergs/base/mdb"
@ -8,12 +14,6 @@ import (
"github.com/shylinux/icebergs/base/tcp" "github.com/shylinux/icebergs/base/tcp"
"github.com/shylinux/icebergs/base/web" "github.com/shylinux/icebergs/base/web"
kit "github.com/shylinux/toolkits" kit "github.com/shylinux/toolkits"
"fmt"
"os"
"path"
"runtime"
"strings"
) )
func _publish_file(m *ice.Message, file string, arg ...string) string { func _publish_file(m *ice.Message, file string, arg ...string) string {
@ -149,11 +149,17 @@ echo "hello world"
} }
var _contexts = kit.Dict( var _contexts = kit.Dict(
"source", `# 源码安装
curl -fsSL {{.Option "httphost"}} |sh -s source
`,
"binary", `# 应用安装
curl -fsSL {{.Option "httphost"}} |sh -s binary
`,
"tmux", `# 终端环境 "tmux", `# 终端环境
export ctx_dev={{.Option "httphost"}} ctx_temp=$(mktemp); curl -fsSL $ctx_dev -o $ctx_temp; source $ctx_temp export ctx_dev={{.Option "httphost"}} ctx_temp=$(mktemp); curl -fsSL $ctx_dev -o $ctx_temp; source $ctx_temp
`, `,
"base", `# 生产环境 "base", `# 生产环境
export ctx_dev={{.Option "httphost"}} ctx_temp=$(mktemp); curl -fsSL $ctx_dev -o $ctx_temp; source $ctx_temp ice export ctx_dev={{.Option "httphost"}} ctx_temp=$(mktemp); curl -fsSL $ctx_dev -o $ctx_temp; source $ctx_temp app
`, `,
"miss", `# 开发环境 "miss", `# 开发环境
export ctx_dev={{.Option "httphost"}} ctx_temp=$(mktemp); curl -fsSL $ctx_dev -o $ctx_temp; source $ctx_temp dev export ctx_dev={{.Option "httphost"}} ctx_temp=$(mktemp); curl -fsSL $ctx_dev -o $ctx_temp; source $ctx_temp dev