mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 01:24:05 +08:00
opt wiki
This commit is contained in:
parent
c33ddf4795
commit
2f77add671
@ -10,6 +10,7 @@ import (
|
||||
"shylinux.com/x/icebergs/base/aaa"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/gdb"
|
||||
"shylinux.com/x/icebergs/base/lex"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
@ -153,10 +154,20 @@ func init() {
|
||||
m.Echo("%d", runtime.GOMAXPROCS(0))
|
||||
}},
|
||||
API: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) > 1 {
|
||||
m.Cmdy(ctx.COMMAND, "web.code.inner").Push(ctx.ARGS, kit.Format(nfs.SplitPath(m, strings.TrimPrefix(m.Option(nfs.FILE), "/require/"))))
|
||||
return
|
||||
}
|
||||
ctx.DisplayStorySpide(m.Options(nfs.DIR_ROOT, nfs.PS), lex.PREFIX, kit.Fields(ctx.ACTION, m.ActionKey()))
|
||||
kit.For(ice.Info.Route, func(k, v string) { m.Push(nfs.PATH, k).Push(nfs.FILE, v) })
|
||||
m.StatusTimeCount().Sort(nfs.PATH)
|
||||
}},
|
||||
CLI: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) > 1 {
|
||||
m.Cmdy(ctx.COMMAND, "web.code.inner").Push(ctx.ARGS, kit.Format(nfs.SplitPath(m, strings.TrimPrefix(m.Option(nfs.FILE), "/require/"))))
|
||||
return
|
||||
}
|
||||
ctx.DisplayStorySpide(m.Options(nfs.DIR_ROOT, "ice."), lex.PREFIX, kit.Fields(ctx.ACTION, m.ActionKey()), mdb.FIELD, mdb.NAME, lex.SPLIT, nfs.PT)
|
||||
kit.For(ice.Info.File, func(k, v string) { m.Push(nfs.FILE, k).Push(mdb.NAME, v) })
|
||||
m.StatusTimeCount().Sort(nfs.FILE)
|
||||
}},
|
||||
@ -181,7 +192,7 @@ func init() {
|
||||
kit.For(_path_split(os.Getenv(PATH)), func(p string) { m.Push(nfs.PATH, p) })
|
||||
}},
|
||||
"chain": {Hand: func(m *ice.Message, arg ...string) { m.Echo(m.FormatChain()) }},
|
||||
}, ctx.ConfAction("")), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, ctx.CmdAction(), ctx.ConfAction("")), Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.If(len(arg) > 0 && arg[0] == BOOTINFO, func() { arg = arg[1:] })
|
||||
m.Cmdy(ctx.CONFIG, RUNTIME, arg)
|
||||
ctx.DisplayStoryJSON(m)
|
||||
|
@ -65,7 +65,7 @@ func init() {
|
||||
})
|
||||
}},
|
||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
if arg[0] == m.CommandKey() || arg[1] != "" {
|
||||
if arg[0] == m.CommandKey() || len(arg) > 1 && arg[1] != "" {
|
||||
_command_search(m, arg[0], kit.Select("", arg, 1), kit.Select("", arg, 2))
|
||||
}
|
||||
}},
|
||||
@ -74,7 +74,12 @@ func init() {
|
||||
m.Echo(`%s %s %s;" f`+ice.NL, value[mdb.NAME], value[nfs.FILE], value[nfs.LINE])
|
||||
}).Cmd(nfs.SAVE, nfs.TAGS, m.Result())
|
||||
}},
|
||||
}, aaa.RoleAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
}, CmdAction(), aaa.RoleAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
if len(arg) == 0 {
|
||||
m.Cmdy("", mdb.SEARCH, COMMAND, ice.OptionFields(INDEX))
|
||||
DisplayStory(m.Options(nfs.DIR_ROOT, "ice."), "spide.js?split=.")
|
||||
return
|
||||
}
|
||||
kit.If(len(arg) == 0, func() { arg = append(arg, "") })
|
||||
kit.For(arg, func(k string) { _command_list(m, k) })
|
||||
}},
|
||||
|
@ -20,7 +20,7 @@ func init() {
|
||||
Index.MergeCommands(ice.Commands{
|
||||
DEBUG: {Name: "debug level=error,bench,debug,error,watch offset limit filter auto reset doc", Help: "后台日志", Actions: ice.Actions{
|
||||
"doc": {Help: "文档", Hand: func(m *ice.Message, arg ...string) { m.ProcessOpen("https://pkg.go.dev/std") }},
|
||||
"reset": {Help: "文档", Hand: func(m *ice.Message, arg ...string) {
|
||||
"reset": {Help: "重置", Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Cmd(nfs.CAT, _debug_file(arg[0]), func(line string, index int) { m.ProcessRewrite(mdb.OFFSET, index+2, mdb.LIMIT, 1000) })
|
||||
}},
|
||||
}, Hand: func(m *ice.Message, arg ...string) {
|
||||
|
@ -115,9 +115,6 @@ func _serve_auth(m *ice.Message, key string, cmds []string, w http.ResponseWrite
|
||||
if r.URL.Path == PP(SPACE) {
|
||||
return cmds, true
|
||||
}
|
||||
kit.For(r.Header, func(k string, v []string) {
|
||||
m.Debug("what %v: %v", k, v)
|
||||
})
|
||||
defer func() { m.Options(ice.MSG_CMDS, "", ice.MSG_SESSID, "") }()
|
||||
if aaa.SessCheck(m, m.Option(ice.MSG_SESSID)); m.Option(SHARE) != "" {
|
||||
switch msg := m.Cmd(SHARE, m.Option(SHARE)); msg.Append(mdb.TYPE) {
|
||||
|
@ -4,12 +4,14 @@ import (
|
||||
"net"
|
||||
"net/http"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
ice "shylinux.com/x/icebergs"
|
||||
"shylinux.com/x/icebergs/base/cli"
|
||||
"shylinux.com/x/icebergs/base/ctx"
|
||||
"shylinux.com/x/icebergs/base/gdb"
|
||||
"shylinux.com/x/icebergs/base/mdb"
|
||||
"shylinux.com/x/icebergs/base/nfs"
|
||||
"shylinux.com/x/icebergs/base/tcp"
|
||||
kit "shylinux.com/x/toolkits"
|
||||
"shylinux.com/x/toolkits/logs"
|
||||
@ -47,7 +49,7 @@ func (f *Frame) Start(m *ice.Message, arg ...string) {
|
||||
f.HandleFunc(key, func(w http.ResponseWriter, r *http.Request) {
|
||||
m.TryCatch(m.Spawn(key, cmd, c, w, r), true, func(msg *ice.Message) { _serve_handle(key, cmd, msg, w, r) })
|
||||
})
|
||||
ice.Info.Route[path.Join(list[c], key)] = ctx.FileURI(cmd.FileLine())
|
||||
ice.Info.Route[path.Join(list[c], key)+kit.Select("", nfs.PS, strings.HasSuffix(key, nfs.PS))] = ctx.FileURI(cmd.FileLine())
|
||||
}(key, cmd)
|
||||
}
|
||||
})
|
||||
|
@ -173,7 +173,7 @@ func init() {
|
||||
}, mdb.HashAction(mdb.SHORT, nfs.PATH, mdb.FIELD, "time,path"), web.DreamAction(), aaa.RoleAction(ctx.COMMAND)), Hand: func(m *ice.Message, arg ...string) {
|
||||
if m.Cmdy(INNER, arg); arg[0] != ctx.ACTION {
|
||||
kit.If(len(arg) > 1, func() { mdb.HashCreate(m.Spawn(), nfs.PATH, path.Join(kit.Slice(arg, 0, 2)...)) })
|
||||
m.Action(nfs.MODULE, nfs.SCRIPT, nfs.SAVE, COMPILE)
|
||||
m.Action(nfs.MODULE, nfs.SCRIPT, nfs.SAVE, COMPILE, "show", "exec")
|
||||
ctx.DisplayLocal(m, "")
|
||||
}
|
||||
}},
|
||||
|
@ -23,7 +23,10 @@ func init() {
|
||||
m.Cmdy(nfs.CAT, path.Join(arg[2], arg[1]))
|
||||
}},
|
||||
}, WikiAction("", nfs.SVG), ctx.CmdAction()), Hand: func(m *ice.Message, arg ...string) {
|
||||
kit.If(!_wiki_list(m, arg...), func() { _wiki_show(m, arg[0]) })
|
||||
kit.If(!_wiki_list(m, arg...), func() {
|
||||
_wiki_show(m, arg[0])
|
||||
kit.If(m.IsErr(), func() { m.Option(ice.MSG_OUTPUT, "") })
|
||||
})
|
||||
}},
|
||||
})
|
||||
}
|
||||
|
@ -72,7 +72,9 @@ func WikiAction(dir string, ext ...string) ice.Actions {
|
||||
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
nfs.Trash(m, _wiki_path(m, kit.Select("some", kit.Select(m.Option(nfs.PATH), arg, 0))))
|
||||
}},
|
||||
nfs.SAVE: {Hand: func(m *ice.Message, arg ...string) { _wiki_save(m, m.Option(nfs.PATH), m.Option(mdb.TEXT)) }},
|
||||
nfs.SAVE: {Hand: func(m *ice.Message, arg ...string) {
|
||||
_wiki_save(m, m.Option(nfs.PATH), kit.Select(m.Option(mdb.TEXT), arg, 1))
|
||||
}},
|
||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||
switch arg[0] {
|
||||
case nfs.PATH:
|
||||
|
@ -57,6 +57,9 @@ func init() {
|
||||
m.Push(cli.COLOR, color[strings.Count(value[nfs.PATH], ice.PS)%len(color)])
|
||||
m.Push("", value, []string{nfs.PATH})
|
||||
}, nfs.PATH)
|
||||
m.Option(nfs.DIR_ROOT, _repos_path(arg[0]))
|
||||
} else if len(arg) == 2 {
|
||||
|
||||
}
|
||||
}},
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user