1
0
forked from x/icebergs
This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-04-20 22:42:58 +08:00
parent cfec29c68d
commit b980d48390
3 changed files with 16 additions and 7 deletions

View File

@ -296,7 +296,13 @@ const SPACE = "space"
func init() { func init() {
Index.MergeCommands(ice.Commands{ Index.MergeCommands(ice.Commands{
"m": {Help: "模块", Actions: ApiWhiteAction(), Hand: func(m *ice.Message, arg ...string) { m.Cmdy(nfs.REQUIRE_MODULES, arg) }}, "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) }}, "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) }}, "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{ SPACE: {Name: "space name cmds auto", Help: "空间站", Actions: ice.MergeActions(ice.Actions{

View File

@ -12,7 +12,6 @@ import (
"shylinux.com/x/icebergs/base/nfs" "shylinux.com/x/icebergs/base/nfs"
"shylinux.com/x/icebergs/base/web/html" "shylinux.com/x/icebergs/base/web/html"
kit "shylinux.com/x/toolkits" kit "shylinux.com/x/toolkits"
"shylinux.com/x/toolkits/logs"
) )
const ( 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, func() { arg = append(arg, "") })
kit.If(len(arg) > 0 && arg[0] == "", func() { arg[0] = toastTitle(m) }) kit.If(len(arg) > 0 && arg[0] == "", func() { arg[0] = toastTitle(m) })
if m.IsDebug() { 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) PushNoticeToast(m, text, arg)
return m return m

View File

@ -424,16 +424,20 @@ func init() {
Index.MergeCommands(ice.Commands{ Index.MergeCommands(ice.Commands{
REPOS: {Name: "repos repos branch:text commit:text file:text auto", Help: "代码库", Role: aaa.VOID, Actions: ice.MergeActions(ice.Actions{ 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) { 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) { m.Cmd(CONFIGS, func(value ice.Maps) {
if strings.HasSuffix(value[mdb.NAME], _INSTEADOF) && strings.HasPrefix(ice.Info.Make.Remote, value[mdb.VALUE]) { 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.")) 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) }) 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) { INIT: {Name: "init remote*", Help: "初始化", Hand: func(m *ice.Message, arg ...string) {
m.OptionDefault(nfs.PATH, kit.Path("")) 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))) 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 { } else {
m.PushButton(STATUS, mdb.REMOVE) 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 { } else if repos := _repos_open(m, arg[0]); len(arg) == 1 {
_repos_branch(m, repos) _repos_branch(m, repos)
} else if len(arg) == 2 { } else if len(arg) == 2 {