1
0
forked from x/icebergs

opt document

This commit is contained in:
IT 老营长 @云轩领航-创始人 2024-01-15 12:19:48 +08:00
parent 70024b0baf
commit f22a74210e
13 changed files with 114 additions and 91 deletions

View File

@ -184,7 +184,7 @@ func GetFileCmd(dir string) string {
} }
func GetCmdHelp(m *ice.Message, cmds string) (file string) { func GetCmdHelp(m *ice.Message, cmds string) (file string) {
file = strings.TrimPrefix(FileURI(kit.ExtChange(GetCmdFile(m, cmds), nfs.SHY)), "/require/") file = strings.TrimPrefix(FileURI(kit.ExtChange(GetCmdFile(m, cmds), nfs.SHY)), "/require/")
if !nfs.Exists(m, path.Join(nfs.SRC_DOCUMENT, "commands", strings.TrimPrefix(file, "usr/icebergs/")), func(p string) { file = p }) { if !nfs.Exists(m, path.Join(nfs.USR_LEARNING_PORTAL, "commands", strings.TrimPrefix(file, "usr/icebergs/")), func(p string) { file = p }) {
kit.If(!nfs.Exists(m, file), func() { file = "" }) kit.If(!nfs.Exists(m, file), func() { file = "" })
} }
return return

View File

@ -148,8 +148,8 @@ const (
USR_ICEBERGS = ice.USR_ICEBERGS USR_ICEBERGS = ice.USR_ICEBERGS
USR_LOCAL_WORK = ice.USR_LOCAL_WORK USR_LOCAL_WORK = ice.USR_LOCAL_WORK
USR_LOCAL = ice.USR_LOCAL USR_LOCAL = ice.USR_LOCAL
SRC_DOCUMENT = ice.SRC_DOCUMENT
SRC_TEMPLATE = ice.SRC_TEMPLATE SRC_TEMPLATE = ice.SRC_TEMPLATE
USR_LEARNING_PORTAL = "usr/learning/portal/"
USR_PACKAGE = "usr/package.json" USR_PACKAGE = "usr/package.json"
USR_MODULES = "usr/node_modules/" USR_MODULES = "usr/node_modules/"
REQUIRE_MODULES = "/require/modules/" REQUIRE_MODULES = "/require/modules/"

View File

@ -36,7 +36,7 @@ var DocumentText = func(m *ice.Message, p string) string {
return m.Cmdx(CAT, DocumentPath(m, path.Base(p))) return m.Cmdx(CAT, DocumentPath(m, path.Base(p)))
} }
var DocumentPath = func(m *ice.Message, arg ...string) string { var DocumentPath = func(m *ice.Message, arg ...string) string {
if p := path.Join(ice.SRC_DOCUMENT, m.PrefixKey(), path.Join(arg...)); Exists(m, p) { if p := path.Join(USR_LEARNING_PORTAL, m.PrefixKey(), path.Join(arg...)); Exists(m, p) {
return p return p
} else { } else {
return p return p

View File

@ -277,7 +277,7 @@ func init() {
} }
} }
nfs.DocumentPath = func(m *ice.Message, arg ...string) string { nfs.DocumentPath = func(m *ice.Message, arg ...string) string {
if p := path.Join(ice.SRC_DOCUMENT, m.PrefixKey(), path.Join(arg...)); nfs.Exists(m, p) { if p := path.Join(nfs.USR_LEARNING_PORTAL, m.PrefixKey(), path.Join(arg...)); nfs.Exists(m, p) {
return p + kit.Select("", nfs.PS, len(arg) == 0) return p + kit.Select("", nfs.PS, len(arg) == 0)
} else { } else {
return path.Join(path.Dir(ctx.GetCmdFile(m, m.PrefixKey())), path.Join(arg...)) + kit.Select("", nfs.PS, len(arg) == 0) return path.Join(path.Dir(ctx.GetCmdFile(m, m.PrefixKey())), path.Join(arg...)) + kit.Select("", nfs.PS, len(arg) == 0)

View File

@ -165,7 +165,7 @@ const ( // DIR
SRC_WEBVIEW_GO = "src/webview.go" SRC_WEBVIEW_GO = "src/webview.go"
SRC_VERSION_GO = "src/version.go" SRC_VERSION_GO = "src/version.go"
SRC_BINPACK_GO = "src/binpack.go" SRC_BINPACK_GO = "src/binpack.go"
SRC_DOCUMENT = "src/document/" SRC_BINPACK_USR_GO = "src/binpack_usr.go"
SRC_TEMPLATE = "src/template/" SRC_TEMPLATE = "src/template/"
SRC_SCRIPT = "src/script/" SRC_SCRIPT = "src/script/"
USR_SCRIPT = "usr/script/" USR_SCRIPT = "usr/script/"

View File

@ -66,8 +66,10 @@ func _autogen_version(m *ice.Message) string {
defer m.Cmd(REPOS, ADD, kit.Dict(nfs.REPOS, path.Base(mod), nfs.FILE, nfs.SRC)) defer m.Cmd(REPOS, ADD, kit.Dict(nfs.REPOS, path.Base(mod), nfs.FILE, nfs.SRC))
} }
m.Cmd(nfs.DEFS, ".gitignore", nfs.Template(m, "gitignore")) m.Cmd(nfs.DEFS, ".gitignore", nfs.Template(m, "gitignore"))
m.Cmd(nfs.DEFS, ice.SRC_BINPACK_USR_GO, nfs.Template(m, ice.SRC_BINPACK_GO))
m.Cmd(nfs.DEFS, ice.SRC_BINPACK_GO, nfs.Template(m, ice.SRC_BINPACK_GO)) m.Cmd(nfs.DEFS, ice.SRC_BINPACK_GO, nfs.Template(m, ice.SRC_BINPACK_GO))
m.Cmd(nfs.SAVE, ice.SRC_VERSION_GO, kit.Format(nfs.Template(m, ice.SRC_VERSION_GO), _autogen_gits(m))) m.Cmd(nfs.SAVE, ice.SRC_VERSION_GO, kit.Format(nfs.Template(m, ice.SRC_VERSION_GO), _autogen_gits(m)))
m.Cmdy(nfs.DIR, ice.SRC_BINPACK_USR_GO)
m.Cmdy(nfs.DIR, ice.SRC_BINPACK_GO) m.Cmdy(nfs.DIR, ice.SRC_BINPACK_GO)
m.Cmdy(nfs.DIR, ice.SRC_VERSION_GO) m.Cmdy(nfs.DIR, ice.SRC_VERSION_GO)
m.Cmdy(nfs.DIR, ice.SRC_MAIN_GO) m.Cmdy(nfs.DIR, ice.SRC_MAIN_GO)
@ -163,3 +165,6 @@ func init() {
}}, }},
}) })
} }
func isReleaseContexts(m *ice.Message) bool {
return nfs.Exists(m, ice.USR_RELEASE) && nfs.Exists(m, ice.USR_VOLCANOS) && nfs.Exists(m, ice.USR_INTSHELL) && ice.Info.Make.Module == "shylinux.com/x/contexts"
}

