diff --git a/base/cli/output.go b/base/cli/output.go index af28c385..578af0a2 100644 --- a/base/cli/output.go +++ b/base/cli/output.go @@ -10,6 +10,27 @@ import ( 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() { Index.Merge(&ice.Context{ Configs: map[string]*ice.Config{ diff --git a/core/code/inner.go b/core/code/inner.go index ffbff8b9..a3ec61d5 100644 --- a/core/code/inner.go +++ b/core/code/inner.go @@ -102,6 +102,7 @@ func init() { Configs: map[string]*ice.Config{ INNER: {Name: "inner", Help: "源代码", Value: kit.Data( "source", kit.Dict( + "s", "true", "S", "true", "license", "true", "makefile", "true", "shy", "true", "py", "true", "csv", "true", "json", "true", @@ -112,6 +113,17 @@ func init() { "md", "true", "conf", "true", "toml", "true", ), "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( PREFIX, kit.Dict("#", COMMENT), SUFFIX, kit.Dict(":", COMMENT), diff --git a/core/code/install.go b/core/code/install.go index 4b5750e9..4433efd1 100644 --- a/core/code/install.go +++ b/core/code/install.go @@ -69,30 +69,16 @@ func init() { }) }}, gdb.BUILD: {Name: "build link", Help: "构建", Hand: func(m *ice.Message, arg ...string) { - m.Option(ice.MSG_PROCESS, "_follow") - 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) - } + if cli.Follow(m) { 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() { defer m.Cmdy(cli.OUTPUT, mdb.MODIFY, kit.MDB_STATUS, cli.Status.Stop) 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)))) - 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) { case func(string): 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.Cmdy(nfs.DIR, kit.Select("./", arg, 2)) + if strings.HasSuffix(kit.Select("./", arg, 2), "/") { + m.Cmdy(nfs.DIR, kit.Select("./", arg, 2)) + } else { + m.Cmdy(nfs.CAT, kit.Select("./", arg, 2)) + } }}, }, }, nil)