forked from x/icebergs
opt some
This commit is contained in:
parent
1ee314e4f5
commit
5587905708
@ -104,6 +104,9 @@ const DREAM = "dream"
|
|||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
Index.Merge(&ice.Context{Commands: map[string]*ice.Command{
|
||||||
DREAM: {Name: "dream name path auto start", Help: "梦想家", Action: map[string]*ice.Action{
|
DREAM: {Name: "dream name path auto start", Help: "梦想家", Action: map[string]*ice.Action{
|
||||||
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Config("miss", _dream_miss)
|
||||||
|
}},
|
||||||
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case "repos":
|
case "repos":
|
||||||
@ -171,11 +174,14 @@ func init() {
|
|||||||
m.Cmdy(nfs.CAT, arg[1:])
|
m.Cmdy(nfs.CAT, arg[1:])
|
||||||
}},
|
}},
|
||||||
}, Configs: map[string]*ice.Config{
|
}, Configs: map[string]*ice.Config{
|
||||||
DREAM: {Name: DREAM, Help: "梦想家", Value: kit.Data(nfs.PATH, ice.USR_LOCAL_WORK,
|
DREAM: {Name: DREAM, Help: "梦想家", Value: kit.Data(nfs.PATH, ice.USR_LOCAL_WORK, "miss", _dream_miss)},
|
||||||
"miss", `#! /bin/sh
|
}})
|
||||||
if [ "$ISH_CONF_PRE" = "" ]; then
|
}
|
||||||
[ -f $PWD/.ish/plug.sh ] || [ -f $HOME/.ish/plug.sh ] || git clone https://shylinux.com/x/intshell $PWD/.ish
|
|
||||||
source $PWD/.ish/plug.sh || source $HOME/.ish/plug.sh
|
var _dream_miss = `#! /bin/sh
|
||||||
|
|
||||||
|
require &>/dev/null || if [ -f $PWD/.ish/plug.sh ]; then source $PWD/.ish/plug.sh; elif [ -f $HOME/.ish/plug.sh ]; then source $HOME/.ish/plug.sh; else
|
||||||
|
ctx_temp=$(mktemp); if curl -h &>/dev/null; then curl -o $ctx_temp -fsSL https://shylinux.com; else wget -O $ctx_temp -q http://shylinux.com; fi; source $ctx_temp intshell
|
||||||
fi
|
fi
|
||||||
|
|
||||||
require miss.sh
|
require miss.sh
|
||||||
@ -183,19 +189,5 @@ ish_miss_prepare_compile
|
|||||||
ish_miss_prepare_develop
|
ish_miss_prepare_develop
|
||||||
ish_miss_prepare_install
|
ish_miss_prepare_install
|
||||||
|
|
||||||
# ish_miss_prepare redis-story
|
|
||||||
# ish_miss_prepare mysql-story
|
|
||||||
# ish_miss_prepare release
|
|
||||||
|
|
||||||
# ish_miss_prepare_contexts
|
|
||||||
# ish_miss_prepare_intshell
|
|
||||||
# ish_miss_prepare_icebergs
|
|
||||||
# ish_miss_prepare_toolkits
|
|
||||||
# ish_miss_prepare_volcanos
|
|
||||||
# ish_miss_prepare_learning
|
|
||||||
|
|
||||||
ish_miss_make; if [ -n "$*" ]; then ./bin/ice.bin forever serve "$@"; fi
|
ish_miss_make; if [ -n "$*" ]; then ./bin/ice.bin forever serve "$@"; fi
|
||||||
`,
|
`
|
||||||
)},
|
|
||||||
}})
|
|
||||||
}
|
|
||||||
|
@ -11,6 +11,7 @@ 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/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"
|
||||||
"shylinux.com/x/icebergs/base/tcp"
|
"shylinux.com/x/icebergs/base/tcp"
|
||||||
@ -302,22 +303,15 @@ func init() {
|
|||||||
switch r.URL.Path {
|
switch r.URL.Path {
|
||||||
case ice.PS:
|
case ice.PS:
|
||||||
msg := m.Spawn(SERVE, w, r)
|
msg := m.Spawn(SERVE, w, r)
|
||||||
if share := r.URL.Query().Get("share"); share != "" {
|
|
||||||
switch msg := msg.Cmd(SHARE, share); msg.Append(mdb.TYPE) {
|
|
||||||
case "login":
|
|
||||||
RenderCookie(msg, aaa.SessCreate(msg, msg.Append(aaa.USERNAME)))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
repos := kit.Select(ice.INTSHELL, ice.VOLCANOS, strings.Contains(r.Header.Get("User-Agent"), "Mozilla/5.0"))
|
repos := kit.Select(ice.INTSHELL, ice.VOLCANOS, strings.Contains(r.Header.Get("User-Agent"), "Mozilla/5.0"))
|
||||||
if repos == ice.VOLCANOS {
|
if repos == ice.VOLCANOS {
|
||||||
if s := msg.Cmdx("web.chat.website", "show", "index.iml", "Header", "", "River", ""); s != "" {
|
if s := msg.Cmdx("web.chat.website", lex.PARSE, "index.iml", "Header", "", "River", ""); s != "" {
|
||||||
Render(msg, ice.RENDER_RESULT, s)
|
Render(msg, ice.RENDER_RESULT, s)
|
||||||
return true
|
return true // 定制主页
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Render(msg, ice.RENDER_DOWNLOAD, path.Join(msg.Config(kit.Keys(repos, nfs.PATH)), msg.Config(kit.Keys(repos, INDEX))))
|
Render(msg, ice.RENDER_DOWNLOAD, path.Join(msg.Config(kit.Keys(repos, nfs.PATH)), msg.Config(kit.Keys(repos, INDEX))))
|
||||||
return true // 网站主页
|
return true // 默认主页
|
||||||
|
|
||||||
case "/help/":
|
case "/help/":
|
||||||
r.URL.Path = "/help/tutor.shy"
|
r.URL.Path = "/help/tutor.shy"
|
||||||
@ -325,7 +319,6 @@ func init() {
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
m.Cmd(aaa.ROLE, aaa.WHITE, aaa.VOID, nfs.CAT, "usr/publish/order.js")
|
|
||||||
}},
|
}},
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(SERVE).Table(func(index int, value map[string]string, head []string) {
|
m.Cmd(SERVE).Table(func(index int, value map[string]string, head []string) {
|
||||||
@ -400,19 +393,9 @@ func init() {
|
|||||||
_share_repos(m, path.Join(arg[0], arg[1], arg[2]), arg[3:]...)
|
_share_repos(m, path.Join(arg[0], arg[1], arg[2]), arg[3:]...)
|
||||||
}},
|
}},
|
||||||
"/publish/": {Name: "/publish/", Help: "定制化", Hand: func(m *ice.Message, arg ...string) {
|
"/publish/": {Name: "/publish/", Help: "定制化", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if arg[0] == ice.ORDER_JS {
|
|
||||||
if p := path.Join(ice.USR_PUBLISH, ice.ORDER_JS); m.PodCmd(nfs.CAT, p) {
|
|
||||||
if m.IsErr() {
|
|
||||||
m.RenderResult("")
|
|
||||||
} else {
|
|
||||||
m.RenderResult()
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if strings.HasPrefix(arg[0], "ice.") && m.Option(ice.POD) != "" {
|
if strings.HasPrefix(arg[0], "ice.") && m.Option(ice.POD) != "" {
|
||||||
_share_local(aaa.UserRoot(m), ice.BIN_ICE_BIN)
|
_share_local(aaa.UserRoot(m), path.Join(ice.USR_PUBLISH, arg[0]))
|
||||||
// _share_local(aaa.UserRoot(m), arg[0])
|
// _share_local(aaa.UserRoot(m), ice.BIN_ICE_BIN)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
_share_local(m, m.Conf(SERVE, kit.Keym(ice.PUBLISH)), path.Join(arg...))
|
_share_local(m, m.Conf(SERVE, kit.Keym(ice.PUBLISH)), path.Join(arg...))
|
||||||
|
1
conf.go
1
conf.go
@ -125,6 +125,7 @@ const ( // DIR
|
|||||||
USR_LOCAL_RIVER = "usr/local/river"
|
USR_LOCAL_RIVER = "usr/local/river"
|
||||||
USR_LOCAL_DAEMON = "usr/local/daemon"
|
USR_LOCAL_DAEMON = "usr/local/daemon"
|
||||||
USR_LOCAL_EXPORT = "usr/local/export"
|
USR_LOCAL_EXPORT = "usr/local/export"
|
||||||
|
USR_LOCAL_REPOS = "usr/local/repos"
|
||||||
|
|
||||||
VAR_RUN = "var/run"
|
VAR_RUN = "var/run"
|
||||||
VAR_TMP = "var/tmp"
|
VAR_TMP = "var/tmp"
|
||||||
|
@ -27,31 +27,37 @@ func _website_parse(m *ice.Message, text string, args ...string) (ice.Map, bool)
|
|||||||
return nil, false
|
return nil, false
|
||||||
}
|
}
|
||||||
|
|
||||||
m.Option(nfs.CAT_CONTENT, text)
|
const (
|
||||||
river, storm, last := kit.Dict(
|
HEADER = "Header"
|
||||||
"Header", kit.Dict("menus", kit.List(), "style", kit.Dict("display", "none")),
|
RIVER = "River"
|
||||||
"River", kit.Dict("menus", kit.List(), "action", kit.List()),
|
|
||||||
args,
|
|
||||||
), kit.Dict(), kit.Dict()
|
|
||||||
prefix := ""
|
|
||||||
|
|
||||||
nriver := 0
|
ORDER = "order"
|
||||||
nstorm := 0
|
TITLE = "title"
|
||||||
|
MENUS = "menus"
|
||||||
|
)
|
||||||
|
|
||||||
|
river, storm, last := kit.Dict(
|
||||||
|
HEADER, kit.Dict(MENUS, kit.List(), ctx.STYLE, kit.Dict(ctx.DISPLAY, "none")),
|
||||||
|
RIVER, kit.Dict(MENUS, kit.List(), ctx.ACTION, kit.List()), args,
|
||||||
|
), kit.Dict(), kit.Dict()
|
||||||
|
nriver, nstorm, prefix := 0, 0, ""
|
||||||
|
|
||||||
|
m.Option(nfs.CAT_CONTENT, text)
|
||||||
m.Cmd(lex.SPLIT, "", mdb.KEY, mdb.NAME, func(deep int, ls []string, meta ice.Map) []string {
|
m.Cmd(lex.SPLIT, "", mdb.KEY, mdb.NAME, func(deep int, ls []string, meta ice.Map) []string {
|
||||||
if deep == 1 {
|
if deep == 1 {
|
||||||
switch ls[0] {
|
switch ls[0] {
|
||||||
case "header":
|
case HEADER, RIVER:
|
||||||
for i := 1; i < len(ls); i += 2 {
|
for i := 1; i < len(ls); i += 2 {
|
||||||
kit.Value(river, kit.Keys("Header", ls[i]), ls[i+1])
|
kit.Value(river, kit.Keys(ls[0], ls[i]), ls[i+1])
|
||||||
}
|
}
|
||||||
return ls
|
return ls
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data := kit.Dict()
|
data := kit.Dict()
|
||||||
switch kit.Ext(ls[0]) {
|
switch kit.Ext(ls[0]) {
|
||||||
case nfs.JS:
|
case nfs.JS:
|
||||||
data[ctx.DISPLAY] = ice.FileURI(ls[0])
|
ls[0], data[ctx.DISPLAY] = kit.Select(ctx.CAN_PLUGIN, ice.GetFileCmd(ls[0])), ice.FileURI(ls[0])
|
||||||
ls[0] = kit.Select(ctx.CAN_PLUGIN, ice.GetFileCmd(ls[0]))
|
|
||||||
|
|
||||||
case nfs.GO:
|
case nfs.GO:
|
||||||
ls[0] = ice.GetFileCmd(ls[0])
|
ls[0] = ice.GetFileCmd(ls[0])
|
||||||
@ -66,12 +72,11 @@ func _website_parse(m *ice.Message, text string, args ...string) (ice.Map, bool)
|
|||||||
ls[0], data[ctx.ARGS] = "web.code.sh.py", ls[0]
|
ls[0], data[ctx.ARGS] = "web.code.sh.py", ls[0]
|
||||||
|
|
||||||
case "~":
|
case "~":
|
||||||
prefix = ls[1]
|
prefix, ls = ls[1], ls[1:]
|
||||||
ls = ls[1:]
|
|
||||||
fallthrough
|
fallthrough
|
||||||
case "-":
|
case "-":
|
||||||
for _, v := range ls[1:] {
|
for _, v := range ls[1:] {
|
||||||
last[mdb.LIST] = append(last[mdb.LIST].([]ice.Any), kit.Dict(mdb.INDEX, kit.Keys(prefix, v), "order", len(last)))
|
last[mdb.LIST] = append(last[mdb.LIST].([]ice.Any), kit.Dict(mdb.INDEX, kit.Keys(prefix, v)))
|
||||||
}
|
}
|
||||||
return ls
|
return ls
|
||||||
}
|
}
|
||||||
@ -92,8 +97,7 @@ func _website_parse(m *ice.Message, text string, args ...string) (ice.Map, bool)
|
|||||||
data[ls[i]] = kit.Split(ls[i+1])
|
data[ls[i]] = kit.Split(ls[i+1])
|
||||||
case ctx.DISPLAY:
|
case ctx.DISPLAY:
|
||||||
data[ls[i]] = ice.Display(ls[i+1])[ctx.DISPLAY]
|
data[ls[i]] = ice.Display(ls[i+1])[ctx.DISPLAY]
|
||||||
|
case ctx.STYLE, ctx.ACTION, TITLE, MENUS:
|
||||||
case "title", "menus", "action", "style":
|
|
||||||
data[ls[i]] = kit.UnMarshal(ls[i+1])
|
data[ls[i]] = kit.UnMarshal(ls[i+1])
|
||||||
default:
|
default:
|
||||||
data[ls[i]] = ls[i+1]
|
data[ls[i]] = ls[i+1]
|
||||||
@ -102,24 +106,20 @@ func _website_parse(m *ice.Message, text string, args ...string) (ice.Map, bool)
|
|||||||
|
|
||||||
switch deep {
|
switch deep {
|
||||||
case 1:
|
case 1:
|
||||||
nriver++
|
if nriver++; ls[0] == ice.AUTO {
|
||||||
nstorm = 0
|
|
||||||
storm = kit.Dict()
|
|
||||||
if ls[0] == "auto" {
|
|
||||||
ls[0] = kit.Format(nriver)
|
ls[0] = kit.Format(nriver)
|
||||||
}
|
}
|
||||||
river[ls[0]] = kit.Dict(mdb.NAME, ls[1], STORM, storm, data, "order", len(river))
|
nstorm, storm = 0, kit.Dict()
|
||||||
|
river[ls[0]] = kit.Dict(mdb.NAME, ls[1], STORM, storm, data, ORDER, len(river))
|
||||||
case 2:
|
case 2:
|
||||||
nstorm++
|
if nstorm++; ls[0] == ice.AUTO {
|
||||||
if ls[0] == "auto" {
|
|
||||||
ls[0] = kit.Format(nstorm)
|
ls[0] = kit.Format(nstorm)
|
||||||
}
|
}
|
||||||
last = kit.Dict(mdb.NAME, ls[1], mdb.LIST, kit.List(), data, "order", len(storm))
|
last = kit.Dict(mdb.NAME, ls[1], mdb.LIST, kit.List(), data, ORDER, len(storm))
|
||||||
storm[ls[0]] = last
|
storm[ls[0]] = last
|
||||||
prefix = ""
|
prefix = ""
|
||||||
default:
|
default:
|
||||||
last[mdb.LIST] = append(last[mdb.LIST].([]ice.Any),
|
last[mdb.LIST] = append(last[mdb.LIST].([]ice.Any), kit.Dict(mdb.NAME, kit.Select(ls[0], data[mdb.NAME]), mdb.HELP, ls[1], mdb.INDEX, ls[0], data))
|
||||||
kit.Dict(mdb.NAME, kit.Select(ls[0], data[mdb.NAME]), mdb.HELP, ls[1], mdb.INDEX, ls[0], "order", len(last), data))
|
|
||||||
}
|
}
|
||||||
return ls
|
return ls
|
||||||
})
|
})
|
||||||
@ -196,16 +196,16 @@ func init() {
|
|||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
"show": {Hand: func(m *ice.Message, arg ...string) {
|
lex.PARSE: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
switch kit.Ext(arg[0]) {
|
switch kit.Ext(arg[0]) {
|
||||||
case nfs.ZML:
|
|
||||||
m.RenderCmd("can.parse", m.Cmdx(nfs.CAT, path.Join(SRC_WEBSITE, arg[0])))
|
|
||||||
|
|
||||||
case nfs.IML:
|
case nfs.IML:
|
||||||
if res, ok := _website_parse(m, m.Cmdx(nfs.CAT, path.Join(SRC_WEBSITE, arg[0])), arg[1:]...); ok {
|
if res, ok := _website_parse(m, m.Cmdx(nfs.CAT, path.Join(SRC_WEBSITE, arg[0])), arg[1:]...); ok {
|
||||||
m.Echo(_website_template2, kit.Format(res))
|
m.Echo(_website_template2, kit.Format(res))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case nfs.ZML:
|
||||||
|
m.RenderCmd("can.parse", m.Cmdx(nfs.CAT, path.Join(SRC_WEBSITE, arg[0])))
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if text := m.Cmd(m.PrefixKey(), ice.PS+arg[0]).Append(mdb.TEXT); text != "" {
|
if text := m.Cmd(m.PrefixKey(), ice.PS+arg[0]).Append(mdb.TEXT); text != "" {
|
||||||
if res, ok := _website_parse(m, text, arg[1:]...); ok {
|
if res, ok := _website_parse(m, text, arg[1:]...); ok {
|
||||||
@ -214,7 +214,6 @@ func init() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
"inner": {Hand: func(m *ice.Message, arg ...string) {}},
|
|
||||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if arg[0] == mdb.FOREACH && arg[1] == "" {
|
if arg[0] == mdb.FOREACH && arg[1] == "" {
|
||||||
_website_search(m, arg[0], arg[1], kit.Select("", arg, 2))
|
_website_search(m, arg[0], arg[1], kit.Select("", arg, 2))
|
||||||
|
@ -61,18 +61,23 @@ func init() { ice.Cmd("{{.Option "key"}}", {{.Option "name"}}{}) }
|
|||||||
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, `package main
|
m.Cmd(nfs.DEFS, main, `package main
|
||||||
|
|
||||||
import "shylinux.com/x/ice"
|
import (
|
||||||
|
"shylinux.com/x/ice"
|
||||||
|
)
|
||||||
|
|
||||||
func main() { println(ice.Run()) }
|
func main() { print(ice.Run()) }
|
||||||
`)
|
`)
|
||||||
|
|
||||||
done, list := false, []string{}
|
begin, done, list := false, false, []string{}
|
||||||
m.Cmd(nfs.CAT, main, func(line string, index int) {
|
m.Cmd(nfs.CAT, main, func(line string, index int) {
|
||||||
|
if begin && !done && strings.HasPrefix(line, ")") {
|
||||||
|
done, list = true, append(list, "", kit.Format(` _ "%s/src/%s"`, mod, ctx))
|
||||||
|
}
|
||||||
if list = append(list, line); done {
|
if list = append(list, line); done {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(line, "import (") {
|
if strings.HasPrefix(line, "import (") {
|
||||||
done, list = true, append(list, kit.Format(` _ "%s/src/%s"`, mod, ctx), "")
|
begin = true
|
||||||
} else if strings.HasPrefix(line, "import") {
|
} else if strings.HasPrefix(line, "import") {
|
||||||
done, list = true, append(list, kit.Format(`import _ "%s/src/%s"`, mod, ctx))
|
done, list = true, append(list, kit.Format(`import _ "%s/src/%s"`, mod, ctx))
|
||||||
}
|
}
|
||||||
@ -87,7 +92,7 @@ field "{{.Option "help"}}" {{.Option "key"}}
|
|||||||
}
|
}
|
||||||
func _autogen_source(m *ice.Message, main, file string) {
|
func _autogen_source(m *ice.Message, main, file string) {
|
||||||
main = strings.ReplaceAll(main, ice.PT+GO, ice.PT+SHY)
|
main = strings.ReplaceAll(main, ice.PT+GO, ice.PT+SHY)
|
||||||
m.Cmd(nfs.DEFS, main, `chapter "{{.Option "name"}}"
|
m.Cmd(nfs.DEFS, main, `title "{{.Option "name"}}"
|
||||||
`)
|
`)
|
||||||
m.Cmd(nfs.PUSH, main, ice.NL, "source "+strings.TrimPrefix(file, ice.SRC+ice.PS))
|
m.Cmd(nfs.PUSH, main, ice.NL, "source "+strings.TrimPrefix(file, ice.SRC+ice.PS))
|
||||||
}
|
}
|
||||||
@ -102,9 +107,6 @@ func _autogen_mod(m *ice.Message, file string) (mod string) {
|
|||||||
m.Cmd(nfs.DEFS, file, kit.Format(`module %s
|
m.Cmd(nfs.DEFS, file, kit.Format(`module %s
|
||||||
|
|
||||||
go 1.11
|
go 1.11
|
||||||
`, host))
|
|
||||||
m.Cmd(nfs.DEFS, ice.GO_SUM, kit.Format(`
|
|
||||||
|
|
||||||
`, host))
|
`, host))
|
||||||
|
|
||||||
m.Cmd(nfs.CAT, file, func(line string) {
|
m.Cmd(nfs.CAT, file, func(line string) {
|
||||||
|
@ -188,8 +188,8 @@ func init() {
|
|||||||
m.Option("keys", list)
|
m.Option("keys", list)
|
||||||
m.Option("module", ice.Info.Make.Module)
|
m.Option("module", ice.Info.Make.Module)
|
||||||
|
|
||||||
m.Option("plug", "web.chat.website,web.dream")
|
// m.Option("plug", "web.chat.website,web.dream")
|
||||||
m.Option("exts", "inner/search.js?a=1,inner/favor.js,inner/template.js")
|
// m.Option("exts", "inner/search.js?a=1,inner/favor.js,inner/template.js")
|
||||||
|
|
||||||
arg[1] = strings.Split(arg[1], ice.FS)[0]
|
arg[1] = strings.Split(arg[1], ice.FS)[0]
|
||||||
if _inner_list(m, kit.Ext(arg[1]), arg[1], arg[0]); m.IsErrNotFound() {
|
if _inner_list(m, kit.Ext(arg[1]), arg[1], arg[0]); m.IsErrNotFound() {
|
||||||
|
@ -98,13 +98,27 @@ func init() {
|
|||||||
m.Option("httphost", fmt.Sprintf("%s://%s:%s", u.Scheme, strings.Split(u.Host, ice.DF)[0],
|
m.Option("httphost", fmt.Sprintf("%s://%s:%s", u.Scheme, strings.Split(u.Host, ice.DF)[0],
|
||||||
kit.Select(kit.Select("80", "443", u.Scheme == "https"), strings.Split(u.Host, ice.DF), 1)))
|
kit.Select(kit.Select("80", "443", u.Scheme == "https"), strings.Split(u.Host, ice.DF), 1)))
|
||||||
|
|
||||||
m.Option("remote", kit.Select(ice.Info.Make.Remote, strings.TrimSpace(m.Cmdx(cli.SYSTEM, "git", "config", "remote.origin.url"))))
|
|
||||||
m.Option("pathname", strings.TrimSuffix(path.Base(m.Option("remote")), ".git"))
|
|
||||||
|
|
||||||
if len(arg) == 0 {
|
if len(arg) == 0 {
|
||||||
arg = append(arg, ice.MISC, ice.CORE, ice.BASE)
|
arg = append(arg, ice.MISC, ice.CORE, ice.BASE)
|
||||||
}
|
}
|
||||||
for _, k := range arg {
|
for _, k := range arg {
|
||||||
|
switch k {
|
||||||
|
case ice.MISC:
|
||||||
|
if bin := path.Join(ice.USR_PUBLISH, kit.Keys("ice", runtime.GOOS, runtime.GOARCH)); !kit.FileExists(bin) {
|
||||||
|
m.Cmd(nfs.LINK, bin, m.Cmdx(cli.RUNTIME, "boot.bin"))
|
||||||
|
}
|
||||||
|
|
||||||
|
case ice.CORE:
|
||||||
|
if !kit.FileExists(".git") {
|
||||||
|
repos := m.MergeURL2("/x/" + m.Option(ice.MSG_USERPOD))
|
||||||
|
m.Cmd(cli.SYSTEM, "git", "init")
|
||||||
|
m.Cmd(cli.SYSTEM, "git", "remote", "add", "origin", repos)
|
||||||
|
m.Cmd("web.code.git.repos", mdb.CREATE, repos, "master", "", nfs.PWD)
|
||||||
|
}
|
||||||
|
m.Option("remote", kit.Select(ice.Info.Make.Remote, strings.TrimSpace(m.Cmdx(cli.SYSTEM, "git", "config", "remote.origin.url"))))
|
||||||
|
m.Option("pathname", strings.TrimSuffix(path.Base(m.Option("remote")), ".git"))
|
||||||
|
case ice.BASE:
|
||||||
|
}
|
||||||
if buf, err := kit.Render(m.Config(kit.Keys(ice.CONTEXTS, k)), m); m.Assert(err) {
|
if buf, err := kit.Render(m.Config(kit.Keys(ice.CONTEXTS, k)), m); m.Assert(err) {
|
||||||
m.EchoScript(strings.TrimSpace(string(buf)))
|
m.EchoScript(strings.TrimSpace(string(buf)))
|
||||||
}
|
}
|
||||||
@ -151,14 +165,15 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var _contexts = kit.Dict(
|
var _contexts = kit.Dict(
|
||||||
ice.MISC, `# 命令下载
|
ice.MISC, `# 下载命令
|
||||||
export ctx_dev={{.Option "httphost"}} ctx_pod={{.Option "user.pod"}}; ctx_temp=$(mktemp); wget -O $ctx_temp $ctx_dev; source $ctx_temp app
|
export ctx_dev={{.Option "httphost"}} ctx_pod={{.Option "user.pod"}}; ctx_temp=$(mktemp); curl -o $ctx_temp -fsSL $ctx_dev; source $ctx_temp app
|
||||||
|
export ctx_dev={{.Option "httphost"}} ctx_pod={{.Option "user.pod"}}; ctx_temp=$(mktemp); wget -O $ctx_temp -q $ctx_dev; source $ctx_temp app
|
||||||
`,
|
`,
|
||||||
ice.CORE, `# 源码下载
|
ice.CORE, `# 克隆源码
|
||||||
git clone {{.Option "remote"}}; cd {{.Option "pathname"}} && source etc/miss.sh port 9020
|
git clone {{.Option "remote"}}; cd {{.Option "pathname"}} && source etc/miss.sh port 9020
|
||||||
`,
|
`,
|
||||||
ice.BASE, `# 官方下载
|
ice.BASE, `# 下载工具
|
||||||
ctx_temp=$(mktemp); curl -o $ctx_temp -fsSL {{.Cmdx "spide" "shy" "url"}}; source $ctx_temp binary
|
ctx_temp=$(mktemp); curl -o $ctx_temp -fsSL {{.Cmdx "spide" "shy" "url"}}; source $ctx_temp binary
|
||||||
ctx_temp=$(mktemp); wget -O $ctx_temp {{.Cmdx "spide" "shy" "url"}}; source $ctx_temp binary
|
ctx_temp=$(mktemp); wget -O $ctx_temp -q {{.Cmdx "spide" "shy" "url"}}; source $ctx_temp binary
|
||||||
`,
|
`,
|
||||||
)
|
)
|
||||||
|
@ -177,7 +177,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
SERVER: {Name: "server path auto create import", Help: "服务器", Action: map[string]*ice.Action{
|
SERVER: {Name: "server path auto create import", Help: "服务器", Action: map[string]*ice.Action{
|
||||||
mdb.CREATE: {Name: "create name", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create name", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Option(cli.CMD_DIR, path.Join(ice.USR_LOCAL, REPOS))
|
m.Option(cli.CMD_DIR, path.Join(ice.USR_LOCAL, REPOS))
|
||||||
m.Cmdy(cli.SYSTEM, GIT, INIT, "--bare", m.Option(mdb.NAME))
|
m.Cmdy(cli.SYSTEM, GIT, INIT, "--bare", m.Option(mdb.NAME))
|
||||||
}},
|
}},
|
||||||
@ -189,11 +189,16 @@ func init() {
|
|||||||
m.Cmd(cli.SYSTEM, GIT, PUSH, "--tags", remote, MASTER)
|
m.Cmd(cli.SYSTEM, GIT, PUSH, "--tags", remote, MASTER)
|
||||||
})
|
})
|
||||||
}},
|
}},
|
||||||
|
nfs.TRASH: {Name: "trash", Help: "删除", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Assert(m.Option(nfs.PATH) != "")
|
||||||
|
m.Cmd(nfs.TRASH, path.Join(ice.USR_LOCAL_REPOS, m.Option(nfs.PATH)))
|
||||||
|
}},
|
||||||
}, Hand: func(m *ice.Message, arg ...string) {
|
}, Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Option(nfs.DIR_ROOT, path.Join(ice.USR_LOCAL, REPOS)); len(arg) == 0 {
|
if m.Option(nfs.DIR_ROOT, ice.USR_LOCAL_REPOS); len(arg) == 0 {
|
||||||
m.Cmdy(nfs.DIR, nfs.PWD).Table(func(index int, value map[string]string, head []string) {
|
m.Cmdy(nfs.DIR, nfs.PWD).Table(func(index int, value map[string]string, head []string) {
|
||||||
m.PushScript("git clone " + m.MergeLink("/x/"+strings.TrimSuffix(value[nfs.PATH], ice.PS)))
|
m.PushScript("git clone " + m.MergeLink("/x/"+strings.TrimSuffix(value[nfs.PATH], ice.PS)))
|
||||||
})
|
})
|
||||||
|
m.Cut("time,path,size,script,action")
|
||||||
m.StatusTimeCount()
|
m.StatusTimeCount()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,7 @@ func (m *Message) RenderDownload(args ...Any) *Message {
|
|||||||
return m.Render(RENDER_DOWNLOAD, args...)
|
return m.Render(RENDER_DOWNLOAD, args...)
|
||||||
}
|
}
|
||||||
func (m *Message) RenderWebsite(pod string, dir string, arg ...string) *Message {
|
func (m *Message) RenderWebsite(pod string, dir string, arg ...string) *Message {
|
||||||
m.Echo(m.Cmdx(m.Space(pod), WEBSITE, SHOW, dir, arg))
|
m.Echo(m.Cmdx(m.Space(pod), WEBSITE, "parse", dir, arg))
|
||||||
return m.RenderResult()
|
return m.RenderResult()
|
||||||
}
|
}
|
||||||
func (m *Message) RenderIndex(serve, repos string, file ...string) *Message {
|
func (m *Message) RenderIndex(serve, repos string, file ...string) *Message {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user