mirror of
https://shylinux.com/x/icebergs
synced 2025-05-04 04:17:01 +08:00
opt some
This commit is contained in:
parent
43eb1d541b
commit
e120cc524d
@ -38,8 +38,8 @@ func _user_search(m *ice.Message, kind, name, text string, arg ...string) {
|
|||||||
if name != "" && name != val[USERNAME] {
|
if name != "" && name != val[USERNAME] {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
m.PushSearch("cmd", USER, "type", kit.Format(UserRole(m, val[USERNAME])),
|
m.PushSearch(kit.SSH_CMD, USER, kit.MDB_TYPE, kit.Format(UserRole(m, val[USERNAME])),
|
||||||
"name", kit.Format(val[USERNICK]), "text", kit.Format(val[USERNAME]))
|
kit.MDB_NAME, kit.Format(val[USERNICK]), kit.MDB_TEXT, kit.Format(val[USERNAME]), val)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ func _cli_progress(m *ice.Message, cb interface{}) {
|
|||||||
switch cb := cb.(type) {
|
switch cb := cb.(type) {
|
||||||
case func(cb func(name string, count, total int)):
|
case func(cb func(name string, count, total int)):
|
||||||
cb(func(name string, count, total int) {
|
cb(func(name string, count, total int) {
|
||||||
|
m.Debug("what %v", name)
|
||||||
m.Cmd(mdb.MODIFY, PROGRESS, "", mdb.HASH, kit.MDB_HASH, h, "name", name,
|
m.Cmd(mdb.MODIFY, PROGRESS, "", mdb.HASH, kit.MDB_HASH, h, "name", name,
|
||||||
"step", count*100/total, "count", count, "total", total)
|
"step", count*100/total, "count", count, "total", total)
|
||||||
})
|
})
|
||||||
|
@ -22,7 +22,10 @@ func _command_search(m *ice.Message, kind, name, text string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
m.PushSearch(kit.SSH_CMD, COMMAND, kit.MDB_TYPE, kind, kit.MDB_NAME, key, kit.MDB_TEXT, s.Cap(ice.CTX_FOLLOW))
|
m.PushSearch(kit.SSH_CMD, COMMAND,
|
||||||
|
"context", s.Cap(ice.CTX_FOLLOW), "command", key,
|
||||||
|
kit.MDB_TYPE, kind, kit.MDB_NAME, key, kit.MDB_TEXT, s.Cap(ice.CTX_FOLLOW),
|
||||||
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
func _command_list(m *ice.Message, name string) {
|
func _command_list(m *ice.Message, name string) {
|
||||||
|
@ -27,7 +27,7 @@ func init() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
m.Option(FIELDS, kit.Select("pod,ctx,cmd,time,size,type,name,text", kit.Select(m.Option(FIELDS), arg, 2)))
|
m.Option(FIELDS, kit.Select("ctx,cmd,time,size,type,name,text", kit.Select(m.Option(FIELDS), arg, 2)))
|
||||||
for _, k := range strings.Split(arg[0], ",") {
|
for _, k := range strings.Split(arg[0], ",") {
|
||||||
for _, kk := range strings.Split(arg[1], ",") {
|
for _, kk := range strings.Split(arg[1], ",") {
|
||||||
m.Richs(SEARCH, nil, k, func(key string, value map[string]interface{}) {
|
m.Richs(SEARCH, nil, k, func(key string, value map[string]interface{}) {
|
||||||
|
@ -33,6 +33,7 @@ func _dream_show(m *ice.Message, name string) {
|
|||||||
if !strings.Contains(name, "-") || !strings.HasPrefix(name, "20") {
|
if !strings.Contains(name, "-") || !strings.HasPrefix(name, "20") {
|
||||||
name = m.Time("20060102-") + strings.ReplaceAll(name, "-", "_")
|
name = m.Time("20060102-") + strings.ReplaceAll(name, "-", "_")
|
||||||
}
|
}
|
||||||
|
m.Option("name", name)
|
||||||
|
|
||||||
// 任务目录
|
// 任务目录
|
||||||
p := path.Join(m.Conf(DREAM, kit.META_PATH), name)
|
p := path.Join(m.Conf(DREAM, kit.META_PATH), name)
|
||||||
@ -100,6 +101,9 @@ func init() {
|
|||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case kit.MDB_NAME:
|
case kit.MDB_NAME:
|
||||||
m.Cmdy(nfs.DIR, m.Conf(DREAM, kit.META_PATH), "name,time")
|
m.Cmdy(nfs.DIR, m.Conf(DREAM, kit.META_PATH), "name,time")
|
||||||
|
case kit.SSH_TEMPLATE:
|
||||||
|
m.Cmdy(nfs.DIR, m.Conf(DREAM, kit.META_PATH), "path,size,time")
|
||||||
|
m.SortStrR(kit.MDB_PATH)
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
mdb.CREATE: {Name: "create main=src/main.go@key name=hi@key from=usr/icebergs/misc/bash/bash.go@key", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create main=src/main.go@key name=hi@key from=usr/icebergs/misc/bash/bash.go@key", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
@ -29,6 +29,16 @@ func init() {
|
|||||||
m.Echo(m.Option(ice.MSG_USERNAME))
|
m.Echo(m.Option(ice.MSG_USERNAME))
|
||||||
}},
|
}},
|
||||||
CHECK: {Name: "check", Help: "登录检查", Hand: func(m *ice.Message, arg ...string) {
|
CHECK: {Name: "check", Help: "登录检查", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
if m.Option(web.SHARE) != "" {
|
||||||
|
switch msg := m.Cmd(web.SHARE, m.Option(web.SHARE)); msg.Append(kit.MDB_TYPE) {
|
||||||
|
case web.LOGIN:
|
||||||
|
if m.Option(ice.MSG_SESSID) == "" {
|
||||||
|
m.Option(ice.MSG_SESSID, aaa.SessCreate(m, msg.Append(aaa.USERNAME), msg.Append(aaa.USERROLE)))
|
||||||
|
web.Render(m, web.COOKIE, m.Option(ice.MSG_SESSID))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m.Option("sso", m.Conf(web.SERVE, "meta.sso"))
|
m.Option("sso", m.Conf(web.SERVE, "meta.sso"))
|
||||||
m.Echo(m.Option(ice.MSG_USERNAME))
|
m.Echo(m.Option(ice.MSG_USERNAME))
|
||||||
}},
|
}},
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"github.com/shylinux/icebergs/base/aaa"
|
"github.com/shylinux/icebergs/base/aaa"
|
||||||
"github.com/shylinux/icebergs/base/ctx"
|
"github.com/shylinux/icebergs/base/ctx"
|
||||||
"github.com/shylinux/icebergs/base/mdb"
|
"github.com/shylinux/icebergs/base/mdb"
|
||||||
|
"github.com/shylinux/icebergs/base/tcp"
|
||||||
"github.com/shylinux/icebergs/base/web"
|
"github.com/shylinux/icebergs/base/web"
|
||||||
"github.com/shylinux/icebergs/core/code"
|
"github.com/shylinux/icebergs/core/code"
|
||||||
"github.com/shylinux/icebergs/core/wiki"
|
"github.com/shylinux/icebergs/core/wiki"
|
||||||
@ -314,6 +315,12 @@ func init() {
|
|||||||
m.EchoAnchor(m.Option(ice.MSG_USERWEB))
|
m.EchoAnchor(m.Option(ice.MSG_USERWEB))
|
||||||
}},
|
}},
|
||||||
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 m.Option("action") {
|
||||||
|
case "start":
|
||||||
|
m.Cmdy(web.DREAM, kit.MDB_ACTION, mdb.INPUTS, arg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
switch arg[0] {
|
switch arg[0] {
|
||||||
case aaa.USERNAME:
|
case aaa.USERNAME:
|
||||||
m.Cmdy(aaa.USER)
|
m.Cmdy(aaa.USER)
|
||||||
@ -329,7 +336,10 @@ func init() {
|
|||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
web.SHARE: {Name: "share type name", Help: "共享", Hand: func(m *ice.Message, arg ...string) {
|
web.SHARE: {Name: "share type name", Help: "共享", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(web.SHARE, mdb.CREATE, kit.MDB_TYPE, "login", arg)
|
m.Cmdy(web.SHARE, mdb.CREATE, kit.MDB_TYPE, LOGIN, arg)
|
||||||
|
}},
|
||||||
|
tcp.START: {Name: "start name repos template", Help: "启动", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmdy(web.DREAM, tcp.START, arg)
|
||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
m.Cmdy(mdb.SELECT, RIVER, "", mdb.HASH, kit.MDB_HASH, arg)
|
m.Cmdy(mdb.SELECT, RIVER, "", mdb.HASH, kit.MDB_HASH, arg)
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
ice "github.com/shylinux/icebergs"
|
ice "github.com/shylinux/icebergs"
|
||||||
"github.com/shylinux/icebergs/base/gdb"
|
"github.com/shylinux/icebergs/base/gdb"
|
||||||
"github.com/shylinux/icebergs/base/mdb"
|
"github.com/shylinux/icebergs/base/mdb"
|
||||||
|
"github.com/shylinux/icebergs/base/web"
|
||||||
kit "github.com/shylinux/toolkits"
|
kit "github.com/shylinux/toolkits"
|
||||||
|
|
||||||
"strings"
|
"strings"
|
||||||
@ -186,6 +187,7 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
mdb.SEARCH: {Name: "search", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
mdb.SEARCH: {Name: "search", Help: "搜索", Hand: func(m *ice.Message, arg ...string) {
|
||||||
_task_search(m, arg[0], arg[1], arg[2])
|
_task_search(m, arg[0], arg[1], arg[2])
|
||||||
|
m.PushPodCmd(TASK, kit.Simple(mdb.SEARCH, arg)...)
|
||||||
}},
|
}},
|
||||||
|
|
||||||
gdb.BEGIN: {Name: "begin", Help: "开始", Hand: func(m *ice.Message, arg ...string) {
|
gdb.BEGIN: {Name: "begin", Help: "开始", Hand: func(m *ice.Message, arg ...string) {
|
||||||
@ -195,6 +197,10 @@ func init() {
|
|||||||
_task_modify(m, m.Option(kit.MDB_ZONE), m.Option(kit.MDB_ID), TaskField.STATUS, TaskStatus.FINISH)
|
_task_modify(m, m.Option(kit.MDB_ZONE), m.Option(kit.MDB_ID), TaskField.STATUS, TaskStatus.FINISH)
|
||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
|
if m.Option(kit.SSH_POD) != "" {
|
||||||
|
m.Cmdy(web.SPACE, m.Option(kit.SSH_POD), m.Prefix(TASK), arg)
|
||||||
|
return
|
||||||
|
}
|
||||||
_task_list(m, kit.Select("", arg, 0), kit.Select("", arg, 1))
|
_task_list(m, kit.Select("", arg, 0), kit.Select("", arg, 1))
|
||||||
}},
|
}},
|
||||||
},
|
},
|
||||||
|
4
misc.go
4
misc.go
@ -85,7 +85,7 @@ func (m *Message) PushSearch(args ...interface{}) {
|
|||||||
for _, k := range kit.Split(m.Option("fields")) {
|
for _, k := range kit.Split(m.Option("fields")) {
|
||||||
switch k {
|
switch k {
|
||||||
case kit.SSH_POD:
|
case kit.SSH_POD:
|
||||||
m.Push(k, kit.Select(m.Option(MSG_USERPOD), data[kit.SSH_POD]))
|
// m.Push(k, kit.Select(m.Option(MSG_USERPOD), data[kit.SSH_POD]))
|
||||||
case kit.SSH_CTX:
|
case kit.SSH_CTX:
|
||||||
m.Push(k, m.Prefix())
|
m.Push(k, m.Prefix())
|
||||||
case kit.SSH_CMD:
|
case kit.SSH_CMD:
|
||||||
@ -219,3 +219,5 @@ func (m *Message) SortStr(key string) { m.Sort(key, "str") }
|
|||||||
func (m *Message) SortStrR(key string) { m.Sort(key, "str_r") }
|
func (m *Message) SortStrR(key string) { m.Sort(key, "str_r") }
|
||||||
func (m *Message) SortTime(key string) { m.Sort(key, "time") }
|
func (m *Message) SortTime(key string) { m.Sort(key, "time") }
|
||||||
func (m *Message) SortTimeR(key string) { m.Sort(key, "time_r") }
|
func (m *Message) SortTimeR(key string) { m.Sort(key, "time_r") }
|
||||||
|
|
||||||
|
func (m *Message) FormatMeta() string { return m.Format("meta") }
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
ice "github.com/shylinux/icebergs"
|
ice "github.com/shylinux/icebergs"
|
||||||
"github.com/shylinux/icebergs/base/cli"
|
"github.com/shylinux/icebergs/base/cli"
|
||||||
"github.com/shylinux/icebergs/base/mdb"
|
"github.com/shylinux/icebergs/base/mdb"
|
||||||
|
"github.com/shylinux/icebergs/base/web"
|
||||||
"github.com/shylinux/icebergs/core/code"
|
"github.com/shylinux/icebergs/core/code"
|
||||||
kit "github.com/shylinux/toolkits"
|
kit "github.com/shylinux/toolkits"
|
||||||
|
|
||||||
@ -23,25 +24,33 @@ const STATUS = "status"
|
|||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{
|
Index.Merge(&ice.Context{
|
||||||
Commands: map[string]*ice.Command{
|
Commands: map[string]*ice.Command{
|
||||||
STATUS: {Name: "status name auto commit compile pull", Help: "代码状态", Action: map[string]*ice.Action{
|
STATUS: {Name: "status name auto pull compile create commit", Help: "代码状态", Action: map[string]*ice.Action{
|
||||||
PULL: {Name: "pull", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
|
PULL: {Name: "pull", Help: "下载", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Option(cli.PROGRESS_CB, func(cb func(name string, count, total int)) {
|
m.Option(cli.PROGRESS_CB, func(update func(name string, count, total int)) {
|
||||||
count, total := 0, len(m.Confm(REPOS, kit.MDB_HASH))
|
count, total := 0, len(m.Confm(REPOS, kit.MDB_HASH))
|
||||||
m.Richs(REPOS, nil, kit.Select(kit.MDB_FOREACH, arg, 0), func(key string, value map[string]interface{}) {
|
m.Richs(REPOS, nil, kit.Select(kit.MDB_FOREACH, arg, 0), func(key string, value map[string]interface{}) {
|
||||||
value = kit.GetMeta(value)
|
value = kit.GetMeta(value)
|
||||||
|
update(kit.Format(value[kit.MDB_NAME]), count, total)
|
||||||
|
|
||||||
cb(kit.Format(value[kit.MDB_NAME]), count, total)
|
|
||||||
m.Option(cli.CMD_DIR, value[kit.MDB_PATH])
|
m.Option(cli.CMD_DIR, value[kit.MDB_PATH])
|
||||||
m.Cmd(cli.SYSTEM, GIT, PULL)
|
m.Cmd(cli.SYSTEM, GIT, PULL)
|
||||||
count++
|
count++
|
||||||
})
|
})
|
||||||
cb("", total, total)
|
update("", total, total)
|
||||||
})
|
})
|
||||||
m.Cmdy(cli.PROGRESS, mdb.CREATE)
|
m.Cmdy(cli.PROGRESS, mdb.CREATE)
|
||||||
}},
|
}},
|
||||||
COMPILE: {Name: "compile", Help: "编译", Hand: func(m *ice.Message, arg ...string) {
|
COMPILE: {Name: "compile", Help: "编译", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmdy(cli.SYSTEM, "make")
|
m.Cmdy(cli.SYSTEM, "make")
|
||||||
}},
|
}},
|
||||||
|
mdb.CREATE: {Name: "create main=src/main.go@key name=hi@key from=usr/icebergs/misc/bash/bash.go@key", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmdy(web.SPACE, m.Option(web.ROUTE), "web.code.autogen", mdb.CREATE, arg)
|
||||||
|
m.Option(ice.MSG_PROCESS, ice.PROCESS_INNER)
|
||||||
|
}},
|
||||||
|
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmdy(code.AUTOGEN, mdb.INPUTS, arg)
|
||||||
|
}},
|
||||||
|
|
||||||
ADD: {Name: "add", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
ADD: {Name: "add", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Option(cli.CMD_DIR, _repos_path(m.Option(kit.MDB_NAME)))
|
m.Option(cli.CMD_DIR, _repos_path(m.Option(kit.MDB_NAME)))
|
||||||
m.Cmdy(cli.SYSTEM, GIT, ADD, m.Option(kit.MDB_FILE))
|
m.Cmdy(cli.SYSTEM, GIT, ADD, m.Option(kit.MDB_FILE))
|
||||||
@ -52,7 +61,7 @@ func init() {
|
|||||||
}
|
}
|
||||||
m.Option(cli.CMD_DIR, _repos_path(m.Option(kit.MDB_NAME)))
|
m.Option(cli.CMD_DIR, _repos_path(m.Option(kit.MDB_NAME)))
|
||||||
|
|
||||||
if arg[0] == "action" {
|
if arg[0] == kit.MDB_ACTION {
|
||||||
m.Cmdy(cli.SYSTEM, GIT, COMMIT, "-am", kit.Select("opt some", arg[1]+" "+arg[3]))
|
m.Cmdy(cli.SYSTEM, GIT, COMMIT, "-am", kit.Select("opt some", arg[1]+" "+arg[3]))
|
||||||
} else {
|
} else {
|
||||||
m.Cmdy(cli.SYSTEM, GIT, COMMIT, "-am", kit.Select("opt some", strings.Join(arg, " ")))
|
m.Cmdy(cli.SYSTEM, GIT, COMMIT, "-am", kit.Select("opt some", strings.Join(arg, " ")))
|
||||||
@ -69,13 +78,6 @@ func init() {
|
|||||||
}
|
}
|
||||||
m.Cmdy(cli.SYSTEM, GIT, PUSH)
|
m.Cmdy(cli.SYSTEM, GIT, PUSH)
|
||||||
}},
|
}},
|
||||||
|
|
||||||
mdb.CREATE: {Name: "create main=src/main.go@key name=hi@key from=usr/icebergs/misc/bash/bash.go@key", Help: "创建", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
m.Cmdy(code.AUTOGEN, mdb.CREATE, arg)
|
|
||||||
}},
|
|
||||||
mdb.INPUTS: {Name: "inputs", Help: "补全", Hand: func(m *ice.Message, arg ...string) {
|
|
||||||
m.Cmdy(code.AUTOGEN, mdb.INPUTS, arg)
|
|
||||||
}},
|
|
||||||
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
}, Hand: func(m *ice.Message, c *ice.Context, cmd string, arg ...string) {
|
||||||
m.Richs(REPOS, nil, kit.Select(kit.MDB_FOREACH, arg, 0), func(key string, value map[string]interface{}) {
|
m.Richs(REPOS, nil, kit.Select(kit.MDB_FOREACH, arg, 0), func(key string, value map[string]interface{}) {
|
||||||
value = kit.GetMeta(value)
|
value = kit.GetMeta(value)
|
||||||
|
2
type.go
2
type.go
@ -366,7 +366,7 @@ func (m *Message) Format(key interface{}) string {
|
|||||||
return kit.Format(m.meta)
|
return kit.Format(m.meta)
|
||||||
case "append":
|
case "append":
|
||||||
if len(m.meta["append"]) == 0 {
|
if len(m.meta["append"]) == 0 {
|
||||||
return fmt.Sprintf("%dx%d %s", 0, len(m.meta["append"]), kit.Format(m.meta["append"]))
|
return fmt.Sprintf("%dx%d %s", 0, 0, "[]")
|
||||||
} else {
|
} else {
|
||||||
return fmt.Sprintf("%dx%d %s", len(m.meta[m.meta["append"][0]]), len(m.meta["append"]), kit.Format(m.meta["append"]))
|
return fmt.Sprintf("%dx%d %s", len(m.meta[m.meta["append"][0]]), len(m.meta["append"]), kit.Format(m.meta["append"]))
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user