From b980d48390ab920fa79b646d6e8872326fde0264 Mon Sep 17 00:00:00 2001 From: shy Date: Sat, 20 Apr 2024 22:42:58 +0800 Subject: [PATCH] add some --- base/web/space.go | 8 +++++++- base/web/toast.go | 3 +-- misc/git/repos.go | 12 ++++++++---- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/base/web/space.go b/base/web/space.go index 77448358..0d8c9d01 100644 --- a/base/web/space.go +++ b/base/web/space.go @@ -296,7 +296,13 @@ const SPACE = "space" func init() { Index.MergeCommands(ice.Commands{ "m": {Help: "模块", Actions: ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) { m.Cmdy(nfs.REQUIRE_MODULES, arg) }}, - "p": {Help: "资源", Actions: ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) { ShareLocalFile(m, arg...) }}, + "p": {Help: "资源", Actions: ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) { + if kit.IsIn(arg[0], ice.SRC, ice.USR) { + ShareLocalFile(m, arg...) + } else { + m.Cmdy(PP(ice.REQUIRE), arg) + } + }}, "s": {Help: "空间", Actions: ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) { m.Cmdy(CHAT_POD, arg) }}, "c": {Help: "命令", Actions: ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) { m.Cmdy(CHAT_CMD, arg) }}, SPACE: {Name: "space name cmds auto", Help: "空间站", Actions: ice.MergeActions(ice.Actions{ diff --git a/base/web/toast.go b/base/web/toast.go index 164d84d3..9a85bf39 100644 --- a/base/web/toast.go +++ b/base/web/toast.go @@ -12,7 +12,6 @@ import ( "shylinux.com/x/icebergs/base/nfs" "shylinux.com/x/icebergs/base/web/html" kit "shylinux.com/x/toolkits" - "shylinux.com/x/toolkits/logs" ) const ( @@ -122,7 +121,7 @@ func Toast(m *ice.Message, text string, arg ...ice.Any) *ice.Message { // [title kit.If(len(arg) == 0, func() { arg = append(arg, "") }) kit.If(len(arg) > 0 && arg[0] == "", func() { arg[0] = toastTitle(m) }) if m.IsDebug() { - arg[0] = kit.Format(arg[0]) + "\t" + logs.FileLine(-1, "2") + arg[0] = kit.Format(arg[0]) + "\t" + kit.FileLine(-1, 3) } PushNoticeToast(m, text, arg) return m diff --git a/misc/git/repos.go b/misc/git/repos.go index 45989399..2fb70e67 100644 --- a/misc/git/repos.go +++ b/misc/git/repos.go @@ -424,16 +424,20 @@ func init() { Index.MergeCommands(ice.Commands{ REPOS: {Name: "repos repos branch:text commit:text file:text auto", Help: "代码库", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{ ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { - _repos_insert(m, kit.Path("")) - m.Cmd(nfs.DIR, nfs.USR, func(value ice.Maps) { _repos_insert(m, value[nfs.PATH]) }) - m.Cmd(nfs.DIR, nfs.USR_LOCAL_WORK, func(value ice.Maps) { _repos_insert(m, value[nfs.PATH]) }) m.Cmd(CONFIGS, func(value ice.Maps) { if strings.HasSuffix(value[mdb.NAME], _INSTEADOF) && strings.HasPrefix(ice.Info.Make.Remote, value[mdb.VALUE]) { mdb.Config(m, INSTEADOF, strings.TrimPrefix(strings.TrimSuffix(value[mdb.NAME], _INSTEADOF), "url.")) } }) + m.Cmd("", nfs.SCAN) m.Go(func() { m.Cmd(web.DREAM, nfs.SCAN) }) }}, + nfs.SCAN: {Hand: func(m *ice.Message, arg ...string) { + _repos_insert(m, kit.Path("")) + m.Cmd(nfs.DIR, nfs.USR, func(value ice.Maps) { _repos_insert(m, value[nfs.PATH]) }) + m.Cmd(nfs.DIR, nfs.USR_LOCAL_WORK, func(value ice.Maps) { _repos_insert(m, value[nfs.PATH]) }) + m.ProcessRefresh().ToastSuccess() + }}, INIT: {Name: "init remote*", Help: "初始化", Hand: func(m *ice.Message, arg ...string) { m.OptionDefault(nfs.PATH, kit.Path("")) m.Cmd(nfs.DEFS, path.Join(m.Option(nfs.PATH), ".git/config"), kit.Format(nfs.Template(m, CONFIG), m.Option(REMOTE))) @@ -661,7 +665,7 @@ func init() { } else { m.PushButton(STATUS, mdb.REMOVE) } - }).Action(CLONE, PULL, PUSH, STATUS).Sort(REPOS) + }).Action(CLONE, PULL, PUSH, STATUS, nfs.SCAN).Sort(REPOS) } else if repos := _repos_open(m, arg[0]); len(arg) == 1 { _repos_branch(m, repos) } else if len(arg) == 2 {