View File

@ -24,7 +24,7 @@ func _binpack_file(m *ice.Message, w io.Writer, arg ...string) {
return return
} }
switch arg[0] { switch arg[0] {
case ice.GO_MOD, ice.GO_SUM, ice.SRC_VERSION_GO, ice.SRC_BINPACK_GO: case ice.GO_MOD, ice.GO_SUM, ice.SRC_VERSION_GO, ice.SRC_BINPACK_GO, ice.SRC_BINPACK_USR_GO:
return return
case ice.ETC_LOCAL_SHY: case ice.ETC_LOCAL_SHY:
fmt.Fprintf(w, " \"%s\": \"%s\",\n", kit.Select(arg[0], arg, 1), "") fmt.Fprintf(w, " \"%s\": \"%s\",\n", kit.Select(arg[0], arg, 1), "")
@ -39,10 +39,12 @@ func _binpack_file(m *ice.Message, w io.Writer, arg ...string) {
} }
} }
func _binpack_dir(m *ice.Message, w io.Writer, dir string) { func _binpack_dir(m *ice.Message, w io.Writer, dir string) {
if nfs.Exists(m, dir) {
nfs.DirDeepAll(m, dir, nfs.PWD, func(value ice.Maps) { _binpack_file(m, w, path.Join(dir, value[nfs.PATH])) }) nfs.DirDeepAll(m, dir, nfs.PWD, func(value ice.Maps) { _binpack_file(m, w, path.Join(dir, value[nfs.PATH])) })
}
} }
func _binpack_all(m *ice.Message) { func _binpack_usr(m *ice.Message) {
w, p, e := nfs.CreateFile(m, ice.SRC_BINPACK_GO) w, p, e := nfs.CreateFile(m, ice.SRC_BINPACK_USR_GO)
m.Assert(e) m.Assert(e)
defer w.Close() defer w.Close()
defer m.Echo(p) defer m.Echo(p)
@ -50,14 +52,9 @@ func _binpack_all(m *ice.Message) {
defer fmt.Fprintln(w, nfs.Template(m, "binpack_end.go")) defer fmt.Fprintln(w, nfs.Template(m, "binpack_end.go"))
defer fmt.Fprint(w, lex.TB) defer fmt.Fprint(w, lex.TB)
nfs.OptionFiles(m, nfs.DiskFile) nfs.OptionFiles(m, nfs.DiskFile)
kit.If(isReleaseContexts(m), func() { kit.For([]string{ice.USR_VOLCANOS, nfs.USR_LEARNING_PORTAL, ice.USR_INTSHELL}, func(p string) {
kit.For([]string{ice.USR_VOLCANOS, ice.USR_INTSHELL}, func(p string) { _binpack_dir(m, w, p) }) _binpack_dir(m, w, p)
}) })
kit.For([]string{ice.SRC}, func(p string) { _binpack_dir(m, w, p) })
kit.For([]string{
ice.ETC_MISS_SH, ice.ETC_INIT_SHY, ice.ETC_LOCAL_SHY, ice.ETC_EXIT_SHY, ice.ETC_PATH,
ice.README_MD, ice.MAKEFILE, ice.LICENSE, ice.GO_MOD, ice.GO_SUM,
}, func(p string) { _binpack_file(m, w, p) })
list, cache := map[string]string{}, GoCache(m) list, cache := map[string]string{}, GoCache(m)
for k := range ice.Info.File { for k := range ice.Info.File {
switch ls := kit.Split(k, nfs.PS); ls[1] { switch ls := kit.Split(k, nfs.PS); ls[1] {
@ -72,7 +69,7 @@ func _binpack_all(m *ice.Message) {
for _, k := range kit.SortedKey(list) { for _, k := range kit.SortedKey(list) {
v := kit.Select(k, list[k]) v := kit.Select(k, list[k])
m.Cmd(nfs.DIR, nfs.PWD, nfs.PATH, kit.Dict(nfs.DIR_ROOT, v, nfs.DIR_REG, kit.ExtReg(kit.Split(mdb.Config(m, lex.EXTREG))...))).Table(func(value ice.Maps) { m.Cmd(nfs.DIR, nfs.PWD, nfs.PATH, kit.Dict(nfs.DIR_ROOT, v, nfs.DIR_REG, kit.ExtReg(kit.Split(mdb.Config(m, lex.EXTREG))...))).Table(func(value ice.Maps) {
kit.If(isReleaseContexts(m), func() { _binpack_file(m, w, kit.Path(v, value[nfs.PATH]), path.Join(k, value[nfs.PATH])) }) _binpack_file(m, w, kit.Path(v, value[nfs.PATH]), path.Join(k, value[nfs.PATH]))
}) })
} }
mdb.HashSelects(m).Sort(nfs.PATH).Table(func(value ice.Maps) { mdb.HashSelects(m).Sort(nfs.PATH).Table(func(value ice.Maps) {
@ -82,7 +79,30 @@ func _binpack_all(m *ice.Message) {
_binpack_file(m, w, value[nfs.PATH]) _binpack_file(m, w, value[nfs.PATH])
} }
}) })
kit.If(isReleaseContexts(m), func() { m.Option(nfs.DIR_REG, kit.ExtReg(nfs.SHY)); _binpack_dir(m, w, ice.USR_RELEASE) }) _binpack_dir(m.Options(nfs.DIR_REG, kit.ExtReg(nfs.SHY)), w, ice.USR_RELEASE)
}
func _binpack_src(m *ice.Message) {
w, p, e := nfs.CreateFile(m, ice.SRC_BINPACK_GO)
m.Assert(e)
defer w.Close()
defer m.Echo(p)
fmt.Fprintln(w, nfs.Template(m, ice.SRC_BINPACK_GO))
defer fmt.Fprintln(w, nfs.Template(m, "binpack_end.go"))
defer fmt.Fprint(w, lex.TB)
nfs.OptionFiles(m, nfs.DiskFile)
kit.For([]string{ice.SRC}, func(p string) { _binpack_dir(m, w, p) })
kit.For([]string{
ice.ETC_MISS_SH, ice.ETC_INIT_SHY, ice.ETC_LOCAL_SHY, ice.ETC_EXIT_SHY, ice.ETC_PATH,
ice.README_MD, ice.MAKEFILE, ice.LICENSE, ice.GO_MOD, ice.GO_SUM,
}, func(p string) { _binpack_file(m, w, p) })
mdb.HashSelects(m).Sort(nfs.PATH).Table(func(value ice.Maps) {
if strings.HasSuffix(value[nfs.PATH], nfs.PS) {
_binpack_dir(m, w, value[nfs.PATH])
} else {
_binpack_file(m, w, value[nfs.PATH])
}
})
} }
const BINPACK = "binpack" const BINPACK = "binpack"
@ -90,7 +110,10 @@ const BINPACK = "binpack"
func init() { func init() {
Index.MergeCommands(ice.Commands{ Index.MergeCommands(ice.Commands{
BINPACK: {Name: "binpack path auto create insert", Help: "打包", Actions: ice.MergeActions(ice.Actions{ BINPACK: {Name: "binpack path auto create insert", Help: "打包", Actions: ice.MergeActions(ice.Actions{
mdb.CREATE: {Name: "create path", Hand: func(m *ice.Message, arg ...string) { _binpack_all(m) }}, mdb.CREATE: {Name: "create path", Hand: func(m *ice.Message, arg ...string) {
_binpack_usr(m.Spawn())
_binpack_src(m)
}},
mdb.INSERT: {Name: "insert path*", Hand: func(m *ice.Message, arg ...string) { mdb.HashCreate(m) }}, mdb.INSERT: {Name: "insert path*", Hand: func(m *ice.Message, arg ...string) { mdb.HashCreate(m) }},
}, mdb.HashAction(mdb.SHORT, nfs.PATH, mdb.FIELD, "time,path", lex.EXTREG, "sh,shy,py,js,css,html,png,jpg"))}, }, mdb.HashAction(mdb.SHORT, nfs.PATH, mdb.FIELD, "time,path", lex.EXTREG, "sh,shy,py,js,css,html,png,jpg"))},
}) })
@ -102,6 +125,3 @@ func GoCache(m *ice.Message) string {
func() string { return ice.USR_REQUIRE }, func() string { return ice.USR_REQUIRE },
) )
} }
func isReleaseContexts(m *ice.Message) bool {
return nfs.Exists(m, ice.USR_RELEASE) && nfs.Exists(m, ice.USR_VOLCANOS) && nfs.Exists(m, ice.USR_INTSHELL) && ice.Info.Make.Module == "shylinux.com/x/contexts"
}

View File

@ -120,7 +120,7 @@ func init() {
m.Options(cli.CMD_ENV, env).Cmd(AUTOGEN, VERSION) m.Options(cli.CMD_ENV, env).Cmd(AUTOGEN, VERSION)
_compile_get(m, main) _compile_get(m, main)
defer m.StatusTime(VERSION, strings.TrimPrefix(GoVersion(m), "go version")) defer m.StatusTime(VERSION, strings.TrimPrefix(GoVersion(m), "go version"))
if msg := GoBuild(m.Spawn(), file, main, ice.SRC_VERSION_GO, ice.SRC_BINPACK_GO); !cli.IsSuccess(msg) { if msg := GoBuild(m.Spawn(), file, main, ice.SRC_VERSION_GO, ice.SRC_BINPACK_GO, ice.SRC_BINPACK_USR_GO); !cli.IsSuccess(msg) {
m.Copy(msg) m.Copy(msg)
} else { } else {
m.Logs(nfs.SAVE, nfs.TARGET, file, nfs.SOURCE, main) m.Logs(nfs.SAVE, nfs.TARGET, file, nfs.SOURCE, main)

View File

@ -129,7 +129,7 @@ func init() {
if h := kit.Select(m.Option(mdb.HASH), arg, 0); h == "" { if h := kit.Select(m.Option(mdb.HASH), arg, 0); h == "" {
cli.OpenCmds(m, "cd "+kit.Path("")) cli.OpenCmds(m, "cd "+kit.Path(""))
} else { } else {
cli.OpenCmds(m, m.Cmdv("", h, mdb.TYPE)) cli.OpenCmds(m, "cd "+kit.Path("")+"; "+m.Cmdv("", h, mdb.TYPE))
} }
m.ProcessHold() m.ProcessHold()
}}, }},
@ -154,9 +154,7 @@ func init() {
}) })
}}, }},
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) { m.PushButton(kit.Dict(m.CommandKey(), "终端")) }}, web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) { m.PushButton(kit.Dict(m.CommandKey(), "终端")) }},
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, cli.Shell(m), arg...) }},
web.DreamProcess(m, cli.Shell(m), arg...)
}},
}, chat.FavorAction(), ctx.ProcessAction(), mdb.HashAction(mdb.FIELD, "time,hash,type,name,text,path")), Hand: func(m *ice.Message, arg ...string) { }, chat.FavorAction(), ctx.ProcessAction(), mdb.HashAction(mdb.FIELD, "time,hash,type,name,text,path")), Hand: func(m *ice.Message, arg ...string) {
if mdb.HashSelect(m, arg...); len(arg) == 0 { if mdb.HashSelect(m, arg...); len(arg) == 0 {
if web.IsLocalHost(m) { if web.IsLocalHost(m) {
@ -166,7 +164,7 @@ func init() {
} }
} else { } else {
kit.If(m.Length() == 0, func() { arg[0] = m.Cmdx("", mdb.CREATE, arg); mdb.HashSelect(m, arg[0]) }) kit.If(m.Length() == 0, func() { arg[0] = m.Cmdx("", mdb.CREATE, arg); mdb.HashSelect(m, arg[0]) })
m.Push(mdb.HASH, arg[0]) m.Push(mdb.HASH, arg[0]).Action(ice.APP)
ctx.DisplayLocal(m, "") ctx.DisplayLocal(m, "")
} }
}}, }},

