forked from x/icebergs
add some
This commit is contained in:
parent
d517ee6ebe
commit
2f8c081a38
@ -169,12 +169,12 @@ func Opens(m *ice.Message, arg ...string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
func OpenCmds(m *ice.Message, arg ...string) {
|
func OpenCmds(m *ice.Message, arg ...string) *ice.Message {
|
||||||
if !tcp.IsLocalHost(m, m.Option(ice.MSG_USERIP)) {
|
if !tcp.IsLocalHost(m, m.Option(ice.MSG_USERIP)) {
|
||||||
return
|
return m
|
||||||
}
|
}
|
||||||
if len(arg) == 0 || arg[0] == "" {
|
if len(arg) == 0 || arg[0] == "" {
|
||||||
return
|
return m
|
||||||
}
|
}
|
||||||
m.Cmd(SYSTEM, "osascript", "-e", kit.Format(`
|
m.Cmd(SYSTEM, "osascript", "-e", kit.Format(`
|
||||||
tell application "Terminal"
|
tell application "Terminal"
|
||||||
@ -182,4 +182,5 @@ tell application "Terminal"
|
|||||||
activate
|
activate
|
||||||
end tell
|
end tell
|
||||||
`, strings.Join(arg, "; ")))
|
`, strings.Join(arg, "; ")))
|
||||||
|
return m
|
||||||
}
|
}
|
||||||
|
@ -127,13 +127,12 @@ func init() {
|
|||||||
CONFIG: {Name: "config key auto", Help: "配置", Actions: ice.Actions{
|
CONFIG: {Name: "config key auto", Help: "配置", Actions: ice.Actions{
|
||||||
SAVE: {Hand: func(m *ice.Message, arg ...string) { _config_save(m, arg[0], arg[1:]...) }},
|
SAVE: {Hand: func(m *ice.Message, arg ...string) { _config_save(m, arg[0], arg[1:]...) }},
|
||||||
LOAD: {Hand: func(m *ice.Message, arg ...string) { _config_load(m, arg[0], arg[1:]...) }},
|
LOAD: {Hand: func(m *ice.Message, arg ...string) { _config_load(m, arg[0], arg[1:]...) }},
|
||||||
mdb.EXPORT: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(mdb.EXPORT, arg[0], "", mdb.HASH) }},
|
mdb.EXPORT: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(arg[0], mdb.EXPORT) }},
|
||||||
mdb.IMPORT: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(mdb.IMPORT, arg[0], "", mdb.HASH) }},
|
mdb.IMPORT: {Hand: func(m *ice.Message, arg ...string) { m.Cmdy(arg[0], mdb.IMPORT) }},
|
||||||
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) {
|
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(mdb.EXPORT, arg[0], "", mdb.HASH, path.Join(ice.VAR_TRASH, kit.Keys(arg[0])))
|
|
||||||
nfs.Trash(m, path.Join(ice.VAR_DATA, arg[0]))
|
nfs.Trash(m, path.Join(ice.VAR_DATA, arg[0]))
|
||||||
|
nfs.Trash(m, m.Cmdx(arg[0], mdb.EXPORT))
|
||||||
mdb.Config(m, arg[0], nil, nil)
|
mdb.Config(m, arg[0], nil, nil)
|
||||||
m.Go(func() { m.Cmd(ice.EXIT, 1) })
|
|
||||||
}},
|
}},
|
||||||
mdb.LIST: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.LIST: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
list := []ice.Any{}
|
list := []ice.Any{}
|
||||||
|
@ -167,8 +167,8 @@ func ClearOnExitHashAction() ice.Actions {
|
|||||||
}
|
}
|
||||||
func ExportHashAction(arg ...Any) ice.Actions {
|
func ExportHashAction(arg ...Any) ice.Actions {
|
||||||
return ice.MergeActions(ice.Actions{
|
return ice.MergeActions(ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { HashImport(m, arg) }},
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { Config(m, IMPORTANT, ice.TRUE); HashImport(m, arg) }},
|
||||||
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { Config(m, IMPORTANT, ice.TRUE); HashExport(m, arg) }},
|
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { HashExport(m, arg) }},
|
||||||
}, HashAction(arg...))
|
}, HashAction(arg...))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,6 +66,7 @@ func _zone_export(m *ice.Message, prefix, chain, file string) {
|
|||||||
w := csv.NewWriter(f)
|
w := csv.NewWriter(f)
|
||||||
defer w.Flush()
|
defer w.Flush()
|
||||||
head := kit.AddUniq(_zone_fields(m), EXTRA)
|
head := kit.AddUniq(_zone_fields(m), EXTRA)
|
||||||
|
m.Debug("export %v", head)
|
||||||
w.Write(head)
|
w.Write(head)
|
||||||
count := 0
|
count := 0
|
||||||
for _, key := range kit.SortedKey(m.Confv(prefix, kit.Keys(chain, HASH))) {
|
for _, key := range kit.SortedKey(m.Confv(prefix, kit.Keys(chain, HASH))) {
|
||||||
@ -182,6 +183,12 @@ func ZoneAction(arg ...ice.Any) ice.Actions {
|
|||||||
IMPORT: {Hand: func(m *ice.Message, arg ...string) { ZoneImport(m, arg) }},
|
IMPORT: {Hand: func(m *ice.Message, arg ...string) { ZoneImport(m, arg) }},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
func ExportZoneAction(arg ...ice.Any) ice.Actions {
|
||||||
|
return ice.MergeActions(ZoneAction(arg...), ice.Actions{
|
||||||
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) { Config(m, IMPORTANT, ice.TRUE); ZoneImport(m, arg) }},
|
||||||
|
ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { m.OptionFields(""); ZoneExport(m, arg) }},
|
||||||
|
})
|
||||||
|
}
|
||||||
func PageZoneAction(arg ...ice.Any) ice.Actions {
|
func PageZoneAction(arg ...ice.Any) ice.Actions {
|
||||||
return ice.MergeActions(ice.Actions{
|
return ice.MergeActions(ice.Actions{
|
||||||
SELECT: {Hand: func(m *ice.Message, arg ...string) { PageZoneSelect(m, arg...) }},
|
SELECT: {Hand: func(m *ice.Message, arg ...string) { PageZoneSelect(m, arg...) }},
|
||||||
|
@ -69,7 +69,7 @@ func _dream_start(m *ice.Message, name string) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
defer ToastProcess(m)()
|
defer ToastProcess(m)()
|
||||||
defer m.Sleep300ms()
|
defer m.Sleep3s()
|
||||||
m.Options(cli.CMD_DIR, kit.Path(p), cli.CMD_ENV, kit.EnvList(kit.Simple(
|
m.Options(cli.CMD_DIR, kit.Path(p), cli.CMD_ENV, kit.EnvList(kit.Simple(
|
||||||
cli.CTX_OPS, Domain(tcp.LOCALHOST, m.Cmdv(SERVE, tcp.PORT)), cli.CTX_LOG, ice.VAR_LOG_BOOT_LOG, cli.CTX_PID, ice.VAR_LOG_ICE_PID,
|
cli.CTX_OPS, Domain(tcp.LOCALHOST, m.Cmdv(SERVE, tcp.PORT)), cli.CTX_LOG, ice.VAR_LOG_BOOT_LOG, cli.CTX_PID, ice.VAR_LOG_ICE_PID,
|
||||||
cli.PATH, cli.BinPath(p, ""), cli.USER, ice.Info.Username,
|
cli.PATH, cli.BinPath(p, ""), cli.USER, ice.Info.Username,
|
||||||
|
@ -176,7 +176,7 @@ const SPACE = "space"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
ice.Info.Inputs = append(ice.Info.Inputs, func(m *ice.Message, arg ...string) {
|
ice.Info.Inputs = append(ice.Info.Inputs, func(m *ice.Message, arg ...string) {
|
||||||
switch arg[0] {
|
switch kit.TrimPrefix(arg[0], "extra.") {
|
||||||
case SPACE:
|
case SPACE:
|
||||||
m.Cmd(SPACE, func(value ice.Maps) {
|
m.Cmd(SPACE, func(value ice.Maps) {
|
||||||
kit.If(kit.IsIn(value[mdb.TYPE], WORKER, SERVER), func() { m.Push(arg[0], value[mdb.NAME]) })
|
kit.If(kit.IsIn(value[mdb.TYPE], WORKER, SERVER), func() { m.Push(arg[0], value[mdb.NAME]) })
|
||||||
@ -190,6 +190,7 @@ func init() {
|
|||||||
m.Cmdy(ctx.COMMAND)
|
m.Cmdy(ctx.COMMAND)
|
||||||
}
|
}
|
||||||
case ctx.ARGS:
|
case ctx.ARGS:
|
||||||
|
m.OptionDefault(ctx.INDEX, m.Option("extra.index"))
|
||||||
if space := m.Option(SPACE); space != "" {
|
if space := m.Option(SPACE); space != "" {
|
||||||
m.Options(SPACE, []string{}).Cmdy(SPACE, space, ctx.COMMAND, mdb.INPUTS, m.Option(ctx.INDEX))
|
m.Options(SPACE, []string{}).Cmdy(SPACE, space, ctx.COMMAND, mdb.INPUTS, m.Option(ctx.INDEX))
|
||||||
} else {
|
} else {
|
||||||
|
@ -93,7 +93,7 @@ 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: {Hand: func(m *ice.Message, arg ...string) { _binpack_all(m) }},
|
mdb.CREATE: {Name: "create path", Hand: func(m *ice.Message, arg ...string) { _binpack_all(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"))},
|
||||||
})
|
})
|
||||||
|
@ -150,6 +150,9 @@ func init() {
|
|||||||
m.Cmd(cli.SYSTEM, "date")
|
m.Cmd(cli.SYSTEM, "date")
|
||||||
m.Cmd(cli.SYSTEM, cli.MAKE, m.Option(nfs.TARGET), kit.Dict(cli.CMD_DIR, m.Option(nfs.PATH)))
|
m.Cmd(cli.SYSTEM, cli.MAKE, m.Option(nfs.TARGET), kit.Dict(cli.CMD_DIR, m.Option(nfs.PATH)))
|
||||||
}},
|
}},
|
||||||
|
ice.APP: {Help: "本机", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
cli.OpenCmds(m, "cd "+kit.Path(""), "vim "+path.Join(arg[0], arg[1])+" +"+arg[2]).ProcessHold()
|
||||||
|
}},
|
||||||
COMPILE: {Help: "编译", Hand: func(m *ice.Message, arg ...string) {
|
COMPILE: {Help: "编译", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Option(nfs.PATH) != "" && nfs.ExistsFile(m, path.Join(m.Option(nfs.PATH), ice.MAKEFILE)) {
|
if m.Option(nfs.PATH) != "" && nfs.ExistsFile(m, path.Join(m.Option(nfs.PATH), ice.MAKEFILE)) {
|
||||||
web.PushStream(m).Cmdy(cli.SYSTEM, cli.MAKE, kit.Dict(cli.CMD_DIR, m.Option(nfs.PATH)))
|
web.PushStream(m).Cmdy(cli.SYSTEM, cli.MAKE, kit.Dict(cli.CMD_DIR, m.Option(nfs.PATH)))
|
||||||
@ -196,7 +199,7 @@ func init() {
|
|||||||
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, []string{}, arg...) }},
|
web.DREAM_ACTION: {Hand: func(m *ice.Message, arg ...string) { web.DreamProcess(m, []string{}, arg...) }},
|
||||||
}, aaa.RoleAction(), chat.FavorAction(), ctx.ConfAction(ctx.TOOLS, "xterm,compile,runtime")), Hand: func(m *ice.Message, arg ...string) {
|
}, aaa.RoleAction(), chat.FavorAction(), ctx.ConfAction(ctx.TOOLS, "xterm,compile,runtime")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.Cmdy(INNER, arg); arg[0] != ctx.ACTION {
|
if m.Cmdy(INNER, arg); arg[0] != ctx.ACTION {
|
||||||
m.Action(nfs.SAVE, COMPILE, "show", "exec")
|
m.Action(nfs.SAVE, COMPILE, mdb.SHOW, cli.EXEC, ice.APP)
|
||||||
ctx.DisplayLocal(m, "")
|
ctx.DisplayLocal(m, "")
|
||||||
ctx.Toolkit(m)
|
ctx.Toolkit(m)
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ func init() {
|
|||||||
}},
|
}},
|
||||||
ice.APP: {Help: "本机", Hand: func(m *ice.Message, arg ...string) {
|
ice.APP: {Help: "本机", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if h := kit.Select(m.Option(mdb.HASH), arg, 0); h == "" {
|
if h := kit.Select(m.Option(mdb.HASH), arg, 0); h == "" {
|
||||||
cli.Opens(m, "Terminal.app")
|
cli.OpenCmds(m, "cd "+kit.Path(""))
|
||||||
} else {
|
} else {
|
||||||
cli.OpenCmds(m, m.Cmdv("", h, mdb.TYPE))
|
cli.OpenCmds(m, m.Cmdv("", h, mdb.TYPE))
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/ctx"
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
"shylinux.com/x/icebergs/base/mdb"
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
"shylinux.com/x/icebergs/base/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
@ -14,14 +15,14 @@ const EPIC = "epic"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
EPIC: {Name: "epic hash list create", Help: "史记", Actions: ice.MergeActions(ice.Actions{
|
EPIC: {Help: "史记", Actions: ice.MergeActions(ice.Actions{
|
||||||
mdb.CREATE: {Name: "create time@date zone name"}, mdb.MODIFY: {Name: "modify time zone name"},
|
mdb.CREATE: {Name: "create time@date zone name"}, mdb.MODIFY: {Name: "modify time zone name"},
|
||||||
}, mdb.ImportantHashAction(mdb.FIELD, "time,hash,zone,name")), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.ExportHashAction(mdb.FIELD, "time,hash,zone,name")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.HashSelect(m, arg...).Table(func(value ice.Maps) {
|
mdb.HashSelect(m, arg...).Table(func(value ice.Maps) {
|
||||||
if span := kit.Time(m.Time()) - kit.Time(value[mdb.TIME]); span > 0 {
|
if span := kit.Time(m.Time()) - kit.Time(value[mdb.TIME]); span > 0 {
|
||||||
m.Push(mdb.TEXT, kit.Format(`已经 <span style="font-size:24px;color:red">%v</span> 天<br>距 %s<br>`, int(time.Duration(span)/time.Hour/24), kit.Split(value[mdb.TIME])[0]))
|
m.Push(mdb.TEXT, nfs.Template(m, "gone.html", m.Options("days", int(time.Duration(span)/time.Hour/24), "from", kit.Split(value[mdb.TIME])[0])))
|
||||||
} else {
|
} else {
|
||||||
m.Push(mdb.TEXT, kit.Format(`还有 <span style="font-size:24px;color:green">%v</span> 天<br>距 %s<br>`, -int(time.Duration(span)/time.Hour/24)+1, kit.Split(value[mdb.TIME])[0]))
|
m.Push(mdb.TEXT, nfs.Template(m, "will.html", m.Options("days", -int(time.Duration(span)/time.Hour/24)+1, "from", kit.Split(value[mdb.TIME])[0])))
|
||||||
}
|
}
|
||||||
}).PushAction(mdb.MODIFY, mdb.REMOVE)
|
}).PushAction(mdb.MODIFY, mdb.REMOVE)
|
||||||
web.PushPodCmd(m, "", arg...)
|
web.PushPodCmd(m, "", arg...)
|
||||||
|
@ -28,7 +28,7 @@ func _plan_scope(m *ice.Message, arg ...string) (begin_time, end_time time.Time)
|
|||||||
begin_time = begin_time.AddDate(0, 0, -begin_time.YearDay()+1).AddDate(-5, 0, 0)
|
begin_time = begin_time.AddDate(0, 0, -begin_time.YearDay()+1).AddDate(-5, 0, 0)
|
||||||
end_time = begin_time.AddDate(10, 0, 0)
|
end_time = begin_time.AddDate(10, 0, 0)
|
||||||
}
|
}
|
||||||
m.Logs(mdb.SELECT, "begin_time", begin_time, "end_time", end_time)
|
m.Logs(mdb.SELECT, BEGIN_TIME, begin_time, END_TIME, end_time)
|
||||||
return begin_time, end_time
|
return begin_time, end_time
|
||||||
}
|
}
|
||||||
func _plan_list(m *ice.Message, begin_time, end_time string) {
|
func _plan_list(m *ice.Message, begin_time, end_time string) {
|
||||||
@ -61,22 +61,21 @@ func init() {
|
|||||||
ctx.RUN: {Hand: func(m *ice.Message, arg ...string) {
|
ctx.RUN: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if m.RenameOption(TASK_POD, ice.POD); ctx.PodCmd(m, m.PrefixKey(), ctx.RUN, arg) {
|
if m.RenameOption(TASK_POD, ice.POD); ctx.PodCmd(m, m.PrefixKey(), ctx.RUN, arg) {
|
||||||
return
|
return
|
||||||
}
|
} else if cmd := m.CmdAppend(TASK, kit.Slice(arg, 0, 2), ctx.INDEX); cmd != "" {
|
||||||
if cmd := m.CmdAppend(TASK, kit.Slice(arg, 0, 2), ctx.INDEX); cmd != "" {
|
|
||||||
m.Cmdy(cmd, arg[2:])
|
m.Cmdy(cmd, arg[2:])
|
||||||
} else if aaa.Right(m, arg) {
|
} else if aaa.Right(m, arg) {
|
||||||
m.Cmdy(arg)
|
m.Cmdy(arg)
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
web.DREAM_TABLES: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
kit.Switch(m.Option(mdb.TYPE), kit.Simple(web.SERVER, web.WORKER), func() { m.PushButton(kit.Dict(m.CommandKey(), "计划")) })
|
kit.Switch(m.Option(mdb.TYPE), kit.Simple(web.WORKER, web.SERVER), func() { m.PushButton(kit.Dict(m.CommandKey(), "计划")) })
|
||||||
}},
|
}},
|
||||||
}, aaa.RoleAction(), TASK), Hand: func(m *ice.Message, arg ...string) {
|
}, aaa.RoleAction(), ctx.ConfAction(mdb.TOOLS, "todo,task,epic"), TASK), Hand: func(m *ice.Message, arg ...string) {
|
||||||
begin_time, end_time := _plan_scope(m, kit.Slice(arg, 0, 2)...)
|
begin_time, end_time := _plan_scope(m, kit.Slice(arg, 0, 2)...)
|
||||||
_plan_list(m, begin_time.Format(ice.MOD_TIME), end_time.Format(ice.MOD_TIME))
|
_plan_list(m, begin_time.Format(ice.MOD_TIME), end_time.Format(ice.MOD_TIME))
|
||||||
web.PushPodCmd(m, "", arg...)
|
web.PushPodCmd(m, "", arg...)
|
||||||
ctx.DisplayLocal(m, "")
|
ctx.DisplayLocal(m, "")
|
||||||
ctx.Toolkit(m, TODO, TASK, EPIC)
|
ctx.Toolkit(m, "")
|
||||||
}},
|
}},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -1 +0,0 @@
|
|||||||
chapter "plan"
|
|
@ -4,7 +4,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
"shylinux.com/x/icebergs/base/ctx"
|
|
||||||
"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/web"
|
"shylinux.com/x/icebergs/base/web"
|
||||||
@ -53,6 +52,7 @@ const (
|
|||||||
const (
|
const (
|
||||||
BEGIN_TIME = "begin_time"
|
BEGIN_TIME = "begin_time"
|
||||||
CLOSE_TIME = "close_time"
|
CLOSE_TIME = "close_time"
|
||||||
|
END_TIME = "end_time"
|
||||||
|
|
||||||
STATUS = "status"
|
STATUS = "status"
|
||||||
LEVEL = "level"
|
LEVEL = "level"
|
||||||
@ -66,34 +66,17 @@ const TASK = "task"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
TASK: {Name: "task zone id auto insert", Help: "任务", Actions: ice.MergeActions(ice.Actions{
|
TASK: {Help: "任务", Actions: ice.MergeActions(ice.Actions{
|
||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
if space := m.Option(web.SPACE); space != "" && arg[0] != web.SPACE {
|
switch mdb.ZoneInputs(m, arg); strings.TrimPrefix(arg[0], "extra.") {
|
||||||
m.Options(web.SPACE, "").Cmdy(web.SPACE, space, TASK, mdb.INPUTS, arg)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
switch arg[0] = strings.TrimPrefix(arg[0], "extra."); arg[0] {
|
|
||||||
case web.SPACE:
|
|
||||||
m.Cmd(web.SPACE, func(value ice.Maps) {
|
|
||||||
if kit.IsIn(value[mdb.TYPE], web.WORKER, web.SERVER) {
|
|
||||||
m.Push(arg[0], value[mdb.NAME])
|
|
||||||
}
|
|
||||||
})
|
|
||||||
case mdb.STATUS:
|
case mdb.STATUS:
|
||||||
m.Push(arg[0], PREPARE, PROCESS, CANCEL, FINISH)
|
m.Push(arg[0], PREPARE, PROCESS, CANCEL, FINISH)
|
||||||
case LEVEL, SCORE:
|
case LEVEL, SCORE:
|
||||||
m.Push(arg[0], "1", "2", "3", "4", "5")
|
m.Push(arg[0], "1", "2", "3", "4", "5")
|
||||||
case mdb.TYPE:
|
case mdb.TYPE:
|
||||||
m.Push(arg[0], ONCE, STEP, WEEK)
|
m.Push(arg[0], ONCE, STEP, WEEK)
|
||||||
case ctx.INDEX, ctx.ARGS:
|
|
||||||
m.Option(ctx.INDEX, m.Option("extra.index"))
|
|
||||||
mdb.ZoneInputs(m, arg)
|
|
||||||
default:
|
|
||||||
mdb.ZoneInputs(m, arg)
|
|
||||||
}
|
|
||||||
if arg[0] == mdb.ZONE {
|
|
||||||
m.Push(arg[0], kit.Split(nfs.TemplateText(m, mdb.ZONE)))
|
|
||||||
}
|
}
|
||||||
|
kit.If(arg[0] == mdb.ZONE, func() { m.Push(arg[0], kit.Split(nfs.TemplateText(m, mdb.ZONE))) })
|
||||||
}},
|
}},
|
||||||
mdb.INSERT: {Name: "insert space zone* type=once,step,week name* text begin_time@date close_time@date", Hand: func(m *ice.Message, arg ...string) {
|
mdb.INSERT: {Name: "insert space zone* type=once,step,week name* text begin_time@date close_time@date", Hand: func(m *ice.Message, arg ...string) {
|
||||||
if space, arg := arg[1], arg[2:]; space != "" {
|
if space, arg := arg[1], arg[2:]; space != "" {
|
||||||
@ -106,7 +89,7 @@ func init() {
|
|||||||
CANCEL: {Hand: func(m *ice.Message, arg ...string) { _task_modify(m, STATUS, CANCEL) }},
|
CANCEL: {Hand: func(m *ice.Message, arg ...string) { _task_modify(m, STATUS, CANCEL) }},
|
||||||
BEGIN: {Hand: func(m *ice.Message, arg ...string) { _task_modify(m, STATUS, PROCESS) }},
|
BEGIN: {Hand: func(m *ice.Message, arg ...string) { _task_modify(m, STATUS, PROCESS) }},
|
||||||
END: {Hand: func(m *ice.Message, arg ...string) { _task_modify(m, STATUS, FINISH) }},
|
END: {Hand: func(m *ice.Message, arg ...string) { _task_modify(m, STATUS, FINISH) }},
|
||||||
}, mdb.ImportantZoneAction(mdb.FIELDS, "begin_time,close_time,id,status,level,score,type,name,text")), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.ExportZoneAction(mdb.FIELDS, "begin_time,close_time,id,status,level,score,type,name,text")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if mdb.ZoneSelect(m, arg...); len(arg) > 0 && arg[0] != "" {
|
if mdb.ZoneSelect(m, arg...); len(arg) > 0 && arg[0] != "" {
|
||||||
status := map[string]int{}
|
status := map[string]int{}
|
||||||
m.Table(func(value ice.Maps) { m.PushButton(_task_action(m, value[STATUS])) })
|
m.Table(func(value ice.Maps) { m.PushButton(_task_action(m, value[STATUS])) })
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
team.shy
|
|
||||||
team.go
|
|
||||||
plan.go
|
|
||||||
task.go
|
|
||||||
todo.go
|
|
||||||
epic.go
|
|
@ -12,13 +12,13 @@ const TODO = "todo"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
TODO: {Name: "todo hash list create", Help: "待办", Actions: ice.MergeActions(ice.Actions{
|
TODO: {Help: "待办", Actions: ice.MergeActions(ice.Actions{
|
||||||
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { mdb.HashInputs(m, arg).Cmdy(TASK, mdb.INPUTS, arg) }},
|
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) { mdb.HashInputs(m, arg).Cmdy(TASK, mdb.INPUTS, arg) }},
|
||||||
cli.START: {Name: "start type=once,step,week", Hand: func(m *ice.Message, arg ...string) {
|
cli.START: {Name: "start type=once,step,week", Hand: func(m *ice.Message, arg ...string) {
|
||||||
m.Cmd(TASK, mdb.INSERT, m.OptionSimple("zone,type,name,text"))
|
m.Cmd(TASK, mdb.INSERT, m.OptionSimple("zone,type,name,text"))
|
||||||
mdb.HashRemove(m, m.OptionSimple(mdb.HASH))
|
mdb.HashRemove(m, m.OptionSimple(mdb.HASH))
|
||||||
}},
|
}},
|
||||||
}, mdb.HashAction(mdb.FIELD, "time,hash,zone,name,text")), Hand: func(m *ice.Message, arg ...string) {
|
}, mdb.ExportHashAction(mdb.FIELD, "time,hash,zone,name,text")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
mdb.HashSelect(m, arg...).PushAction(cli.START, mdb.REMOVE)
|
mdb.HashSelect(m, arg...).PushAction(cli.START, mdb.REMOVE)
|
||||||
web.PushPodCmd(m, "", arg...)
|
web.PushPodCmd(m, "", arg...)
|
||||||
ctx.DisplayTableCard(m)
|
ctx.DisplayTableCard(m)
|
||||||
|
2
exec.go
2
exec.go
@ -218,7 +218,7 @@ func (c *Context) _action(m *Message, cmd *Command, key string, sub string, h *A
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
kit.If(order && i < len(arg), func() { m.Option(name, arg[i]) })
|
kit.If(order && i < len(arg), func() { m.Option(name, arg[i]) })
|
||||||
if m.Warn(m.OptionDefault(name, kit.Format(kit.Value(v, VALUE))) == "" && kit.Value(v, "need") == "must", ErrNotValid, name) {
|
if m.Warn(m.OptionDefault(name, kit.Format(kit.Value(v, VALUE))) == "" && kit.Value(v, "need") == "must", ErrNotValid, name, key, sub) {
|
||||||
return m
|
return m
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user