forked from x/icebergs
opt some
This commit is contained in:
parent
8fd40a8fdb
commit
e6b0c6f7a1
@ -10,7 +10,6 @@ import (
|
|||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
"shylinux.com/x/toolkits/logs"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func _command_list(m *ice.Message, name string) *ice.Message {
|
func _command_list(m *ice.Message, name string) *ice.Message {
|
||||||
@ -121,19 +120,14 @@ func CmdList(m *ice.Message) *ice.Message {
|
|||||||
|
|
||||||
func IsOrderCmd(key string) bool { return key[0] == '/' || key[0] == '_' }
|
func IsOrderCmd(key string) bool { return key[0] == '/' || key[0] == '_' }
|
||||||
func FileURI(dir string) string {
|
func FileURI(dir string) string {
|
||||||
logs.Println("%v %v %v", dir, ice.Info.Make.Path, kit.Path(""))
|
|
||||||
if dir == "" {
|
if dir == "" {
|
||||||
return ""
|
return ""
|
||||||
} else if strings.Contains(dir, "/pkg/mod/") {
|
} else if strings.Contains(dir, "/pkg/mod/") {
|
||||||
dir = strings.Split(dir, "/pkg/mod/")[1]
|
dir = strings.Split(dir, "/pkg/mod/")[1]
|
||||||
} else if path.IsAbs(dir) {
|
} else if ice.Info.Make.Path != "" && strings.HasPrefix(dir, ice.Info.Make.Path) {
|
||||||
if ice.Info.Make.Path != "" && strings.HasPrefix(dir, ice.Info.Make.Path) {
|
dir = strings.TrimPrefix(dir, ice.Info.Make.Path)
|
||||||
dir = strings.TrimPrefix(dir, ice.Info.Make.Path)
|
} else if strings.HasPrefix(dir, kit.Path("")+nfs.PS) {
|
||||||
} else if strings.HasPrefix(dir, kit.Path("")+nfs.PS) {
|
dir = strings.TrimPrefix(dir, kit.Path("")+nfs.PS)
|
||||||
dir = strings.TrimPrefix(dir, kit.Path("")+nfs.PS)
|
|
||||||
}
|
|
||||||
} else if nfs.Exists(ice.Pulse, path.Join(ice.SRC, dir)) {
|
|
||||||
dir = path.Join(ice.SRC, dir)
|
|
||||||
}
|
}
|
||||||
return path.Join(nfs.PS, ice.REQUIRE, dir)
|
return path.Join(nfs.PS, ice.REQUIRE, dir)
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ func init() {
|
|||||||
func DreamAction() ice.Actions {
|
func DreamAction() ice.Actions {
|
||||||
return ice.MergeActions(ice.Actions{
|
return ice.MergeActions(ice.Actions{
|
||||||
DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { DreamProcess(m, []string{}, arg...) }},
|
DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { DreamProcess(m, []string{}, arg...) }},
|
||||||
}, gdb.EventsAction(DREAM_OPEN, DREAM_CLOSE, DREAM_INPUTS, DREAM_TABLES, DREAM_ACTION))
|
}, gdb.EventsAction(DREAM_OPEN, DREAM_CLOSE, DREAM_INPUTS, DREAM_CREATE, DREAM_TABLES, DREAM_ACTION))
|
||||||
}
|
}
|
||||||
func DreamProcess(m *ice.Message, args ice.Any, arg ...string) {
|
func DreamProcess(m *ice.Message, args ice.Any, arg ...string) {
|
||||||
if kit.HasPrefixList(arg, ice.RUN) {
|
if kit.HasPrefixList(arg, ice.RUN) {
|
||||||
|
@ -36,7 +36,7 @@ func _space_dial(m *ice.Message, dev, name string, arg ...string) {
|
|||||||
next := time.Duration(rand.Intn(a*(i+1))+b*i) * time.Millisecond
|
next := time.Duration(rand.Intn(a*(i+1))+b*i) * time.Millisecond
|
||||||
m.Cmd(tcp.CLIENT, tcp.DIAL, args, func(c net.Conn) {
|
m.Cmd(tcp.CLIENT, tcp.DIAL, args, func(c net.Conn) {
|
||||||
if c, e := websocket.NewClient(c, u); !m.Warn(e, tcp.DIAL, dev, SPACE, u.String()) {
|
if c, e := websocket.NewClient(c, u); !m.Warn(e, tcp.DIAL, dev, SPACE, u.String()) {
|
||||||
defer mdb.HashCreateDeferRemove(m, kit.SimpleKV("", MASTER, dev, u.Hostname()), kit.Dict(mdb.TARGET, c))()
|
defer mdb.HashCreateDeferRemove(m, kit.SimpleKV("", MASTER, dev, u.Host), kit.Dict(mdb.TARGET, c))()
|
||||||
kit.If(ice.Info.Colors, func() { once.Do(func() { m.Go(func() { _space_qrcode(m, dev) }) }) })
|
kit.If(ice.Info.Colors, func() { once.Do(func() { m.Go(func() { _space_qrcode(m, dev) }) }) })
|
||||||
_space_handle(m.Spawn(), true, dev, c)
|
_space_handle(m.Spawn(), true, dev, c)
|
||||||
i = 0
|
i = 0
|
||||||
|
@ -25,7 +25,7 @@ func init() {
|
|||||||
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
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.DreamAction(), CmdHashAction(), mdb.ImportantHashAction())},
|
}, CmdHashAction(), mdb.ImportantHashAction())},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,14 +27,13 @@ func _autogen_list(m *ice.Message) string {
|
|||||||
}[m.Option(mdb.TYPE)])
|
}[m.Option(mdb.TYPE)])
|
||||||
}
|
}
|
||||||
func _autogen_source(m *ice.Message, main, file string) {
|
func _autogen_source(m *ice.Message, main, file string) {
|
||||||
// m.Cmd(nfs.DEFS, main, nfs.Template(m, ice.SRC_MAIN_SHY))
|
|
||||||
m.Cmd(nfs.DEFS, main, m.Cmdx(nfs.CAT, ice.SRC_MAIN_SHY))
|
m.Cmd(nfs.DEFS, main, m.Cmdx(nfs.CAT, ice.SRC_MAIN_SHY))
|
||||||
m.Cmd(nfs.PUSH, main, lex.NL+ssh.SOURCE+lex.SP+strings.TrimPrefix(file, ice.SRC+nfs.PS)+lex.NL)
|
m.Cmd(nfs.PUSH, main, lex.NL+ssh.SOURCE+lex.SP+strings.TrimPrefix(file, ice.SRC+nfs.PS)+lex.NL)
|
||||||
}
|
}
|
||||||
func _autogen_script(m *ice.Message, file string) { m.Cmd(nfs.DEFS, file, nfs.Template(m, "demo.shy")) }
|
func _autogen_script(m *ice.Message, file string) { m.Cmd(nfs.DEFS, file, nfs.Template(m, "demo.shy")) }
|
||||||
func _autogen_module(m *ice.Message, file string) { m.Cmd(nfs.DEFS, file, nfs.Template(m, "demo.go")) }
|
func _autogen_module(m *ice.Message, file string) { m.Cmd(nfs.DEFS, file, nfs.Template(m, "demo.go")) }
|
||||||
func _autogen_import(m *ice.Message, main string, ctx string, mod string) {
|
func _autogen_import(m *ice.Message, main string, ctx string, mod string) {
|
||||||
// m.Cmd(nfs.DEFS, main, nfs.Template(m, ice.SRC_MAIN_GO))
|
m.Cmd(nfs.DEFS, ice.README_MD, m.Cmdx(nfs.CAT, ice.README_MD))
|
||||||
m.Cmd(nfs.DEFS, ice.MAKEFILE, m.Cmdx(nfs.CAT, ice.MAKEFILE))
|
m.Cmd(nfs.DEFS, ice.MAKEFILE, m.Cmdx(nfs.CAT, ice.MAKEFILE))
|
||||||
m.Cmd(nfs.DEFS, ice.LICENSE, m.Cmdx(nfs.CAT, ice.LICENSE))
|
m.Cmd(nfs.DEFS, ice.LICENSE, m.Cmdx(nfs.CAT, ice.LICENSE))
|
||||||
m.Cmd(nfs.DEFS, main, m.Cmdx(nfs.CAT, ice.SRC_MAIN_GO))
|
m.Cmd(nfs.DEFS, main, m.Cmdx(nfs.CAT, ice.SRC_MAIN_GO))
|
||||||
|
@ -24,12 +24,6 @@ func _binpack_file(m *ice.Message, w io.Writer, arg ...string) {
|
|||||||
fmt.Fprintf(w, " \"%s\": \"%s\",\n", kit.Select(arg[0], arg, 1), "")
|
fmt.Fprintf(w, " \"%s\": \"%s\",\n", kit.Select(arg[0], arg, 1), "")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
switch path.Base(arg[0]) {
|
|
||||||
case ice.GO_MOD, ice.GO_SUM:
|
|
||||||
if !strings.HasPrefix(arg[0], ice.SRC_TEMPLATE) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case ice.SRC_VERSION_GO, ice.SRC_BINPACK_GO, ice.ETC_LOCAL_SHY:
|
case ice.SRC_VERSION_GO, ice.SRC_BINPACK_GO, ice.ETC_LOCAL_SHY:
|
||||||
return
|
return
|
||||||
|
@ -63,7 +63,17 @@ func init() {
|
|||||||
INSTALL: {Name: "install service*='https://golang.google.cn/dl/' version*=1.15.5", Help: "安装", Hand: func(m *ice.Message, arg ...string) {
|
INSTALL: {Name: "install service*='https://golang.google.cn/dl/' version*=1.15.5", Help: "安装", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(INSTALL, web.DOWNLOAD, kit.Format("%s/go%s.%s-%s.%s", m.Option(SERVICE), m.Option(VERSION), runtime.GOOS, runtime.GOARCH, kit.Select("tar.gz", "zip", runtime.GOOS == cli.WINDOWS)), ice.USR_LOCAL)
|
m.Cmdy(INSTALL, web.DOWNLOAD, kit.Format("%s/go%s.%s-%s.%s", m.Option(SERVICE), m.Option(VERSION), runtime.GOOS, runtime.GOARCH, kit.Select("tar.gz", "zip", runtime.GOOS == cli.WINDOWS)), ice.USR_LOCAL)
|
||||||
}},
|
}},
|
||||||
}, ctx.ConfAction(cli.ENV, kit.Dict("GOPRIVATE", "shylinux.com,github.com", "GOPROXY", "https://goproxy.cn,direct", "CGO_ENABLED", "0"))), Hand: func(m *ice.Message, arg ...string) {
|
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
kit.Switch(m.Option(mdb.TYPE), kit.Simple(web.SERVER, web.WORKER), func() {
|
||||||
|
kit.If(cli.SystemFind(m, GO), func() {
|
||||||
|
kit.If(nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME), "src/main.go")), func() {
|
||||||
|
|
||||||
|
m.PushButton(kit.Dict(m.CommandKey(), "编译"))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}},
|
||||||
|
}, web.DreamAction(), ctx.ConfAction(cli.ENV, kit.Dict("GOPRIVATE", "shylinux.com,github.com", "GOPROXY", "https://goproxy.cn,direct", "CGO_ENABLED", "0"))), Hand: func(m *ice.Message, arg ...string) {
|
||||||
defer web.ToastProcess(m)()
|
defer web.ToastProcess(m)()
|
||||||
main, file, goos, arch := _compile_target(m, arg...)
|
main, file, goos, arch := _compile_target(m, arg...)
|
||||||
env := kit.Simple(cli.PATH, cli.BinPath(), cli.HOME, kit.Select(kit.Path(""), kit.Env(cli.HOME)), mdb.Configv(m, cli.ENV), m.Optionv(cli.ENV), cli.GOOS, goos, cli.GOARCH, arch)
|
env := kit.Simple(cli.PATH, cli.BinPath(), cli.HOME, kit.Select(kit.Path(""), kit.Env(cli.HOME)), mdb.Configv(m, cli.ENV), m.Optionv(cli.ENV), cli.GOOS, goos, cli.GOARCH, arch)
|
||||||
|
@ -77,7 +77,7 @@ func init() {
|
|||||||
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
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(), "计划")) })
|
||||||
}},
|
}},
|
||||||
}, TASK, web.DreamAction(), ctx.CmdAction(), aaa.RoleAction(ctx.COMMAND)), Hand: func(m *ice.Message, arg ...string) {
|
}, aaa.RoleAction(ctx.COMMAND), ctx.CmdAction(), TASK), Hand: func(m *ice.Message, arg ...string) {
|
||||||
begin_time, end_time := _plan_scope(m, kit.Slice(arg, 0, 2)...)
|
begin_time, end_time := _plan_scope(m, kit.Slice(arg, 0, 2)...)
|
||||||
_plan_list(m, begin_time.Format(ice.MOD_TIME), end_time.Format(ice.MOD_TIME))
|
_plan_list(m, begin_time.Format(ice.MOD_TIME), end_time.Format(ice.MOD_TIME))
|
||||||
web.PushPodCmd(m, "", arg...)
|
web.PushPodCmd(m, "", arg...)
|
||||||
|
@ -29,7 +29,7 @@ func init() {
|
|||||||
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
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.DreamAction(), WikiAction("", nfs.SVG), ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, ctx.CmdAction(), WikiAction("", nfs.SVG)), Hand: func(m *ice.Message, arg ...string) {
|
||||||
kit.If(!_wiki_list(m, arg...), func() {
|
kit.If(!_wiki_list(m, arg...), func() {
|
||||||
_wiki_show(m, arg[0])
|
_wiki_show(m, arg[0])
|
||||||
kit.If(m.IsErr(), func() { m.Option(ice.MSG_OUTPUT, "") })
|
kit.If(m.IsErr(), func() { m.Option(ice.MSG_OUTPUT, "") })
|
||||||
|
@ -55,7 +55,7 @@ func init() {
|
|||||||
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
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.DreamAction(), WikiAction("", nfs.SHY), ctx.CmdAction(), aaa.RoleAction("story.field")), Hand: func(m *ice.Message, arg ...string) {
|
}, aaa.RoleAction("story.field"), ctx.CmdAction(), WikiAction("", nfs.SHY)), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Option(nfs.DIR_DEEP, ice.TRUE); len(arg) == 0 {
|
if m.Option(nfs.DIR_DEEP, ice.TRUE); len(arg) == 0 {
|
||||||
arg = append(arg, nfs.SRC)
|
arg = append(arg, nfs.SRC)
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ import (
|
|||||||
"shylinux.com/x/icebergs/base/aaa"
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
"shylinux.com/x/icebergs/base/cli"
|
"shylinux.com/x/icebergs/base/cli"
|
||||||
"shylinux.com/x/icebergs/base/ctx"
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
"shylinux.com/x/icebergs/base/gdb"
|
|
||||||
"shylinux.com/x/icebergs/base/lex"
|
"shylinux.com/x/icebergs/base/lex"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
@ -340,23 +339,27 @@ const (
|
|||||||
const REPOS = "repos"
|
const REPOS = "repos"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
cache := ""
|
||||||
web.Index.MergeCommands(ice.Commands{
|
web.Index.MergeCommands(ice.Commands{
|
||||||
web.PP(ice.REQUIRE): {Name: "/require/shylinux.com/x/volcanos/proto.js", Hand: func(m *ice.Message, arg ...string) {
|
web.PP(ice.REQUIRE): {Name: "/require/shylinux.com/x/volcanos/proto.js", Actions: ice.MergeActions(ice.Actions{
|
||||||
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
cache = kit.GetValid(
|
||||||
|
func() string { return ice.Pulse.Cmdx(cli.SYSTEM, "go", "env", "GOMODCACHE") },
|
||||||
|
func() string {
|
||||||
|
return kit.Select(kit.HomePath("go")+nfs.PS, ice.Pulse.Cmdx(cli.SYSTEM, "go", "env", "GOPATH")) + "/pkg/mod/"
|
||||||
|
},
|
||||||
|
func() string { return ice.USR_REQUIRE },
|
||||||
|
)
|
||||||
|
}},
|
||||||
|
}), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) < 4 {
|
if len(arg) < 4 {
|
||||||
m.RenderStatusBadRequest()
|
m.RenderStatusBadRequest()
|
||||||
} else if path.Join(arg[:3]...) == ice.Info.Make.Module && nfs.Exists(m, path.Join(arg[3:]...)) {
|
} else if path.Join(arg[:3]...) == ice.Info.Make.Module && nfs.Exists(m, path.Join(arg[3:]...)) {
|
||||||
m.RenderDownload(path.Join(arg[3:]...))
|
m.RenderDownload(path.Join(arg[3:]...))
|
||||||
} else if p := path.Join(nfs.USR, kit.Split(arg[2], mdb.AT)[0], path.Join(arg[3:]...)); nfs.Exists(m, p) {
|
} else if p := path.Join(nfs.USR, kit.Split(arg[2], mdb.AT)[0], path.Join(arg[3:]...)); nfs.Exists(m, p) && kit.Select("", kit.Split(arg[2], mdb.AT), 1) == ice.Info.Gomod[path.Join(arg[0], arg[1], kit.Split(arg[2], mdb.AT)[0])] {
|
||||||
m.RenderDownload(p)
|
m.RenderDownload(p)
|
||||||
} else {
|
} else {
|
||||||
p := path.Join(kit.GetValid(
|
if p = path.Join(cache, path.Join(arg...)); !nfs.Exists(m, p) {
|
||||||
func() string { return m.Cmdx(cli.SYSTEM, "go", "env", "GOMODCACHE") },
|
|
||||||
func() string {
|
|
||||||
return kit.Select(kit.HomePath("go")+nfs.PS, m.Cmdx(cli.SYSTEM, "go", "env", "GOPATH")) + "/pkg/mod/"
|
|
||||||
},
|
|
||||||
func() string { return ice.USR_REQUIRE },
|
|
||||||
), path.Join(arg...))
|
|
||||||
if !nfs.Exists(m, p) {
|
|
||||||
if p = path.Join(ice.USR_REQUIRE, path.Join(arg...)); !nfs.Exists(m, p) {
|
if p = path.Join(ice.USR_REQUIRE, path.Join(arg...)); !nfs.Exists(m, p) {
|
||||||
ls := strings.SplitN(path.Join(arg[:3]...), mdb.AT, 2)
|
ls := strings.SplitN(path.Join(arg[:3]...), mdb.AT, 2)
|
||||||
to := path.Join(ice.USR_REQUIRE, path.Join(arg[:3]...))
|
to := path.Join(ice.USR_REQUIRE, path.Join(arg[:3]...))
|
||||||
@ -541,9 +544,6 @@ func init() {
|
|||||||
mdb.HashRemove(m, m.Option(REPOS))
|
mdb.HashRemove(m, m.Option(REPOS))
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
kit.Switch(m.Option(mdb.TYPE), kit.Simple(web.SERVER, web.WORKER), func() { m.PushButton(kit.Dict(m.CommandKey(), "仓库")) })
|
|
||||||
}},
|
|
||||||
web.DREAM_CREATE: {Hand: func(m *ice.Message, arg ...string) {
|
web.DREAM_CREATE: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
kit.If(m.Option(REPOS), func(p string) {
|
kit.If(m.Option(REPOS), func(p string) {
|
||||||
p = strings.Split(p, mdb.QS)[0]
|
p = strings.Split(p, mdb.QS)[0]
|
||||||
@ -551,10 +551,18 @@ func init() {
|
|||||||
m.Cmd("", CLONE, ORIGIN, p, nfs.PATH, m.Option(cli.CMD_DIR), ice.Maps{cli.CMD_DIR: ""})
|
m.Cmd("", CLONE, ORIGIN, p, nfs.PATH, m.Option(cli.CMD_DIR), ice.Maps{cli.CMD_DIR: ""})
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
|
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
kit.Switch(m.Option(mdb.TYPE), kit.Simple(web.SERVER, web.WORKER), func() {
|
||||||
|
kit.If(nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME), ".git")), func() {
|
||||||
|
m.PushButton(kit.Dict(m.CommandKey(), "仓库"))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}},
|
||||||
code.INNER: {Hand: func(m *ice.Message, arg ...string) { _repos_inner(m, _repos_path, arg...) }},
|
code.INNER: {Hand: func(m *ice.Message, arg ...string) { _repos_inner(m, _repos_path, arg...) }},
|
||||||
}, gdb.EventsAction(web.DREAM_CREATE), web.DreamAction(), mdb.HashAction(mdb.SHORT, REPOS, mdb.FIELD, "time,repos,branch,version,comment,origin"), mdb.ClearOnExitHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, aaa.RoleAction(REMOTE), web.DreamAction(), mdb.ClearOnExitHashAction(), mdb.HashAction(mdb.SHORT, REPOS, mdb.FIELD, "time,repos,branch,version,comment,origin")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
mdb.HashSelect(m, arg...).Sort(REPOS).Action(CLONE, PULL, PUSH, STATUS)
|
mdb.HashSelect(m, arg...).Sort(REPOS).Action(CLONE, PULL, PUSH, STATUS)
|
||||||
|
m.Echo(strings.ReplaceAll(m.Cmdx(code.PUBLISH, ice.CONTEXTS), "app username", "dev username"))
|
||||||
} else if len(arg) == 1 {
|
} else if len(arg) == 1 {
|
||||||
_repos_branch(m, _repos_open(m, arg[0]))
|
_repos_branch(m, _repos_open(m, arg[0]))
|
||||||
} else if len(arg) == 2 {
|
} else if len(arg) == 2 {
|
||||||
|
@ -9,7 +9,6 @@ import (
|
|||||||
"shylinux.com/x/icebergs/base/aaa"
|
"shylinux.com/x/icebergs/base/aaa"
|
||||||
"shylinux.com/x/icebergs/base/cli"
|
"shylinux.com/x/icebergs/base/cli"
|
||||||
"shylinux.com/x/icebergs/base/ctx"
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
"shylinux.com/x/icebergs/base/gdb"
|
|
||||||
"shylinux.com/x/icebergs/base/lex"
|
"shylinux.com/x/icebergs/base/lex"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
@ -142,6 +141,10 @@ func init() {
|
|||||||
if m.Option(mdb.TYPE) != web.WORKER {
|
if m.Option(mdb.TYPE) != web.WORKER {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if !nfs.Exists(m, path.Join(ice.USR_LOCAL_WORK, m.Option(mdb.NAME), ".git")) {
|
||||||
|
m.Push(mdb.TEXT, "")
|
||||||
|
return
|
||||||
|
}
|
||||||
text := []string{}
|
text := []string{}
|
||||||
for _, line := range kit.Split(m.Cmdx(web.SPACE, m.Option(mdb.NAME), cli.SYSTEM, GIT, DIFF, "--shortstat"), mdb.FS, mdb.FS) {
|
for _, line := range kit.Split(m.Cmdx(web.SPACE, m.Option(mdb.NAME), cli.SYSTEM, GIT, DIFF, "--shortstat"), mdb.FS, mdb.FS) {
|
||||||
if list := kit.Split(line); strings.Contains(line, "file") {
|
if list := kit.Split(line); strings.Contains(line, "file") {
|
||||||
@ -154,7 +157,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
m.Push(mdb.TEXT, strings.Join(text, ", "))
|
m.Push(mdb.TEXT, strings.Join(text, ", "))
|
||||||
}},
|
}},
|
||||||
}, aaa.RoleAction(), gdb.EventAction(web.DREAM_TABLES), Prefix(REPOS), mdb.ImportantHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
}, aaa.RoleAction(), web.DreamAction(), Prefix(REPOS), mdb.ImportantHashAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if len(arg) > 0 && arg[0] == ctx.ACTION {
|
if len(arg) > 0 && arg[0] == ctx.ACTION {
|
||||||
m.Cmdy(REPOS, arg)
|
m.Cmdy(REPOS, arg)
|
||||||
} else if config, err := config.LoadConfig(config.GlobalScope); err == nil && config.User.Email == "" && mdb.Config(m, aaa.EMAIL) == "" {
|
} else if config, err := config.LoadConfig(config.GlobalScope); err == nil && config.User.Email == "" && mdb.Config(m, aaa.EMAIL) == "" {
|
||||||
|
@ -40,6 +40,12 @@ func init() {
|
|||||||
}).Cmd(nfs.SAVE, kit.HomePath(FILE), strings.Join(list, lex.NL)+lex.NL)
|
}).Cmd(nfs.SAVE, kit.HomePath(FILE), strings.Join(list, lex.NL)+lex.NL)
|
||||||
m.ProcessClose()
|
m.ProcessClose()
|
||||||
}},
|
}},
|
||||||
}, mdb.HashAction(mdb.EXPIRE, mdb.MONTH, mdb.SHORT, aaa.USERNAME, mdb.FIELD, "time,username,token"))},
|
}, mdb.HashAction(mdb.EXPIRE, mdb.MONTH, mdb.SHORT, aaa.USERNAME, mdb.FIELD, "time,username,token")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
mdb.HashSelect(m, arg...)
|
||||||
|
if len(arg) > 0 {
|
||||||
|
u := kit.ParseURL(m.Option(ice.MSG_USERWEB))
|
||||||
|
m.EchoScript(kit.Format("%s://%s:%s@%s", u.Scheme, m.Append(aaa.USERNAME), m.Append(TOKEN), u.Host))
|
||||||
|
}
|
||||||
|
}},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user