1
0
forked from x/icebergs
This commit is contained in:
harveyshao 2022-05-26 14:29:05 +08:00
parent 02050077f3
commit 6f15537dde
3 changed files with 12 additions and 1 deletions

View File

@ -163,7 +163,7 @@ func init() {
if len(arg) == 1 {
arg = kit.Split(arg[0])
}
if kit.Ext(arg[0]) == nfs.SH && arg[0] != nfs.SH {
if kit.Ext(arg[0]) == nfs.SH && arg[0] != nfs.SH && kit.FileExists(path.Join(ice.SRC, arg[0])) {
arg = []string{nfs.SH, path.Join(ice.SRC, arg[0])}
}
_system_exec(m, _system_cmd(m, arg...))

View File

@ -123,6 +123,9 @@ func _install_service(m *ice.Message, arg ...string) {
})
m.Set(tcp.PORT).Tables(func(value map[string]string) { m.Push(tcp.PORT, path.Base(value[nfs.DIR])) })
}
func _install_stop(m *ice.Message, arg ...string) {
m.Cmd(cli.SYSTEM, "kill", m.Option("pid"))
}
const (
PREPARE = "prepare"
@ -156,6 +159,9 @@ func init() {
cli.START: {Name: "start link cmd", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
_install_start(m, arg...)
}},
cli.STOP: {Name: "stop", Help: "停止", Hand: func(m *ice.Message, arg ...string) {
_install_stop(m, arg...)
}},
nfs.SOURCE: {Name: "source link path", Help: "源码", Hand: func(m *ice.Message, arg ...string) {
m.Option(nfs.DIR_ROOT, path.Join(m.Config(nfs.PATH), kit.TrimExt(m.Option(mdb.LINK)), "_install"))
defer m.StatusTime(nfs.PATH, m.Option(nfs.DIR_ROOT))

View File

@ -20,6 +20,11 @@ func (m *Message) PrefixKey(arg ...string) string {
func (m *Message) Prefix(arg ...string) string {
return kit.Keys(m.Cap(CTX_FOLLOW), arg)
}
func (m *Message) ConfigSet(keys string, arg ...string) {
for i, k := range kit.Split(keys) {
m.Config(k, kit.Select("", arg, i))
}
}
func (m *Message) Config(key string, arg ...interface{}) string {
if len(arg) > 0 {
m.Conf(m.PrefixKey(), kit.Keym(key), arg[0])