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())
|
return kit.Select("1", "0", cmd.ProcessState != nil && cmd.ProcessState.Success())
|
||||||
}
|
}
|
||||||
func _system_find(m Message, bin string, dir ...string) string {
|
func _system_find(m Message, bin string, dir ...string) string {
|
||||||
|
ice.Pulse.Debug("what %v %v", bin, dir)
|
||||||
if strings.Contains(bin, ice.DF) {
|
if strings.Contains(bin, ice.DF) {
|
||||||
|
ice.Pulse.Debug("what %v %v", bin, dir)
|
||||||
return bin
|
return bin
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(bin, ice.PS) {
|
if strings.HasPrefix(bin, ice.PS) {
|
||||||
|
ice.Pulse.Debug("what %v %v", bin, dir)
|
||||||
return bin
|
return bin
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(bin, nfs.PWD) {
|
if strings.HasPrefix(bin, nfs.PWD) {
|
||||||
|
ice.Pulse.Debug("what %v %v", bin, dir)
|
||||||
return bin
|
return bin
|
||||||
}
|
}
|
||||||
if len(dir) == 0 {
|
if len(dir) == 0 {
|
||||||
|
ice.Pulse.Debug("what %v %v", bin, dir)
|
||||||
dir = append(dir, _path_split(kit.Env(PATH))...)
|
dir = append(dir, _path_split(kit.Env(PATH))...)
|
||||||
}
|
}
|
||||||
|
ice.Pulse.Debug("what %v %v", bin, dir)
|
||||||
for _, p := range dir {
|
for _, p := range dir {
|
||||||
if nfs.ExistsFile(m, path.Join(p, bin)) {
|
if nfs.ExistsFile(m, path.Join(p, bin)) {
|
||||||
return kit.Path(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 {
|
if text := kit.ReadFile(ice.ETC_PATH); len(text) > 0 {
|
||||||
dir = append(dir, strings.Split(text, ice.NL)...)
|
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...)
|
return _system_find(m, bin, dir...)
|
||||||
}
|
}
|
||||||
func IsSuccess(m Message) bool { return m.Append(CODE) == "" || m.Append(CODE) == "0" }
|
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))
|
), cli.CMD_OUTPUT, path.Join(p, ice.VAR_LOG_BOOT_LOG))
|
||||||
defer m.Options(cli.CMD_DIR, "", cli.CMD_ENV, "", cli.CMD_OUTPUT, "")
|
defer m.Options(cli.CMD_DIR, "", cli.CMD_ENV, "", cli.CMD_OUTPUT, "")
|
||||||
gdb.Event(m, DREAM_CREATE, m.OptionSimple(mdb.NAME, mdb.TYPE))
|
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)
|
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) {
|
func _dream_template(m *ice.Message, p string) {
|
||||||
@ -107,10 +107,12 @@ func init() {
|
|||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case mdb.NAME, nfs.TEMPLATE:
|
case mdb.NAME, nfs.TEMPLATE:
|
||||||
_dream_list(m).Cut("name,status,time")
|
_dream_list(m).Cut("name,status,time")
|
||||||
case "repos":
|
case nfs.REPOS:
|
||||||
m.Cmdy(SPIDE, ice.OPS, SPIDE_MSG, "/x/list")
|
for _, dev := range []string{ice.OPS, ice.DEV, ice.SHY} {
|
||||||
m.Cmdy(SPIDE, ice.DEV, SPIDE_MSG, "/x/list")
|
if msg := m.Cmd(SPIDE, dev, SPIDE_MSG, "/x/list"); !msg.IsErr() {
|
||||||
m.Cmdy(SPIDE, ice.SHY, SPIDE_MSG, "/x/list")
|
m.Copy(msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
gdb.Event(m, "", arg)
|
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.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) {
|
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)) }},
|
DOMAIN: {Hand: func(m *ice.Message, arg ...string) { m.Echo(_space_domain(m)) }},
|
||||||
OPEN: {Hand: func(m *ice.Message, arg ...string) {
|
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) {
|
), mdb.ClearHashOnExitAction(), SpaceAction(), aaa.WhiteAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) < 2 {
|
if len(arg) < 2 {
|
||||||
mdb.HashSelect(m, arg...).Sort("type,name,text")
|
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 {
|
} else {
|
||||||
_space_send(m, strings.ToLower(arg[0]), kit.Simple(kit.Split(arg[1]), arg[2:])...)
|
_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) {
|
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)
|
||||||
|
_status_each(m, PULL, cli.SYSTEM, GIT, PULL, "--tags")
|
||||||
}},
|
}},
|
||||||
PUSH: {Help: "上传", Hand: func(m *ice.Message, arg ...string) {
|
PUSH: {Help: "上传", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Option(REPOS) == "" {
|
if m.Option(REPOS) == "" {
|
||||||
_status_each(m, PUSH, cli.SYSTEM, GIT, PUSH)
|
_status_each(m, PUSH, cli.SYSTEM, GIT, PUSH)
|
||||||
|
_status_each(m, PUSH, cli.SYSTEM, GIT, PUSH, "--tags")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
m.Option(cli.CMD_DIR, _repos_path(m.Option(REPOS)))
|
m.Option(cli.CMD_DIR, _repos_path(m.Option(REPOS)))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user