mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 01:24:05 +08:00
opt some
This commit is contained in:
parent
28046db51a
commit
fc85438a01
@ -17,8 +17,14 @@ const FOREVER = "forever"
|
||||
|
||||
func init() {
|
||||
const SERVE = "serve"
|
||||
const RESTART = "restart"
|
||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
||||
FOREVER: {Name: "forever", Help: "启动", Action: map[string]*ice.Action{
|
||||
RESTART: {Name: "restart", Help: "重启", Hand: func(m *ice.Message, arg ...string) {
|
||||
if p := m.Cmdx(nfs.CAT, m.Conf("gdb.signal", kit.Keym(nfs.PATH))); p != "" {
|
||||
m.Cmd(SYSTEM, "kill", "-s", "INT", p)
|
||||
}
|
||||
}},
|
||||
SERVE: {Name: "serve", Help: "服务", Hand: func(m *ice.Message, arg ...string) {
|
||||
env := []string{PATH, BinPath(), HOME, kit.Select(kit.Path(""), os.Getenv(HOME))}
|
||||
for _, k := range []string{TERM, SHELL, CTX_SHY, CTX_DEV, CTX_OPS, CTX_ARG, CTX_PID, CTX_USER, CTX_SHARE, CTX_RIVER} {
|
||||
|
@ -3,6 +3,7 @@ package cli
|
||||
import (
|
||||
"bytes"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"strings"
|
||||
@ -58,6 +59,7 @@ func _system_cmd(m *ice.Message, arg ...string) *exec.Cmd {
|
||||
if len(cmd.Env) > 0 {
|
||||
m.Log_EXPORT(CMD_ENV, cmd.Env)
|
||||
}
|
||||
m.Debug("wht%v", os.Getenv(PATH))
|
||||
return cmd
|
||||
}
|
||||
func _system_out(m *ice.Message, out string) io.Writer {
|
||||
|
@ -125,13 +125,16 @@ func init() {
|
||||
_header_users(m, m.ActionKey(), arg...)
|
||||
}},
|
||||
|
||||
"local": {Name: "local", Help: "配置", Hand: func(m *ice.Message, arg ...string) {
|
||||
"config": {Name: "config", Help: "配置", Hand: func(m *ice.Message, arg ...string) {
|
||||
pod := strings.Split(m.Cmdx(web.SPACE, m.Option(ice.MSG_USERPOD), cli.RUNTIME, "make.domain"), "/chat/pod/")[1]
|
||||
m.Cmd(web.SPACE, m.Option(ice.MSG_USERPOD), nfs.SAVE, "etc/local.shy", m.Cmdx(web.SPACE, pod, nfs.CAT, "etc/local.shy"))
|
||||
m.Cmd(web.SPACE, m.Option(ice.MSG_USERPOD), ssh.SOURCE, "etc/local.shy")
|
||||
}},
|
||||
"source": {Name: "source", Help: "源码", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(web.SPACE, m.Option(ice.MSG_USERPOD), cli.SYSTEM, "git", "push", "-u", m.MergeURL2("/x/")+m.Option(ice.MSG_USERPOD))
|
||||
}},
|
||||
aaa.INVITE: {Name: "invite", Help: "脚本", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmdy(code.PUBLISH, ice.CONTEXTS, ice.CORE)
|
||||
m.Cmdy(code.PUBLISH, ice.CONTEXTS, ice.CORE, ice.MISC)
|
||||
m.Cmd(code.PUBLISH, mdb.CREATE, nfs.FILE, ice.BIN_ICE_BIN)
|
||||
}},
|
||||
code.WEBPACK: {Name: "webpack", Help: "打包页面", Hand: func(m *ice.Message, arg ...string) {
|
||||
|
@ -148,13 +148,13 @@ func init() {
|
||||
}
|
||||
|
||||
var _contexts = kit.Dict(
|
||||
ice.MISC, `# 完整版
|
||||
export ctx_dev={{.Option "httphost"}}; ctx_temp=$(mktemp); curl -fsSL $ctx_dev -o $ctx_temp; source $ctx_temp dev
|
||||
ice.MISC, `# 源码下载
|
||||
git clone {{.Option "httphost"}}/x/{{.Option "user.pod"}}; cd {{.Option "user.pod"}} && source etc/miss.sh port 9020
|
||||
`,
|
||||
ice.CORE, `# 标准版
|
||||
ice.CORE, `# 命令下载
|
||||
export ctx_dev={{.Option "httphost"}} ctx_pod={{.Option "user.pod"}}; ctx_temp=$(mktemp); wget -O $ctx_temp $ctx_dev; source $ctx_temp app
|
||||
`,
|
||||
ice.BASE, `# 官方版
|
||||
ice.BASE, `# 官方下载
|
||||
ctx_temp=$(mktemp); curl -o $ctx_temp -fsSL {{.Cmdx "spide" "shy" "url"}}; source $ctx_temp binary
|
||||
ctx_temp=$(mktemp); wget -O $ctx_temp {{.Cmdx "spide" "shy" "url"}}; source $ctx_temp binary
|
||||
`,
|
||||
|
@ -87,8 +87,12 @@ func init() {
|
||||
}},
|
||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
text := m.Cmdx(cli.SYSTEM, TMUX, "show-buffer")
|
||||
m.EchoQRCode(text)
|
||||
m.EchoScript(text)
|
||||
if m.EchoQRCode(text); strings.HasPrefix(text, ice.HTTP) {
|
||||
m.Echo(ice.NL)
|
||||
m.EchoAnchor(text)
|
||||
} else {
|
||||
m.EchoScript(text)
|
||||
}
|
||||
}},
|
||||
}})
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user