mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 01:24:05 +08:00
opt some
This commit is contained in:
parent
52d581c4b5
commit
f95632b30a
@ -113,18 +113,24 @@ func _system_code(cmd *exec.Cmd) string {
|
||||
return kit.Select("1", "0", cmd.ProcessState != nil && cmd.ProcessState.Success())
|
||||
}
|
||||
func _system_find(m Message, bin string, dir ...string) string {
|
||||
ice.Pulse.Debug("what %v %v", bin, dir)
|
||||
if strings.Contains(bin, ice.DF) {
|
||||
ice.Pulse.Debug("what %v %v", bin, dir)
|
||||
return bin
|
||||
}
|
||||
if strings.HasPrefix(bin, ice.PS) {
|
||||
ice.Pulse.Debug("what %v %v", bin, dir)
|
||||
return bin
|
||||
}
|
||||
if strings.HasPrefix(bin, nfs.PWD) {
|
||||
ice.Pulse.Debug("what %v %v", bin, dir)
|
||||
return bin
|
||||
}
|
||||
if len(dir) == 0 {
|
||||
ice.Pulse.Debug("what %v %v", bin, dir)
|
||||
dir = append(dir, _path_split(kit.Env(PATH))...)
|
||||
}
|
||||
ice.Pulse.Debug("what %v %v", bin, dir)
|
||||
for _, p := range dir {
|
||||
if nfs.ExistsFile(m, path.Join(p, bin)) {
|
||||
return kit.Path(p, bin)
|
||||
@ -195,7 +201,7 @@ func SystemFind(m Message, bin string, dir ...string) string {
|
||||
if text := kit.ReadFile(ice.ETC_PATH); len(text) > 0 {
|
||||
dir = append(dir, strings.Split(text, ice.NL)...)
|
||||
}
|
||||
dir = append(dir, strings.Split(kit.Env(PATH), ice.DF)...)
|
||||
dir = append(dir, _path_split(kit.Env(PATH))...)
|
||||
return _system_find(m, bin, dir...)
|
||||
}
|
||||
func IsSuccess(m Message) bool { return m.Append(CODE) == "" || m.Append(CODE) == "0" }
|
||||
|
@ -60,7 +60,7 @@ func _dream_show(m *ice.Message, name string) {
|
||||
), cli.CMD_OUTPUT, path.Join(p, ice.VAR_LOG_BOOT_LOG))
|
||||
defer m.Options(cli.CMD_DIR, "", cli.CMD_ENV, "", cli.CMD_OUTPUT, "")
|
||||
gdb.Event(m, DREAM_CREATE, m.OptionSimple(mdb.NAME, mdb.TYPE))
|
||||
m.Cmd(cli.DAEMON, kit.Select(os.Args[0], cli.SystemFind(m, ice.ICE_BIN, nfs.PWD+path.Join(p, ice.BIN), nfs.PWD+ice.BIN)),
|
||||
m.Cmd(cli.DAEMON, kit.Select(kit.Path(os.Args[0]), cli.SystemFind(m, ice.ICE_BIN, nfs.PWD+path.Join(p, ice.BIN), nfs.PWD+ice.BIN)),
|
||||
SPACE, tcp.DIAL, ice.DEV, ice.OPS, mdb.TYPE, WORKER, m.OptionSimple(mdb.NAME, RIVER), cli.DAEMON, ice.OPS)
|
||||
}
|
||||
func _dream_template(m *ice.Message, p string) {
|
||||
@ -107,10 +107,12 @@ func init() {
|
||||
switch arg[0] {
|
||||
case mdb.NAME, nfs.TEMPLATE:
|
||||
_dream_list(m).Cut("name,status,time")
|
||||
case "repos":
|
||||
m.Cmdy(SPIDE, ice.OPS, SPIDE_MSG, "/x/list")
|
||||
m.Cmdy(SPIDE, ice.DEV, SPIDE_MSG, "/x/list")
|
||||
m.Cmdy(SPIDE, ice.SHY, SPIDE_MSG, "/x/list")
|
||||
case nfs.REPOS:
|
||||
for _, dev := range []string{ice.OPS, ice.DEV, ice.SHY} {
|
||||
if msg := m.Cmd(SPIDE, dev, SPIDE_MSG, "/x/list"); !msg.IsErr() {
|
||||
m.Copy(msg)
|
||||
}
|
||||
}
|
||||
default:
|
||||
gdb.Event(m, "", arg)
|
||||
}
|
||||
|
@ -206,7 +206,7 @@ func init() {
|
||||
aaa.SessAuth(m, kit.Dict(aaa.USERNAME, m.Option(ice.MSG_USERNAME), aaa.USERNICK, m.Option(ice.MSG_USERNICK), aaa.USERROLE, m.Option(ice.MSG_USERROLE)))
|
||||
}},
|
||||
aaa.LOGIN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(SPACE, arg[0], ice.MSG_SESSID, aaa.SessCreate(m, m.Option(ice.MSG_USERNAME)))
|
||||
m.Cmd(SPACE, kit.Select(m.Option(mdb.NAME), arg, 0), ice.MSG_SESSID, aaa.SessCreate(m, m.Option(ice.MSG_USERNAME)))
|
||||
}},
|
||||
DOMAIN: {Hand: func(m *ice.Message, arg ...string) { m.Echo(_space_domain(m)) }},
|
||||
OPEN: {Hand: func(m *ice.Message, arg ...string) {
|
||||
@ -224,6 +224,14 @@ func init() {
|
||||
), mdb.ClearHashOnExitAction(), SpaceAction(), aaa.WhiteAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) < 2 {
|
||||
mdb.HashSelect(m, arg...).Sort("type,name,text")
|
||||
m.Tables(func(values ice.Maps) {
|
||||
switch values[mdb.TYPE] {
|
||||
case aaa.LOGIN:
|
||||
m.PushButton(aaa.LOGIN, mdb.REMOVE)
|
||||
default:
|
||||
m.PushButton(cli.OPEN, mdb.REMOVE)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
_space_send(m, strings.ToLower(arg[0]), kit.Simple(kit.Split(arg[1]), arg[2:])...)
|
||||
}
|
||||
|
@ -214,10 +214,12 @@ func init() {
|
||||
}},
|
||||
PULL: {Help: "下载", Hand: func(m *ice.Message, arg ...string) {
|
||||
_status_each(m, PULL, cli.SYSTEM, GIT, PULL)
|
||||
_status_each(m, PULL, cli.SYSTEM, GIT, PULL, "--tags")
|
||||
}},
|
||||
PUSH: {Help: "上传", Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Option(REPOS) == "" {
|
||||
_status_each(m, PUSH, cli.SYSTEM, GIT, PUSH)
|
||||
_status_each(m, PUSH, cli.SYSTEM, GIT, PUSH, "--tags")
|
||||
return
|
||||
}
|
||||
m.Option(cli.CMD_DIR, _repos_path(m.Option(REPOS)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user