mirror of
https://shylinux.com/x/icebergs
synced 2025-04-28 18:22:02 +08:00
add cli.Follow
This commit is contained in:
parent
b5d8af9a98
commit
750ca5e19c
@ -10,6 +10,27 @@ import (
|
|||||||
|
|
||||||
const OUTPUT = "output"
|
const OUTPUT = "output"
|
||||||
|
|
||||||
|
func Follow(m *ice.Message) bool {
|
||||||
|
m.Option(ice.MSG_PROCESS, "_follow")
|
||||||
|
if m.Option("cache.action", "build"); m.Option("cache.hash") != "" {
|
||||||
|
m.Cmdy(OUTPUT, m.Option("cache.hash"))
|
||||||
|
m.Sort(kit.MDB_ID).Table(func(index int, value map[string]string, head []string) {
|
||||||
|
m.Option("cache.begin", value[kit.MDB_ID])
|
||||||
|
m.Echo(value[kit.SSH_RES])
|
||||||
|
})
|
||||||
|
|
||||||
|
if len(m.Resultv()) == 0 && m.Conf(OUTPUT, kit.Keys(kit.MDB_HASH, m.Option("cache.hash"), kit.MDB_META, kit.MDB_STATUS)) == STOP {
|
||||||
|
m.Echo(STOP)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
m.Cmdy(OUTPUT, mdb.CREATE, kit.MDB_NAME, m.Option(kit.MDB_LINK))
|
||||||
|
m.Option("cache.hash", m.Result())
|
||||||
|
m.Option("cache.begin", 1)
|
||||||
|
m.Set(ice.MSG_RESULT)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{
|
Index.Merge(&ice.Context{
|
||||||
Configs: map[string]*ice.Config{
|
Configs: map[string]*ice.Config{
|
||||||
|
@ -102,6 +102,7 @@ func init() {
|
|||||||
Configs: map[string]*ice.Config{
|
Configs: map[string]*ice.Config{
|
||||||
INNER: {Name: "inner", Help: "源代码", Value: kit.Data(
|
INNER: {Name: "inner", Help: "源代码", Value: kit.Data(
|
||||||
"source", kit.Dict(
|
"source", kit.Dict(
|
||||||
|
"s", "true", "S", "true",
|
||||||
"license", "true", "makefile", "true",
|
"license", "true", "makefile", "true",
|
||||||
"shy", "true", "py", "true",
|
"shy", "true", "py", "true",
|
||||||
"csv", "true", "json", "true",
|
"csv", "true", "json", "true",
|
||||||
@ -112,6 +113,17 @@ func init() {
|
|||||||
"md", "true", "conf", "true", "toml", "true",
|
"md", "true", "conf", "true", "toml", "true",
|
||||||
),
|
),
|
||||||
"plug", kit.Dict(
|
"plug", kit.Dict(
|
||||||
|
"s", kit.Dict(
|
||||||
|
PREFIX, kit.Dict("//", COMMENT),
|
||||||
|
KEYWORD, kit.Dict(
|
||||||
|
"TEXT", KEYWORD,
|
||||||
|
"RET", KEYWORD,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
"S", kit.Dict(
|
||||||
|
PREFIX, kit.Dict("//", COMMENT),
|
||||||
|
KEYWORD, kit.Dict(),
|
||||||
|
),
|
||||||
"makefile", kit.Dict(
|
"makefile", kit.Dict(
|
||||||
PREFIX, kit.Dict("#", COMMENT),
|
PREFIX, kit.Dict("#", COMMENT),
|
||||||
SUFFIX, kit.Dict(":", COMMENT),
|
SUFFIX, kit.Dict(":", COMMENT),
|
||||||
|
@ -69,30 +69,16 @@ func init() {
|
|||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
gdb.BUILD: {Name: "build link", Help: "构建", Hand: func(m *ice.Message, arg ...string) {
|
gdb.BUILD: {Name: "build link", Help: "构建", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Option(ice.MSG_PROCESS, "_follow")
|
if cli.Follow(m) {
|
||||||
if m.Option("cache.action", "build"); m.Option("cache.hash") != "" {
|
|
||||||
m.Cmdy(cli.OUTPUT, m.Option("cache.hash"))
|
|
||||||
m.Sort(kit.MDB_ID).Table(func(index int, value map[string]string, head []string) {
|
|
||||||
m.Option("cache.begin", value[kit.MDB_ID])
|
|
||||||
m.Echo(value[kit.SSH_RES])
|
|
||||||
})
|
|
||||||
|
|
||||||
if len(m.Resultv()) == 0 && m.Conf(cli.OUTPUT, kit.Keys(kit.MDB_HASH, m.Option("cache.hash"), kit.MDB_META, kit.MDB_STATUS)) == gdb.STOP {
|
|
||||||
m.Echo(gdb.STOP)
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
m.Cmdy(cli.OUTPUT, mdb.CREATE, kit.MDB_NAME, m.Option(kit.MDB_LINK))
|
|
||||||
m.Option("cache.hash", m.Result())
|
|
||||||
m.Option("cache.begin", 1)
|
|
||||||
m.Set(ice.MSG_RESULT)
|
|
||||||
|
|
||||||
m.Go(func() {
|
m.Go(func() {
|
||||||
defer m.Cmdy(cli.OUTPUT, mdb.MODIFY, kit.MDB_STATUS, cli.Status.Stop)
|
defer m.Cmdy(cli.OUTPUT, mdb.MODIFY, kit.MDB_STATUS, cli.Status.Stop)
|
||||||
defer m.Option(kit.MDB_HASH, m.Option("cache.hash"))
|
defer m.Option(kit.MDB_HASH, m.Option("cache.hash"))
|
||||||
|
|
||||||
p := m.Option(cli.CMD_DIR, path.Join(m.Conf(INSTALL, kit.META_PATH), kit.TrimExt(m.Option(kit.MDB_LINK))))
|
p := m.Option(cli.CMD_DIR, path.Join(m.Conf(INSTALL, kit.META_PATH), kit.TrimExt(m.Option(kit.MDB_LINK))))
|
||||||
pp := kit.Path(path.Join(p, kit.Select("_install", m.Option("install"))))
|
pp := kit.Path(path.Join(p, "_install"))
|
||||||
switch cb := m.Optionv("prepare").(type) {
|
switch cb := m.Optionv("prepare").(type) {
|
||||||
case func(string):
|
case func(string):
|
||||||
cb(p)
|
cb(p)
|
||||||
@ -156,7 +142,11 @@ func init() {
|
|||||||
|
|
||||||
// 目录列表
|
// 目录列表
|
||||||
m.Option(nfs.DIR_ROOT, path.Join(m.Conf(cli.DAEMON, kit.META_PATH), arg[1]))
|
m.Option(nfs.DIR_ROOT, path.Join(m.Conf(cli.DAEMON, kit.META_PATH), arg[1]))
|
||||||
|
if strings.HasSuffix(kit.Select("./", arg, 2), "/") {
|
||||||
m.Cmdy(nfs.DIR, kit.Select("./", arg, 2))
|
m.Cmdy(nfs.DIR, kit.Select("./", arg, 2))
|
||||||
|
} else {
|
||||||
|
m.Cmdy(nfs.CAT, kit.Select("./", arg, 2))
|
||||||
|
}
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user