forked from x/icebergs
add some
This commit is contained in:
parent
a82c81813b
commit
8811c44c6a
@ -136,13 +136,14 @@ func _dir_list(m *ice.Message, root string, dir string, level int, deep bool, di
|
|||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
PWD = "./"
|
PWD = "./"
|
||||||
SRC = "src/"
|
SRC = "src/"
|
||||||
BIN = "bin/"
|
BIN = "bin/"
|
||||||
USR = "usr/"
|
USR = "usr/"
|
||||||
USR_PORTAL = ice.USR_PORTAL
|
USR_PORTAL = ice.USR_PORTAL
|
||||||
SRC_DOCUMENT = ice.SRC_DOCUMENT
|
USR_LOCAL_WORK = ice.USR_LOCAL_WORK
|
||||||
REQUIRE = "/require/"
|
SRC_DOCUMENT = ice.SRC_DOCUMENT
|
||||||
|
REQUIRE = "/require/"
|
||||||
|
|
||||||
TYPE_ALL = "all"
|
TYPE_ALL = "all"
|
||||||
TYPE_BIN = "bin"
|
TYPE_BIN = "bin"
|
||||||
|
@ -61,11 +61,11 @@ func ProcessIframe(m *ice.Message, name, link string, arg ...string) {
|
|||||||
}, arg...)
|
}, arg...)
|
||||||
}
|
}
|
||||||
func PushPodCmd(m *ice.Message, cmd string, arg ...string) {
|
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) {
|
m.Cmds(SPACE, func(value ice.Maps) {
|
||||||
if kit.IsIn(value[mdb.TYPE], WORKER, SERVER) {
|
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) {
|
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)
|
m.Push("", val, head)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ func init() {
|
|||||||
m.Cmd(nfs.DIR, USR_ICONS, func(value ice.Maps) { m.Push(arg[0], value[nfs.PATH]) })
|
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"},
|
}}, 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) {
|
func install(m *ice.Message, cmd, name, index string, arg ...string) {
|
||||||
|
@ -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(), "桌面")) })
|
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...) }},
|
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())},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { mdb.HashExport(m) }},
|
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) {
|
func DockAppend(m *ice.Message, name, index string, arg ...string) {
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"shylinux.com/x/icebergs/base/ctx"
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
|
"shylinux.com/x/icebergs/base/web"
|
||||||
"shylinux.com/x/icebergs/core/chat"
|
"shylinux.com/x/icebergs/core/chat"
|
||||||
kit "shylinux.com/x/toolkits"
|
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 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 {
|
func CmdHashAction(arg ...string) ice.Actions {
|
||||||
file := kit.FileLine(2, 100)
|
file := kit.FileLine(2, 100)
|
||||||
return ice.MergeActions(ice.Actions{
|
return ice.MergeActions(ice.Actions{
|
||||||
|
@ -32,7 +32,7 @@ func _plan_scope(m *ice.Message, arg ...string) (begin_time, end_time time.Time)
|
|||||||
return begin_time, end_time
|
return begin_time, end_time
|
||||||
}
|
}
|
||||||
func _plan_list(m *ice.Message, begin_time, end_time string) {
|
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) {
|
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 {
|
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))
|
m.Push(key, value, fields, val).PushButton(_task_action(m, value[STATUS], mdb.PLUGIN))
|
||||||
|
@ -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); }
|
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.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>* { 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 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 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 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 ol { margin:20px 40px; }
|
||||||
fieldset.web.wiki.portal>div.output>div.layout>div.main p code {
|
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] {
|
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;
|
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 {
|
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;
|
background-color:white; color:black;
|
||||||
|
3
logs.go
3
logs.go
@ -200,9 +200,6 @@ func (m *Message) FormatChain() string {
|
|||||||
ms = append(ms, msg)
|
ms = append(ms, msg)
|
||||||
}
|
}
|
||||||
show := func(msg *Message, key string, arg ...string) string {
|
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] == "" {
|
if len(msg.meta[key]) == 0 || len(msg.meta[key]) == 1 && msg.meta[key][0] == "" {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
@ -8,9 +8,13 @@ import (
|
|||||||
|
|
||||||
type spide struct {
|
type spide struct {
|
||||||
cache
|
cache
|
||||||
|
demo string `name:"demo" event:"serve.start"`
|
||||||
list string `name:"list wid tid url auto insert" help:"节点"`
|
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) {
|
func (s spide) Download(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(s.cache, s.Create, arg).ProcessHold()
|
m.Cmdy(s.cache, s.Create, arg).ProcessHold()
|
||||||
}
|
}
|
||||||
|
@ -73,17 +73,17 @@ func _repos_insert(m *ice.Message, p string) {
|
|||||||
if head, err := repos.Head(); err == nil {
|
if head, err := repos.Head(); err == nil {
|
||||||
args = append(args, BRANCH, head.Name().Short())
|
args = append(args, BRANCH, head.Name().Short())
|
||||||
if commit, err := repos.CommitObject(head.Hash()); err == nil {
|
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 refer := _repos_recent(m, repos); refer != nil {
|
||||||
if n := _repos_forword(m, repos, refer.Hash().String()); n > 0 {
|
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 {
|
} else {
|
||||||
args = append(args, VERSION, refer.Name().Short())
|
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])
|
args = append(args, ORIGIN, remote.Config().URLs[0])
|
||||||
} else if remote, err := repos.Remotes(); err == nil && len(remote) > 0 {
|
} else if remote, err := repos.Remotes(); err == nil && len(remote) > 0 {
|
||||||
args = append(args, ORIGIN, remote[0].Config().URLs[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("")) {
|
if p == path.Base(kit.Path("")) {
|
||||||
return kit.Path("", arg...)
|
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 {
|
func _repos_open(m *ice.Message, p string) *git.Repository {
|
||||||
return mdb.HashSelectTarget(m, p, nil).(*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 {
|
_repos_each(m, "", func(repos *git.Repository, value ice.Maps) error {
|
||||||
if value[ORIGIN] == "" {
|
if value[ORIGIN] == "" {
|
||||||
return nil
|
return nil
|
||||||
} else if remote, err := repos.Remote("origin"); err != nil {
|
} else if remote, err := repos.Remote(ORIGIN); err != nil {
|
||||||
return err
|
return err
|
||||||
} else {
|
} else {
|
||||||
remoteURL := remote.Config().URLs[0]
|
remoteURL := remote.Config().URLs[0]
|
||||||
@ -439,6 +445,7 @@ func init() {
|
|||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
REPOS: {Name: "repos repos branch:text commit:text file:text auto", Help: "代码库", Actions: ice.MergeActions(ice.Actions{
|
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) {
|
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]) })
|
m.Cmd(nfs.DIR, nfs.USR, func(value ice.Maps) { _repos_insert(m, value[nfs.PATH]) })
|
||||||
_repos_insert(m, kit.Path(""))
|
_repos_insert(m, kit.Path(""))
|
||||||
m.Cmd(CONFIGS, func(value ice.Maps) {
|
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) {
|
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)
|
git.PlainInit(m.Option(nfs.PATH), false)
|
||||||
_repos_insert(m, kit.Path(""))
|
_repos_insert(m, kit.Path(""))
|
||||||
}},
|
}},
|
||||||
@ -481,7 +488,7 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
PUSH: {Help: "上传", Hand: func(m *ice.Message, arg ...string) {
|
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 {
|
_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})
|
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 != "" {
|
if repos := kit.Select(m.Option(REPOS), arg, 0); repos != "" {
|
||||||
_repos_status(m, repos, _repos_open(m, repos))
|
_repos_status(m, repos, _repos_open(m, repos))
|
||||||
} else {
|
} 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 {
|
_repos_each(m, "", func(repos *git.Repository, value ice.Maps) error {
|
||||||
if refer, err := repos.Head(); err == nil {
|
if refer, err := repos.Head(); err == nil {
|
||||||
if commit, err := repos.CommitObject(refer.Hash()); err == nil {
|
if commit, err := repos.CommitObject(refer.Hash()); err == nil {
|
||||||
@ -536,11 +543,9 @@ func init() {
|
|||||||
kit.If(_last > last, func() { last = _last })
|
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)
|
return _repos_status(m, value[REPOS], repos)
|
||||||
})
|
})
|
||||||
|
remote := ice.Info.Make.Remote
|
||||||
if insteadof := mdb.Config(m, INSTEADOF); insteadof != "" {
|
if insteadof := mdb.Config(m, INSTEADOF); insteadof != "" {
|
||||||
remote = insteadof + path.Base(remote)
|
remote = insteadof + path.Base(remote)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user