mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 01:24:05 +08:00
opt auto
This commit is contained in:
parent
2c13b454f9
commit
ee6113de53
@ -111,6 +111,7 @@ func (f *Frame) prompt(m *ice.Message, list ...string) *Frame {
|
||||
list = append(list, f.ps1...)
|
||||
}
|
||||
|
||||
m.Sleep("10ms")
|
||||
fmt.Fprintf(f.stdout, "\r")
|
||||
for _, v := range list {
|
||||
switch v {
|
||||
|
@ -244,16 +244,16 @@ func init() {
|
||||
m.Cmdy(mdb.SELECT, SERVE, "", mdb.HASH, kit.MDB_NAME, arg)
|
||||
}},
|
||||
|
||||
"/intshell/": {Name: "/intshell/", Help: "脚本", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Render(ice.RENDER_DOWNLOAD, path.Join(m.Conf(SERVE, "meta.intshell.path"), path.Join(arg...)))
|
||||
"/volcanos/": {Name: "/volcanos/", Help: "浏览器", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Render(ice.RENDER_DOWNLOAD, path.Join(m.Conf(SERVE, kit.Keym("volcanos.path")), path.Join(arg...)))
|
||||
}},
|
||||
"/volcanos/": {Name: "/volcanos/", Help: "脚本", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Render(ice.RENDER_DOWNLOAD, path.Join(m.Conf(SERVE, "meta.volcanos.path"), path.Join(arg...)))
|
||||
"/intshell/": {Name: "/intshell/", Help: "命令行", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Render(ice.RENDER_DOWNLOAD, path.Join(m.Conf(SERVE, kit.Keym("intshell.path")), path.Join(arg...)))
|
||||
}},
|
||||
"/publish/": {Name: "/publish/", Help: "源码", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
"/publish/": {Name: "/publish/", Help: "私有云", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
_share_local(m, m.Conf(SERVE, kit.Keym("publish")), path.Join(arg...))
|
||||
}},
|
||||
"/require/": {Name: "/require/", Help: "源码", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
"/require/": {Name: "/require/", Help: "公有云", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
_share_repos(m, path.Join(arg[0], arg[1], arg[2]), arg[3:]...)
|
||||
}},
|
||||
}})
|
||||
|
@ -174,6 +174,7 @@ func _space_handle(m *ice.Message, safe bool, send map[string]*ice.Message, c *w
|
||||
}
|
||||
|
||||
} else { // 接收响应
|
||||
m.Debug("what %v", 123)
|
||||
res.Back(msg)
|
||||
}
|
||||
}
|
||||
|
@ -92,6 +92,7 @@ var Index = &ice.Context{Name: WEB, Help: "网络模块",
|
||||
Commands: map[string]*ice.Command{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Load()
|
||||
m.Conf(SPACE, kit.MDB_HASH, "")
|
||||
|
||||
m.Cmd(SPIDE, mdb.CREATE, SPIDE_DEV, kit.Select("http://:9020", m.Conf(cli.RUNTIME, "conf.ctx_dev")))
|
||||
m.Cmd(SPIDE, mdb.CREATE, SPIDE_SELF, kit.Select("http://:9020", m.Conf(cli.RUNTIME, "conf.ctx_self")))
|
||||
|
@ -84,7 +84,7 @@ func _action_proxy(m *ice.Message) (proxy []string) {
|
||||
}
|
||||
func _action_upload(m *ice.Message, arg ...string) {
|
||||
msg := m.Cmd(web.CACHE, web.UPLOAD)
|
||||
m.Option(ice.MSG_UPLOAD, msg.Append(kit.MDB_HASH), msg.Append(kit.MDB_NAME))
|
||||
m.Option(ice.MSG_UPLOAD, msg.Append(kit.MDB_HASH), msg.Append(kit.MDB_NAME), msg.Append(kit.MDB_SIZE))
|
||||
}
|
||||
|
||||
const (
|
||||
|
@ -18,15 +18,15 @@ func init() {
|
||||
FILES: {Name: "files hash auto upload", Help: "文件夹", Action: map[string]*ice.Action{
|
||||
web.UPLOAD: {Name: "upload", Help: "上传", Hand: func(m *ice.Message, arg ...string) {
|
||||
up := kit.Simple(m.Optionv(ice.MSG_UPLOAD))
|
||||
m.Cmdy(mdb.INSERT, FILES, "", mdb.HASH, kit.MDB_NAME, up[1], kit.MDB_TYPE, kit.Ext(up[1]), kit.MDB_DATA, up[0])
|
||||
m.Cmdy(mdb.INSERT, FILES, "", mdb.HASH, kit.MDB_NAME, up[1], kit.MDB_TYPE, kit.Ext(up[1]), kit.MDB_DATA, up[0], kit.MDB_SIZE, up[2])
|
||||
}},
|
||||
mdb.REMOVE: {Name: "remove", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(mdb.DELETE, FILES, "", mdb.HASH, kit.MDB_HASH, m.Option(kit.MDB_HASH))
|
||||
}},
|
||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Option(mdb.FIELDS, kit.Select("time,hash,type,name,data", mdb.DETAIL, len(arg) > 0))
|
||||
m.Option(mdb.FIELDS, kit.Select("time,size,type,name,data", mdb.DETAIL, len(arg) > 0))
|
||||
m.Cmd(mdb.SELECT, cmd, "", mdb.HASH, kit.MDB_HASH, arg).Table(func(index int, value map[string]string, head []string) {
|
||||
m.Push("", value, kit.Split(kit.Select("time,hash,type,name", "time,type,name", len(arg) > 0)))
|
||||
m.Push("", value, kit.Split(kit.Select("time,size,type,name", "time,size,type,name", len(arg) > 0)))
|
||||
|
||||
if m.PushDownload(value[kit.MDB_NAME], "/share/cache/"+value[kit.MDB_DATA]); len(arg) > 0 {
|
||||
switch {
|
||||
|
@ -283,8 +283,8 @@ func init() {
|
||||
m.Conf(RIVER, kit.Keys(kit.MDB_HASH, h, USER, kit.MDB_META, kit.MDB_SHORT), aaa.USERNAME)
|
||||
m.Cmd(m.Prefix(USER), mdb.INSERT, aaa.USERNAME, m.Option(ice.MSG_USERNAME))
|
||||
|
||||
kit.Fetch(m.Confv(RIVER, kit.Keys("meta.template", kit.Select("base", m.Option("template")))), func(storm string, value interface{}) {
|
||||
h := m.Cmdx(TOOL, mdb.CREATE, kit.MDB_TYPE, "public", kit.MDB_NAME, storm, kit.MDB_TEXT, storm)
|
||||
kit.Fetch(m.Confv(RIVER, kit.Keym(kit.MDB_TEMPLATE, kit.Select("base", m.Option(kit.MDB_TEMPLATE)))), func(storm string, value interface{}) {
|
||||
h := m.Cmdx(TOOL, mdb.CREATE, kit.MDB_TYPE, PUBLIC, kit.MDB_NAME, storm, kit.MDB_TEXT, storm)
|
||||
|
||||
kit.Fetch(value, func(index int, value string) {
|
||||
m.Search(value, func(p *ice.Context, s *ice.Context, key string, cmd *ice.Command) {
|
||||
@ -309,14 +309,10 @@ func init() {
|
||||
for _, k := range []string{"tmux", "base", "miss"} {
|
||||
m.Cmdy("web.code.publish", "contexts", k)
|
||||
}
|
||||
|
||||
m.EchoScript("shell", "# 共享环境", m.Option(ice.MSG_USERWEB))
|
||||
m.EchoQRCode(m.Option(ice.MSG_USERWEB))
|
||||
m.EchoAnchor(m.Option(ice.MSG_USERWEB))
|
||||
}},
|
||||
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||
switch m.Option("action") {
|
||||
case "start":
|
||||
switch m.Option(kit.MDB_ACTION) {
|
||||
case tcp.START:
|
||||
m.Cmdy(web.DREAM, kit.MDB_ACTION, mdb.INPUTS, arg)
|
||||
return
|
||||
}
|
||||
@ -324,13 +320,13 @@ func init() {
|
||||
switch arg[0] {
|
||||
case aaa.USERNAME:
|
||||
m.Cmdy(aaa.USER)
|
||||
m.Appendv(ice.MSG_APPEND, "username", "usernick", "userzone")
|
||||
m.Appendv(ice.MSG_APPEND, aaa.USERNAME, aaa.USERNICK, aaa.USERZONE)
|
||||
case aaa.USERROLE:
|
||||
m.Push(aaa.USERROLE, aaa.VOID)
|
||||
m.Push(aaa.USERROLE, aaa.TECH)
|
||||
m.Push(aaa.USERROLE, aaa.ROOT)
|
||||
case "template":
|
||||
m.Push("template", "base")
|
||||
case kit.MDB_TEMPLATE:
|
||||
m.Push(kit.MDB_TEMPLATE, "base")
|
||||
default:
|
||||
m.Cmdy(mdb.INPUTS, RIVER, "", mdb.HASH, arg)
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ func init() {
|
||||
}
|
||||
for _, k := range arg {
|
||||
if buf, err := kit.Render(m.Conf(PUBLISH, kit.Keym("contexts", k)), m); m.Assert(err) {
|
||||
m.EchoScript(string(buf))
|
||||
m.EchoScript(strings.TrimSpace(string(buf)))
|
||||
}
|
||||
}
|
||||
}},
|
||||
@ -118,20 +118,16 @@ func init() {
|
||||
}
|
||||
|
||||
var _contexts = kit.Dict(
|
||||
"tmux", `
|
||||
# 终端环境
|
||||
"tmux", `# 终端环境
|
||||
export ctx_dev={{.Option "httphost"}} ctx_temp=$(mktemp); curl -sL $ctx_dev >$ctx_temp; source $ctx_temp
|
||||
`,
|
||||
"base", `
|
||||
# 生产环境
|
||||
"base", `# 生产环境
|
||||
export ctx_dev={{.Option "httphost"}} ctx_temp=$(mktemp); curl -sL $ctx_dev >$ctx_temp; source $ctx_temp ice
|
||||
`,
|
||||
"miss", `
|
||||
# 开发环境
|
||||
"miss", `# 开发环境
|
||||
export ctx_dev={{.Option "httphost"}} ctx_temp=$(mktemp); curl -sL $ctx_dev >$ctx_temp; source $ctx_temp dev
|
||||
`,
|
||||
"tool", `
|
||||
# 群组环境
|
||||
"tool", `# 群组环境
|
||||
mkdir contexts; cd contexts
|
||||
export ctx_log=/dev/stdout ctx_dev={{.Option "httphost"}} ctx_river={{.Option "sess.river"}} ctx_share={{.Option "share"}} ctx_temp=$(mktemp); curl -sL $ctx_dev >$ctx_temp; source $ctx_temp ice
|
||||
`,
|
||||
|
@ -57,6 +57,9 @@ func init() {
|
||||
if f, _, e := kit.Create("usr/publish/webpack/" + m.Option("name") + ".js"); m.Assert(e) {
|
||||
defer f.Close()
|
||||
|
||||
f.WriteString("\n")
|
||||
f.WriteString(kit.Format(`Volcanos.meta.args = {river: "%s", storm: "%s"}`, m.Option("river"), m.Option("storm")))
|
||||
f.WriteString("\n")
|
||||
f.WriteString(`Volcanos.meta.pack = ` + kit.Formats(kit.UnMarshal(kit.Select("{}", m.Option("content")))))
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ func init() {
|
||||
"/upload": {Name: "/upload", Help: "上传", Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
// 缓存文件
|
||||
msg := m.Cmd(web.CACHE, web.UPLOAD)
|
||||
m.Option(ice.MSG_UPLOAD, msg.Append(kit.MDB_HASH), msg.Append(kit.MDB_NAME))
|
||||
m.Option(ice.MSG_UPLOAD, msg.Append(kit.MDB_HASH), msg.Append(kit.MDB_NAME), msg.Append(kit.MDB_SIZE))
|
||||
m.Cmd(chat.FILES, web.UPLOAD)
|
||||
|
||||
for _, k := range []string{kit.MDB_DATA, kit.MDB_TIME, kit.MDB_TYPE, kit.MDB_NAME, kit.MDB_SIZE} {
|
||||
|
Loading…
x
Reference in New Issue
Block a user