diff --git a/base/cli/system.go b/base/cli/system.go index a072c5ec..1356c2be 100644 --- a/base/cli/system.go +++ b/base/cli/system.go @@ -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...)) diff --git a/core/code/install.go b/core/code/install.go index d56273fb..6bb1143e 100644 --- a/core/code/install.go +++ b/core/code/install.go @@ -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)) diff --git a/data.go b/data.go index 5352b0da..e28d90ec 100644 --- a/data.go +++ b/data.go @@ -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])