forked from x/icebergs
opt river
This commit is contained in:
parent
01432f4699
commit
c9b0addd91
@ -1,13 +1,13 @@
|
||||
package chat
|
||||
|
||||
import (
|
||||
"github.com/shylinux/icebergs"
|
||||
ice "github.com/shylinux/icebergs"
|
||||
"github.com/shylinux/icebergs/base/aaa"
|
||||
"github.com/shylinux/icebergs/base/ctx"
|
||||
"github.com/shylinux/icebergs/base/gdb"
|
||||
"github.com/shylinux/icebergs/base/mdb"
|
||||
"github.com/shylinux/icebergs/base/web"
|
||||
"github.com/shylinux/toolkits"
|
||||
kit "github.com/shylinux/toolkits"
|
||||
|
||||
"strings"
|
||||
)
|
||||
@ -121,7 +121,12 @@ var Index = &ice.Context{Name: "chat", Help: "聊天中心",
|
||||
arg = arg[1:]
|
||||
}
|
||||
case "/river":
|
||||
arg = arg[1:]
|
||||
if len(arg) > 0 {
|
||||
arg = arg[1:]
|
||||
}
|
||||
if len(arg) > 1 && arg[1] == "storm" {
|
||||
arg = arg[1:]
|
||||
}
|
||||
}
|
||||
m.Optionv(ice.MSG_CMDS, arg)
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
package chat
|
||||
|
||||
import (
|
||||
"github.com/shylinux/icebergs"
|
||||
ice "github.com/shylinux/icebergs"
|
||||
"github.com/shylinux/icebergs/base/aaa"
|
||||
"github.com/shylinux/icebergs/base/cli"
|
||||
"github.com/shylinux/icebergs/base/mdb"
|
||||
"github.com/shylinux/icebergs/base/web"
|
||||
"github.com/shylinux/toolkits"
|
||||
kit "github.com/shylinux/toolkits"
|
||||
)
|
||||
|
||||
func _river_list(m *ice.Message) {
|
||||
@ -122,8 +122,8 @@ func init() {
|
||||
_river_user(m, m.Option(ice.MSG_RIVER), arg...)
|
||||
}},
|
||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
if len(arg) > 0 {
|
||||
_storm_list(m, arg[0])
|
||||
if len(arg) > 0 && arg[0] == "storm" {
|
||||
m.Cmdy("/storm", arg[1:])
|
||||
return
|
||||
}
|
||||
_river_list(m)
|
||||
|
@ -1,11 +1,15 @@
|
||||
package code
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
ice "github.com/shylinux/icebergs"
|
||||
"github.com/shylinux/icebergs/base/cli"
|
||||
"github.com/shylinux/icebergs/base/mdb"
|
||||
"github.com/shylinux/icebergs/base/web"
|
||||
kit "github.com/shylinux/toolkits"
|
||||
)
|
||||
|
||||
@ -22,13 +26,40 @@ func _js_find(m *ice.Message, key string) {
|
||||
func _js_grep(m *ice.Message, key string) {
|
||||
m.Split(m.Cmd(cli.SYSTEM, "grep", "--exclude-dir=.git", "--exclude=.[a-z]*", "-rn", key, ".").Append(cli.CMD_OUT), "file:line:text", ":", "\n")
|
||||
}
|
||||
|
||||
const JS = "js"
|
||||
const NODE = "node"
|
||||
|
||||
func init() {
|
||||
Index.Register(&ice.Context{Name: "js", Help: "js",
|
||||
Index.Register(&ice.Context{Name: JS, Help: "js",
|
||||
Configs: map[string]*ice.Config{
|
||||
NODE: {Name: NODE, Help: "服务器", Value: kit.Data(
|
||||
"source", "https://nodejs.org/dist/v10.13.0/node-v10.13.0-linux-x64.tar.xz",
|
||||
)},
|
||||
},
|
||||
Commands: map[string]*ice.Command{
|
||||
ice.CTX_INIT: {Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
m.Cmd(mdb.SEARCH, mdb.CREATE, "js", "js", c.Cap(ice.CTX_FOLLOW))
|
||||
m.Cmd(mdb.SEARCH, mdb.CREATE, JS, JS, c.Cap(ice.CTX_FOLLOW))
|
||||
}},
|
||||
"js": {Name: "js", Help: "js", Action: map[string]*ice.Action{
|
||||
NODE: {Name: NODE, Help: "node", Action: map[string]*ice.Action{
|
||||
"install": {Name: "install", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
|
||||
// 下载
|
||||
source := m.Conf(NODE, "meta.source")
|
||||
p := path.Join(m.Conf("web.code._install", "meta.path"), path.Base(source))
|
||||
if _, e := os.Stat(p); e != nil {
|
||||
msg := m.Cmd(web.SPIDE, "dev", web.CACHE, http.MethodGet, source)
|
||||
m.Cmd(web.CACHE, web.WATCH, msg.Append(web.DATA), p)
|
||||
}
|
||||
|
||||
// 解压
|
||||
m.Option(cli.CMD_DIR, m.Conf("web.code._install", "meta.path"))
|
||||
m.Cmd(cli.SYSTEM, "tar", "xvf", path.Base(source))
|
||||
m.Echo(p)
|
||||
}},
|
||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||
|
||||
}},
|
||||
JS: {Name: JS, Help: "js", Action: map[string]*ice.Action{
|
||||
mdb.SEARCH: {Hand: func(m *ice.Message, arg ...string) {
|
||||
m.Option(cli.CMD_DIR, m.Option("_path"))
|
||||
_js_find(m, kit.Select("main", arg, 1))
|
||||
|
@ -97,7 +97,7 @@ const (
|
||||
var Index = &ice.Context{Name: "alpha", Help: "英汉词典",
|
||||
Configs: map[string]*ice.Config{
|
||||
ALPHA: {Name: "alpha", Help: "英汉词典", Value: kit.Data(
|
||||
kit.MDB_STORE, "usr/export", kit.MDB_FSIZE, "2000000",
|
||||
kit.MDB_STORE, "usr/export/alpha", kit.MDB_FSIZE, "2000000",
|
||||
kit.MDB_LIMIT, "50000", kit.MDB_LEAST, "1000",
|
||||
"repos", "word-dict", "local", "person",
|
||||
"field", []interface{}{"audio", "bnc", "collins", "definition", "detail", "exchange", "frq", "id", "oxford", "phonetic", "pos", "tag", "time", "translation", "word"},
|
||||
|
Loading…
x
Reference in New Issue
Block a user