diff --git a/base/nfs/dir.go b/base/nfs/dir.go index fa6d77df..a7313b81 100644 --- a/base/nfs/dir.go +++ b/base/nfs/dir.go @@ -136,13 +136,14 @@ func _dir_list(m *ice.Message, root string, dir string, level int, deep bool, di } const ( - PWD = "./" - SRC = "src/" - BIN = "bin/" - USR = "usr/" - USR_PORTAL = ice.USR_PORTAL - SRC_DOCUMENT = ice.SRC_DOCUMENT - REQUIRE = "/require/" + PWD = "./" + SRC = "src/" + BIN = "bin/" + USR = "usr/" + USR_PORTAL = ice.USR_PORTAL + USR_LOCAL_WORK = ice.USR_LOCAL_WORK + SRC_DOCUMENT = ice.SRC_DOCUMENT + REQUIRE = "/require/" TYPE_ALL = "all" TYPE_BIN = "bin" diff --git a/base/web/option.go b/base/web/option.go index b4c5cfe3..9d1b99e5 100644 --- a/base/web/option.go +++ b/base/web/option.go @@ -61,11 +61,11 @@ func ProcessIframe(m *ice.Message, name, link string, arg ...string) { }, arg...) } func PushPodCmd(m *ice.Message, cmd string, arg ...string) { - kit.If(m.Length() > 0 && len(m.Appendv(ice.POD)) == 0, func() { m.Table(func(value ice.Maps) { m.Push(ice.POD, m.Option(ice.MSG_USERPOD)) }) }) + kit.If(m.Length() > 0 && len(m.Appendv(SPACE)) == 0, func() { m.Table(func(value ice.Maps) { m.Push(SPACE, m.Option(ice.MSG_USERPOD)) }) }) m.Cmds(SPACE, func(value ice.Maps) { if kit.IsIn(value[mdb.TYPE], WORKER, SERVER) { m.Cmd(SPACE, value[mdb.NAME], kit.Select(m.PrefixKey(), cmd), arg).Table(func(index int, val ice.Maps, head []string) { - val[ice.POD] = kit.Keys(value[mdb.NAME], val[ice.POD]) + val[SPACE] = kit.Keys(value[mdb.NAME], val[SPACE]) m.Push("", val, head) }) } diff --git a/core/chat/macos/applications.go b/core/chat/macos/applications.go index 4a0e62ba..494a173a 100644 --- a/core/chat/macos/applications.go +++ b/core/chat/macos/applications.go @@ -51,7 +51,7 @@ func init() { m.Cmd(nfs.DIR, USR_ICONS, func(value ice.Maps) { m.Push(arg[0], value[nfs.PATH]) }) } }}, mdb.CREATE: {Name: "create space index args name icon"}, - }, CmdHashAction("space,index,args"))}, + }, PodCmdAction(), CmdHashAction("space,index,args"))}, }) } func install(m *ice.Message, cmd, name, index string, arg ...string) { diff --git a/core/chat/macos/desktop.go b/core/chat/macos/desktop.go index 93f43def..7c555b38 100644 --- a/core/chat/macos/desktop.go +++ b/core/chat/macos/desktop.go @@ -28,7 +28,7 @@ func init() { kit.Switch(m.Option(mdb.TYPE), kit.Simple(web.SERVER, web.WORKER), func() { m.PushButton(kit.Dict(m.CommandKey(), "桌面")) }) }}, web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, []string{}, arg...) }}, - }, aaa.RoleAction(ctx.COMMAND, ctx.RUN), CmdHashAction(), mdb.ImportantHashAction())}, + }, aaa.RoleAction(ctx.COMMAND, ctx.RUN), PodCmdAction(), CmdHashAction(), mdb.ImportantHashAction())}, }) } diff --git a/core/chat/macos/dock.go b/core/chat/macos/dock.go index a9f6326c..233ede10 100644 --- a/core/chat/macos/dock.go +++ b/core/chat/macos/dock.go @@ -20,7 +20,7 @@ func init() { } }}, ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { mdb.HashExport(m) }}, - }, aaa.RoleAction(), CmdHashAction(), mdb.ImportantHashAction())}}) + }, aaa.RoleAction(), PodCmdAction(), CmdHashAction(), mdb.ImportantHashAction())}}) } func DockAppend(m *ice.Message, name, index string, arg ...string) { diff --git a/core/chat/macos/macos.go b/core/chat/macos/macos.go index 97f54790..9fd8f3a8 100644 --- a/core/chat/macos/macos.go +++ b/core/chat/macos/macos.go @@ -5,6 +5,7 @@ import ( "shylinux.com/x/icebergs/base/ctx" "shylinux.com/x/icebergs/base/mdb" "shylinux.com/x/icebergs/base/nfs" + "shylinux.com/x/icebergs/base/web" "shylinux.com/x/icebergs/core/chat" kit "shylinux.com/x/toolkits" ) @@ -22,6 +23,24 @@ func init() { chat.Index.Register(Index, nil, DESKTOP, APPLICATIONS) } func Prefix(arg ...string) string { return chat.Prefix(MACOS, kit.Keys(arg)) } +func PodCmdAction(arg ...string) ice.Actions { + file := kit.FileLine(2, 100) + return ice.Actions{ + mdb.SELECT: {Name: "list hash auto create", Hand: func(m *ice.Message, arg ...string) { + msg := m.Spawn() + mdb.HashSelect(msg, arg...).Sort(mdb.NAME) + web.PushPodCmd(msg, m.PrefixKey(), arg...) + has := map[string]bool{} + msg.Table(func(index int, value ice.Maps, head []string) { + if !has[value[ctx.INDEX]] { + m.Push("", value, head) + has[value[ctx.INDEX]] = true + } + }) + m.Display(ctx.FileURI(file)) + }}, + } +} func CmdHashAction(arg ...string) ice.Actions { file := kit.FileLine(2, 100) return ice.MergeActions(ice.Actions{ diff --git a/core/team/plan.go b/core/team/plan.go index 6f69644f..92eb414c 100644 --- a/core/team/plan.go +++ b/core/team/plan.go @@ -32,7 +32,7 @@ func _plan_scope(m *ice.Message, arg ...string) (begin_time, end_time time.Time) return begin_time, end_time } func _plan_list(m *ice.Message, begin_time, end_time string) { - m.Options(mdb.CACHE_LIMIT, "-1").OptionFields("begin_time,close_time,zone,id,level,status,score,type,name,text,pod,extra") + m.Options(mdb.CACHE_LIMIT, "-1").OptionFields("begin_time,close_time,zone,id,level,status,score,type,name,text,extra") m.Cmd(mdb.SELECT, m.Prefix(TASK), "", mdb.ZONE, mdb.FOREACH, func(key string, fields []string, value, val ice.Map) { if begin_time <= kit.Format(value[BEGIN_TIME]) && kit.Format(value[BEGIN_TIME]) < end_time { m.Push(key, value, fields, val).PushButton(_task_action(m, value[STATUS], mdb.PLUGIN)) diff --git a/core/wiki/portal.css b/core/wiki/portal.css index 184ed02c..6ab9c6b7 100644 --- a/core/wiki/portal.css +++ b/core/wiki/portal.css @@ -20,8 +20,8 @@ body.dark fieldset.web.wiki.portal>div.output>div.header div.story[data-name=nav body.dark fieldset.web.wiki.portal>div.output>div.header div.story[data-name=navmenu] div.item:hover { background-color:var(--plugin-bg-color); } fieldset.web.wiki.portal.home>div.output>div.layout>div.main p { white-space:pre-wrap; text-align:center; } fieldset.web.wiki.portal>div.output>div.layout>div.main>* { margin:20px auto; } -fieldset.web.wiki.portal>div.output>div.layout>div.main h2 { margin-top:40px; } -fieldset.web.wiki.portal>div.output>div.layout>div.main h3 { margin-top:20px; } +// fieldset.web.wiki.portal>div.output>div.layout>div.main h2 { margin-top:40px; } +// fieldset.web.wiki.portal>div.output>div.layout>div.main h3 { margin-top:20px; } fieldset.web.wiki.portal>div.output>div.layout>div.main ul { margin:20px 40px; } fieldset.web.wiki.portal>div.output>div.layout>div.main ol { margin:20px 40px; } fieldset.web.wiki.portal>div.output>div.layout>div.main p code { @@ -29,6 +29,7 @@ fieldset.web.wiki.portal>div.output>div.layout>div.main p code { } fieldset.web.wiki.portal>div.output>div.layout>div.main div.story[data-type=spark][data-name=shell] { background-color:var(--code-bg-color); color:var(--code-fg-color); padding:10px; margin:10px auto; + box-shadow:var(--box-shadow); } fieldset.web.wiki.portal>div.output>div.layout>div.main div.story[data-type=spark][data-name=shell] kbd:hover { background-color:white; color:black; diff --git a/logs.go b/logs.go index 16f113ab..3f247d1c 100644 --- a/logs.go +++ b/logs.go @@ -200,9 +200,6 @@ func (m *Message) FormatChain() string { ms = append(ms, msg) } show := func(msg *Message, key string, arg ...string) string { - if _, ok := msg.data[key]; ok { - return kit.Format("%s%s:%s %v", kit.Select("", arg, 0), key, kit.Select("", arg, 1), msg.data[key]) - } if len(msg.meta[key]) == 0 || len(msg.meta[key]) == 1 && msg.meta[key][0] == "" { return "" } diff --git a/misc/chrome/spide.go b/misc/chrome/spide.go index 4328402d..43812c64 100644 --- a/misc/chrome/spide.go +++ b/misc/chrome/spide.go @@ -8,9 +8,13 @@ import ( type spide struct { cache + demo string `name:"demo" event:"serve.start"` list string `name:"list wid tid url auto insert" help:"节点"` } +func (s spide) Demo(m *ice.Message, arg ...string) { + m.Debug("what %v", arg) +} func (s spide) Download(m *ice.Message, arg ...string) { m.Cmdy(s.cache, s.Create, arg).ProcessHold() } diff --git a/misc/git/repos.go b/misc/git/repos.go index eddcea90..a06bcc2d 100644 --- a/misc/git/repos.go +++ b/misc/git/repos.go @@ -73,17 +73,17 @@ func _repos_insert(m *ice.Message, p string) { if head, err := repos.Head(); err == nil { args = append(args, BRANCH, head.Name().Short()) if commit, err := repos.CommitObject(head.Hash()); err == nil { - args = append(args, mdb.TIME, commit.Author.When.Format(ice.MOD_TIME), COMMENT, commit.Message) + args = append(args, mdb.TIME, commit.Author.When.Format(ice.MOD_TIME), COMMENT, strings.TrimSuffix(commit.Message, lex.NL)) } } if refer := _repos_recent(m, repos); refer != nil { if n := _repos_forword(m, repos, refer.Hash().String()); n > 0 { - args = append(args, VERSION, kit.Format("%s-%d", refer.Name().Short(), n)) + args = append(args, VERSION, kit.Format("%s-%d-%s", refer.Name().Short(), n, kit.Cut(refer.Hash().String(), 6))) } else { args = append(args, VERSION, refer.Name().Short()) } } - if remote, err := repos.Remote("origin"); err == nil { + if remote, err := repos.Remote(ORIGIN); err == nil { args = append(args, ORIGIN, remote.Config().URLs[0]) } else if remote, err := repos.Remotes(); err == nil && len(remote) > 0 { args = append(args, ORIGIN, remote[0].Config().URLs[0]) @@ -95,7 +95,13 @@ func _repos_path(m *ice.Message, p string, arg ...string) string { if p == path.Base(kit.Path("")) { return kit.Path("", arg...) } - return path.Join(nfs.USR, p, path.Join(arg...)) + if nfs.Exists(m, path.Join(nfs.USR, p, ".git")) { + return path.Join(nfs.USR, p, path.Join(arg...)) + } + if nfs.Exists(m, path.Join(nfs.USR_LOCAL_WORK, p, ".git")) { + return path.Join(nfs.USR_LOCAL_WORK, p, path.Join(arg...)) + } + return p } func _repos_open(m *ice.Message, p string) *git.Repository { return mdb.HashSelectTarget(m, p, nil).(*git.Repository) @@ -141,7 +147,7 @@ func _repos_each_origin(m *ice.Message, title string, cb func(*git.Repository, s _repos_each(m, "", func(repos *git.Repository, value ice.Maps) error { if value[ORIGIN] == "" { return nil - } else if remote, err := repos.Remote("origin"); err != nil { + } else if remote, err := repos.Remote(ORIGIN); err != nil { return err } else { remoteURL := remote.Config().URLs[0] @@ -439,6 +445,7 @@ func init() { Index.MergeCommands(ice.Commands{ REPOS: {Name: "repos repos branch:text commit:text file:text auto", Help: "代码库", Actions: ice.MergeActions(ice.Actions{ ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { + m.Cmd(nfs.DIR, nfs.USR_LOCAL_WORK, func(value ice.Maps) { _repos_insert(m, value[nfs.PATH]) }) m.Cmd(nfs.DIR, nfs.USR, func(value ice.Maps) { _repos_insert(m, value[nfs.PATH]) }) _repos_insert(m, kit.Path("")) m.Cmd(CONFIGS, func(value ice.Maps) { @@ -466,7 +473,7 @@ func init() { } }}, INIT: {Name: "clone origin* branch name path", Hand: func(m *ice.Message, arg ...string) { - m.Cmd(nfs.DEFS, kit.Path(".git/config"), nfs.Template(m, "config", m.Option("origin"))) + m.Cmd(nfs.DEFS, kit.Path(".git/config"), nfs.Template(m, "config", m.Option(ORIGIN))) git.PlainInit(m.Option(nfs.PATH), false) _repos_insert(m, kit.Path("")) }}, @@ -481,7 +488,7 @@ func init() { }}, PUSH: {Help: "上传", Hand: func(m *ice.Message, arg ...string) { _repos_each_origin(m, "", func(repos *git.Repository, remoteURL string, auth *http.BasicAuth, value ice.Maps) error { - m.Cmd(cli.SYSTEM, "git", "push", "--tags", kit.Dict(cli.CMD_DIR, path.Join(ice.USR_LOCAL_REPOS, value[REPOS]))) + m.Cmd(cli.SYSTEM, GIT, PUSH, "--tags", kit.Dict(cli.CMD_DIR, path.Join(ice.USR_LOCAL_REPOS, value[REPOS]))) return repos.Push(&git.PushOptions{RemoteURL: remoteURL, Auth: auth, FollowTags: true}) }) }}, @@ -528,7 +535,7 @@ func init() { if repos := kit.Select(m.Option(REPOS), arg, 0); repos != "" { _repos_status(m, repos, _repos_open(m, repos)) } else { - last, remote, password, list := "", "", "", _repos_credentials(m) + last, password, list := "", "", _repos_credentials(m) _repos_each(m, "", func(repos *git.Repository, value ice.Maps) error { if refer, err := repos.Head(); err == nil { if commit, err := repos.CommitObject(refer.Hash()); err == nil { @@ -536,11 +543,9 @@ func init() { kit.If(_last > last, func() { last = _last }) } } - if _remote, err := repos.Remote(ORIGIN); err == nil && (remote == "" || remote == path.Base(kit.Path(""))) { - remote = kit.Select(remote, kit.Select("", _remote.Config().URLs, 0)) - } return _repos_status(m, value[REPOS], repos) }) + remote := ice.Info.Make.Remote if insteadof := mdb.Config(m, INSTEADOF); insteadof != "" { remote = insteadof + path.Base(remote) }