View File

@ -44,12 +44,12 @@ func _portal_commands(m *ice.Message, arg ...string) {
kit.If(mod != BASE, func() { cmd = strings.TrimPrefix(cmd, "web.") }) kit.If(mod != BASE, func() { cmd = strings.TrimPrefix(cmd, "web.") })
if !strings.HasPrefix(cmd, last) { if !strings.HasPrefix(cmd, last) {
last = strings.Split(cmd, nfs.PT)[0] last = strings.Split(cmd, nfs.PT)[0]
if p := path.Join(nfs.SRC_DOCUMENT, path.Join(arg...), mod, last); nfs.Exists(m, p) { if p := path.Join(nfs.USR_LEARNING_PORTAL, path.Join(arg...), mod, last); nfs.Exists(m, p) {
text = append(text, kit.Format(" %s %s/", last, last)) text = append(text, kit.Format(" %s %s/", last, last))
} }
} }
cmd = strings.TrimPrefix(cmd, last+nfs.PT) cmd = strings.TrimPrefix(cmd, last+nfs.PT)
if p := path.Join(nfs.SRC_DOCUMENT, path.Join(arg...), mod, last, strings.Replace(cmd, nfs.PT, nfs.PS, -1)+".shy"); nfs.Exists(m, p) { if p := path.Join(nfs.USR_LEARNING_PORTAL, path.Join(arg...), mod, last, strings.Replace(cmd, nfs.PT, nfs.PS, -1)+".shy"); nfs.Exists(m, p) {
text = append(text, kit.Format(" %s %s.shy", cmd, cmd)) text = append(text, kit.Format(" %s %s.shy", cmd, cmd))
} else if p, ok := help[last+nfs.PT+cmd]; ok { } else if p, ok := help[last+nfs.PT+cmd]; ok {
text = append(text, kit.Format(" %s %s", cmd, strings.TrimPrefix(ctx.FileURI(p), "/require/"))) text = append(text, kit.Format(" %s %s", cmd, strings.TrimPrefix(ctx.FileURI(p), "/require/")))
@ -57,7 +57,7 @@ func _portal_commands(m *ice.Message, arg ...string) {
} }
} }
text = append(text, "`") text = append(text, "`")
m.Cmd(nfs.SAVE, path.Join(nfs.SRC_DOCUMENT, path.Join(arg...), INDEX_SHY), strings.Join(text, lex.NL)) m.Cmd(nfs.SAVE, path.Join(nfs.USR_LEARNING_PORTAL, path.Join(arg...), INDEX_SHY), strings.Join(text, lex.NL))
} }
const ( const (
@ -83,9 +83,9 @@ func init() {
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) { m.PushButton(kit.Dict(PORTAL, "官网")) }}, web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) { m.PushButton(kit.Dict(PORTAL, "官网")) }},
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, nil, arg...) }}, web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, nil, arg...) }},
}, aaa.WhiteAction("")), Hand: func(m *ice.Message, arg ...string) { }, aaa.WhiteAction("")), Hand: func(m *ice.Message, arg ...string) {
if m.Push(HEADER, m.Cmdx(WORD, path.Join(nfs.SRC_DOCUMENT, INDEX_SHY))); len(arg) > 0 { if m.Push(HEADER, m.Cmdx(WORD, path.Join(nfs.USR_LEARNING_PORTAL, INDEX_SHY))); len(arg) > 0 {
kit.If(path.Join(arg...) == "commands", func() { _portal_commands(m, arg...) }) kit.If(path.Join(arg...) == "commands", func() { _portal_commands(m, arg...) })
m.Push(NAV, m.Cmdx(WORD, path.Join(nfs.SRC_DOCUMENT, path.Join(arg...), INDEX_SHY))) m.Push(NAV, m.Cmdx(WORD, path.Join(nfs.USR_LEARNING_PORTAL, path.Join(arg...), INDEX_SHY)))
} }
m.Display("") m.Display("")
}}, }},

