From 8a27ce7d66e6a670d1614af81aa2d24e3203d172 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 18 Feb 2025 11:18:22 +0800 Subject: [PATCH] add some --- base/nfs/dir.go | 1 + base/web/space.go | 2 +- conf.go | 18 +++++++++--------- core/code/compile.go | 2 +- core/code/publish.go | 9 +++++---- misc/git/service.go | 2 +- misc/git/status.go | 2 +- 7 files changed, 19 insertions(+), 17 deletions(-) diff --git a/base/nfs/dir.go b/base/nfs/dir.go index a5d098ab..d59226e8 100644 --- a/base/nfs/dir.go +++ b/base/nfs/dir.go @@ -193,6 +193,7 @@ const ( SHARE_LOCAL = "/share/local/" PATHNAME = "pathname" FILENAME = "filename" + CONTEXTS = "contexts" TYPE_ALL = "all" TYPE_BIN = "bin" diff --git a/base/web/space.go b/base/web/space.go index a9c4b25d..5e6992d7 100644 --- a/base/web/space.go +++ b/base/web/space.go @@ -462,7 +462,7 @@ func init() { m.Cmdy(arg[1:]) return } - if kit.IsIn(arg[0], "", ice.CONTEXTS, ice.Info.NodeName) { + if kit.IsIn(arg[0], "", ice.Info.NodeName) { m.Cmdy(arg[1:]) return } diff --git a/conf.go b/conf.go index 316900e9..8e712b8e 100644 --- a/conf.go +++ b/conf.go @@ -62,15 +62,15 @@ const ( ) const ( // REPOS CONTEXTOS = "ContextOS" - CONTEXTS = "contexts" - INTSHELL = "intshell" - LEARNING = "learning" - VOLCANOS = "volcanos" - TOOLKITS = "toolkits" - ICEBERGS = "icebergs" - RELEASE = "release" - MATRIX = "matrix" - ICONS = "icons" + // CONTEXTS = "contexts" + INTSHELL = "intshell" + LEARNING = "learning" + VOLCANOS = "volcanos" + TOOLKITS = "toolkits" + ICEBERGS = "icebergs" + RELEASE = "release" + MATRIX = "matrix" + ICONS = "icons" INSTALL = "install" REQUIRE = "require" diff --git a/core/code/compile.go b/core/code/compile.go index c939aeac..086848d7 100644 --- a/core/code/compile.go +++ b/core/code/compile.go @@ -129,7 +129,7 @@ func init() { m.Logs(nfs.SAVE, nfs.TARGET, file, nfs.SOURCE, main) m.Cmdy(nfs.DIR, file, "time,path,size,hash,link") web.MessageInsertJSON(m, cli.SYSTEM, "", m.Spawn().Copy(m).FormatMeta(), ctx.ARGS, m.Append(mdb.HASH)) - kit.If(!m.IsCliUA() && strings.Contains(file, ice.ICE), func() { m.Cmdy(PUBLISH, ice.CONTEXTS, ice.APP) }) + kit.If(!m.IsCliUA() && strings.Contains(file, ice.ICE), func() { m.Cmdy(PUBLISH, nfs.CONTEXTS, ice.APP) }) web.Count(m, "", file) } }}, diff --git a/core/code/publish.go b/core/code/publish.go index a24dede8..a498e8a3 100644 --- a/core/code/publish.go +++ b/core/code/publish.go @@ -67,11 +67,12 @@ func _publish_contexts(m *ice.Message, arg ...string) { } if m.Option(ice.MSG_USERPOD) != "" { env = append(env, cli.CTX_POD, m.Option(ice.MSG_USERPOD)) - } else if name := msg.Append(nfs.PATHNAME); !kit.IsIn(name, path.Base(m.Option(nfs.SOURCE)), ice.CONTEXTS) { + } else if name := msg.Append(nfs.PATHNAME); !kit.IsIn(name, path.Base(m.Option(nfs.SOURCE))) { env = append(env, cli.CTX_NAME, name) } case cli.CURL, cli.WGET: } + env = append(env, kit.Simple(m.Optionv(cli.CTX_ENV))...) kit.If(len(env) > 0, func() { m.Options(cli.CTX_ENV, lex.SP+kit.JoinKV(mdb.EQ, lex.SP, env...)) }) if template := strings.TrimSpace(nfs.Template(m, kit.Keys(k, SH))); m.Option(nfs.FORMAT) == "raw" { m.Echo(template) @@ -93,9 +94,9 @@ func init() { Index.MergeCommands(ice.Commands{ PUBLISH: {Name: "publish path auto create volcanos icebergs intshell", Help: "发布", Icon: "QuickTime Player.png", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{ ice.VOLCANOS: {Help: "火山架", Hand: func(m *ice.Message, arg ...string) { _publish_list(m, kit.ExtReg(HTML, CSS, JS)) }}, - ice.ICEBERGS: {Help: "冰山架", Hand: func(m *ice.Message, arg ...string) { _publish_bin_list(m).Cmdy("", ice.CONTEXTS) }}, + ice.ICEBERGS: {Help: "冰山架", Hand: func(m *ice.Message, arg ...string) { _publish_bin_list(m).Cmdy("", nfs.CONTEXTS) }}, ice.INTSHELL: {Help: "神农架", Hand: func(m *ice.Message, arg ...string) { _publish_list(m, kit.ExtReg(SH, VIM, CONF)) }}, - ice.CONTEXTS: {Hand: func(m *ice.Message, arg ...string) { _publish_contexts(m, arg...) }}, + nfs.CONTEXTS: {Hand: func(m *ice.Message, arg ...string) { _publish_contexts(m, arg...) }}, nfs.SOURCE: {Hand: func(m *ice.Message, arg ...string) { _publish_contexts(m, nfs.SOURCE) }}, nfs.BINARY: {Hand: func(m *ice.Message, arg ...string) { _publish_contexts(m, nfs.BINARY) }}, cli.CURL: {Hand: func(m *ice.Message, arg ...string) { _publish_contexts(m, cli.CURL) }}, @@ -131,7 +132,7 @@ func init() { nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) { nfs.Trash(m, path.Join(ice.USR_PUBLISH, m.Option(nfs.PATH))) }}, }, ctx.ConfAction(mdb.FIELD, nfs.PATH)), Hand: func(m *ice.Message, arg ...string) { if m.Option(nfs.DIR_ROOT, ice.USR_PUBLISH); len(arg) == 0 { - _publish_list(m).Cmdy("", ice.CONTEXTS, ice.APP) + _publish_list(m).Cmdy("", nfs.CONTEXTS, ice.APP) } else { m.Cmdy(nfs.DIR, arg[0], "time,path,size,hash,link,action", ice.OptionFields(mdb.DETAIL)) web.PushImages(m, web.P(PUBLISH, arg[0])) diff --git a/misc/git/service.go b/misc/git/service.go index b3a26539..598540fb 100644 --- a/misc/git/service.go +++ b/misc/git/service.go @@ -202,7 +202,7 @@ func init() { m.Push(nfs.SIZE, kit.Split(m.Cmdx(cli.SYSTEM, "du", "-sh", path.Join(ice.USR_LOCAL_REPOS, value[REPOS])))[0]) m.PushScript(kit.Format("git clone %s", _service_link(m, value[REPOS]))) }).Sort(REPOS) - kit.If(!m.IsCliUA(), func() { m.Cmdy(web.CODE_PUBLISH, ice.CONTEXTS, ice.DEV) }) + kit.If(!m.IsCliUA(), func() { m.Cmdy(web.CODE_PUBLISH, nfs.CONTEXTS, ice.DEV) }) kit.If(mdb.Config(m, aaa.AUTH) == aaa.PRIVATE, func() { m.StatusTimeCount(aaa.AUTH, aaa.PRIVATE) }) m.PushAction("settoken", mdb.REMOVE).Action(mdb.CREATE, aaa.AUTH) } else if repos := _repos_open(m, arg[0]); len(arg) == 1 { diff --git a/misc/git/status.go b/misc/git/status.go index eb86370a..2a415331 100644 --- a/misc/git/status.go +++ b/misc/git/status.go @@ -93,7 +93,7 @@ func init() { } else { m.Action(PULL, PUSH, INSTEADOF, mdb.DEV_REQUEST, ctx.CONFIG, STASH) } - kit.If(!m.IsCliUA(), func() { m.Cmdy(code.PUBLISH, ice.CONTEXTS, ice.DEV) }) + kit.If(!m.IsCliUA(), func() { m.Cmdy(code.PUBLISH, nfs.CONTEXTS, ice.DEV) }) ctx.Toolkit(m) } else { _repos_cmd(m, arg[0], DIFF)