View File

@ -36,8 +36,8 @@ Volcanos(chat.ONIMPORT, {
can.page.Select(can, target, html.DIV_ITEM, function(target) { target != event.target && can.page.ClassList.del(can, target, html.SELECT) }) can.page.Select(can, target, html.DIV_ITEM, function(target) { target != event.target && can.page.ClassList.del(can, target, html.SELECT) })
item.list && item.list.length > 0 || can.onaction.route(event, can, item.meta.link) item.list && item.list.length > 0 || can.onaction.route(event, can, item.meta.link)
}, target, can.page.ClassList.has(can, target.parentNode, html.HEADER)? function(target, item) { }, target, can.page.ClassList.has(can, target.parentNode, html.HEADER)? function(target, item) {
item.meta.link == nfs.SRC_DOCUMENT+can.db.current && can.onappend.style(can, html.SELECT, target) item.meta.link == nfs.USR_LEARNING_PORTAL+can.db.current && can.onappend.style(can, html.SELECT, target)
}: function(target, item) { can.db.nav[can.base.trimPrefix(item.meta.link, nfs.SRC_DOCUMENT)] = target }: function(target, item) { can.db.nav[can.base.trimPrefix(item.meta.link, nfs.USR_LEARNING_PORTAL)] = target
location.hash || item.list && item.list.length > 0 || link || (link = can.onaction.route({}, can, item.meta.link, true)) location.hash || item.list && item.list.length > 0 || link || (link = can.onaction.route({}, can, item.meta.link, true))
}) })
}, },
@ -45,7 +45,7 @@ Volcanos(chat.ONIMPORT, {
target.onclick = function(event) { can.onaction.route(event, can, item.route) } target.onclick = function(event) { can.onaction.route(event, can, item.route) }
}, },
content: function(can, file) { content: function(can, file) {
can.runActionCommand(event, web.WIKI_WORD, [(can.base.beginWith(file, nfs.USR, nfs.SRC)? "": nfs.SRC_DOCUMENT+can.db.current)+file], function(msg) { can.ui.main.innerHTML = msg.Result(), can.onmotion.clear(can, can.ui.aside) can.runActionCommand(event, web.WIKI_WORD, [(can.base.beginWith(file, nfs.USR, nfs.SRC)? "": nfs.USR_LEARNING_PORTAL+can.db.current)+file], function(msg) { can.ui.main.innerHTML = msg.Result(), can.onmotion.clear(can, can.ui.aside)
can.onimport._content(can, can.ui.main, function(target, meta) { can.onimport._content(can, can.ui.main, function(target, meta) {
meta.type == wiki.TITLE && can.onappend.style(can, meta.name, target._menu = can.onimport.item(can, {name: meta.text}, function(event) { target.scrollIntoView() }, function() {}, can.ui.aside)) meta.type == wiki.TITLE && can.onappend.style(can, meta.name, target._menu = can.onimport.item(can, {name: meta.text}, function(event) { target.scrollIntoView() }, function() {}, can.ui.aside))
}), can.onmotion.select(can, can.ui.aside, html.DIV_ITEM, 0) }), can.onmotion.select(can, can.ui.aside, html.DIV_ITEM, 0)
@ -64,7 +64,7 @@ Volcanos(chat.ONIMPORT, {
}, [""]) }, [""])
Volcanos(chat.ONACTION, { Volcanos(chat.ONACTION, {
route: function(event, can, route, internal) { route: function(event, can, route, internal) {
var link = can.base.trimPrefix(route||"", nfs.SRC_DOCUMENT); if (!link || link == can.db.current) { return } var link = can.base.trimPrefix(route||"", nfs.USR_LEARNING_PORTAL); if (!link || link == can.db.current) { return }
if (!internal) { var params = ""; (can.misc.Search(can, log.DEBUG) == ice.TRUE && (params = "?debug=true")) if (!internal) { var params = ""; (can.misc.Search(can, log.DEBUG) == ice.TRUE && (params = "?debug=true"))
if (link == nfs.PS) { return can.isCmdMode()? can.user.jumps(can.db.prefix+params): (can.Option(nfs.PATH, ""), can.Update()) } if (link == nfs.PS) { return can.isCmdMode()? can.user.jumps(can.db.prefix+params): (can.Option(nfs.PATH, ""), can.Update()) }
if (can.base.beginWith(link, web.HTTP, nfs.PS)) { return can.user.opens(link) } if (can.base.beginWith(link, web.HTTP, nfs.PS)) { return can.user.opens(link) }

View File

@ -54,12 +54,12 @@ func init() {
_wiki_list(msg, nfs.SRC) _wiki_list(msg, nfs.SRC)
_wiki_list(msg, nfs.USR_ICEBERGS) _wiki_list(msg, nfs.USR_ICEBERGS)
msg.Table(func(value ice.Maps) { msg.Table(func(value ice.Maps) {
if !kit.HasPrefix(value[nfs.PATH], nfs.SRC_TEMPLATE, nfs.SRC_DOCUMENT) { if !kit.HasPrefix(value[nfs.PATH], nfs.SRC_TEMPLATE, nfs.USR_LEARNING_PORTAL) {
m.Push("", value, kit.Split("path,size,time")) m.Push("", value, kit.Split("path,size,time"))
} }
}) })
web.PushPodCmd(m.Spawn(), "").Table(func(value ice.Maps) { web.PushPodCmd(m.Spawn(), "").Table(func(value ice.Maps) {
if !kit.HasPrefix(value[nfs.PATH], nfs.SRC_TEMPLATE, nfs.SRC_DOCUMENT) { if !kit.HasPrefix(value[nfs.PATH], nfs.SRC_TEMPLATE, nfs.USR_LEARNING_PORTAL) {
value[nfs.PATH] = value[web.SPACE] + nfs.DF + value[nfs.PATH] value[nfs.PATH] = value[web.SPACE] + nfs.DF + value[nfs.PATH]
m.Push("", value, kit.Split("path,size,time")) m.Push("", value, kit.Split("path,size,time"))
} }
@ -76,7 +76,7 @@ func init() {
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) { m.PushButton(kit.Dict(m.CommandKey(), "文档")) }}, web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) { m.PushButton(kit.Dict(m.CommandKey(), "文档")) }},
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, nil, arg...) }}, web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, nil, arg...) }},
}, WikiAction("", nfs.SHY), mdb.HashAction(mdb.SHORT, nfs.PATH, mdb.FIELD, "time,path")), Hand: func(m *ice.Message, arg ...string) { }, WikiAction("", nfs.SHY), mdb.HashAction(mdb.SHORT, nfs.PATH, mdb.FIELD, "time,path")), Hand: func(m *ice.Message, arg ...string) {
if len(arg) > 0 && !strings.HasPrefix(arg[0], nfs.SRC_DOCUMENT) { if len(arg) > 0 && !strings.HasPrefix(arg[0], nfs.USR_LEARNING_PORTAL) {
mdb.HashCreate(m.Spawn(), nfs.PATH, arg[0]) mdb.HashCreate(m.Spawn(), nfs.PATH, arg[0])
} }
if len(arg) > 0 && strings.Contains(arg[0], nfs.DF) { if len(arg) > 0 && strings.Contains(arg[0], nfs.DF) {

View File

@ -232,7 +232,7 @@ func _repos_status(m *ice.Message, p string, repos *git.Repository) error {
return err return err
} }
for k, v := range status { for k, v := range status {
if kit.IsIn(k, ice.SRC_VERSION_GO, ice.SRC_BINPACK_GO, ice.ETC_LOCAL_SHY) { if kit.IsIn(k, ice.SRC_VERSION_GO, ice.SRC_BINPACK_GO, ice.SRC_BINPACK_USR_GO, ice.ETC_LOCAL_SHY) {
continue continue
} else if kit.IsIn(kit.Ext(k), "swp", "swo") || kit.HasPrefix(k, nfs.BIN, nfs.VAR, nfs.USR) && !strings.HasPrefix(k, ice.USR_LOCAL_EXPORT) { } else if kit.IsIn(kit.Ext(k), "swp", "swo") || kit.HasPrefix(k, nfs.BIN, nfs.VAR, nfs.USR) && !strings.HasPrefix(k, ice.USR_LOCAL_EXPORT) {
continue continue