mirror of
https://shylinux.com/x/icebergs
synced 2025-04-26 17:44:05 +08:00
opt some
This commit is contained in:
parent
1348b8a1f5
commit
f93de948d6
@ -185,7 +185,7 @@ const RUNTIME = "runtime"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
RUNTIME: {Name: "runtime info=ifconfig,hostinfo,hostname,userinfo,procinfo,diskinfo,bootinfo,api,cli,cmd,env auto Terminal Chrome", Help: "运行环境", Actions: ice.Actions{
|
RUNTIME: {Name: "runtime info=ifconfig,hostinfo,hostname,userinfo,procinfo,diskinfo,bootinfo,api,cli,cmd,env auto", Help: "运行环境", Actions: ice.Actions{
|
||||||
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
ice.CTX_INIT: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
cs := m.Target().Configs
|
cs := m.Target().Configs
|
||||||
if _, ok := cs[RUNTIME]; !ok {
|
if _, ok := cs[RUNTIME]; !ok {
|
||||||
|
@ -177,8 +177,8 @@ const (
|
|||||||
)
|
)
|
||||||
const HASH = "hash"
|
const HASH = "hash"
|
||||||
|
|
||||||
func HashAction(args ...Any) ice.Actions {
|
func HashAction(arg ...Any) ice.Actions {
|
||||||
return ice.Actions{ice.CTX_INIT: AutoConfig(args...), ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { HashSelectClose(m) }},
|
return ice.Actions{ice.CTX_INIT: AutoConfig(arg...), ice.CTX_EXIT: {Hand: func(m *ice.Message, arg ...string) { HashSelectClose(m) }},
|
||||||
INPUTS: {Hand: func(m *ice.Message, arg ...string) { HashInputs(m, arg) }},
|
INPUTS: {Hand: func(m *ice.Message, arg ...string) { HashInputs(m, arg) }},
|
||||||
CREATE: {Name: "create", Help: "创建", Hand: func(m *ice.Message, arg ...string) { HashCreate(m, arg) }},
|
CREATE: {Name: "create", Help: "创建", Hand: func(m *ice.Message, arg ...string) { HashCreate(m, arg) }},
|
||||||
REMOVE: {Name: "remove", Help: "删除", Hand: func(m *ice.Message, arg ...string) { HashRemove(m, arg) }},
|
REMOVE: {Name: "remove", Help: "删除", Hand: func(m *ice.Message, arg ...string) { HashRemove(m, arg) }},
|
||||||
|
@ -3,9 +3,12 @@ package wiki
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/csv"
|
"encoding/csv"
|
||||||
|
"path"
|
||||||
|
|
||||||
ice "shylinux.com/x/icebergs"
|
ice "shylinux.com/x/icebergs"
|
||||||
|
"shylinux.com/x/icebergs/base/ctx"
|
||||||
"shylinux.com/x/icebergs/base/lex"
|
"shylinux.com/x/icebergs/base/lex"
|
||||||
|
"shylinux.com/x/icebergs/base/mdb"
|
||||||
"shylinux.com/x/icebergs/base/nfs"
|
"shylinux.com/x/icebergs/base/nfs"
|
||||||
kit "shylinux.com/x/toolkits"
|
kit "shylinux.com/x/toolkits"
|
||||||
)
|
)
|
||||||
@ -13,22 +16,36 @@ import (
|
|||||||
const DATA = "data"
|
const DATA = "data"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.Merge(&ice.Context{Configs: ice.Configs{
|
Index.MergeCommands(ice.Commands{
|
||||||
DATA: {Name: DATA, Help: "数据表格", Value: kit.Data(nfs.PATH, ice.USR_LOCAL_EXPORT, lex.REGEXP, ".*\\.csv")},
|
DATA: {Name: "data path type@key fields auto create push save draw", Help: "数据表格", Actions: ice.MergeActions(ice.Actions{
|
||||||
}, Commands: ice.Commands{
|
mdb.INPUTS: {Hand: func(m *ice.Message, arg ...string) {
|
||||||
DATA: {Name: "data path auto", Help: "数据表格", Meta: kit.Dict(ice.DisplayLocal("")), Actions: ice.Actions{
|
switch arg[0] {
|
||||||
nfs.SAVE: {Name: "save path text", Help: "保存", Hand: func(m *ice.Message, arg ...string) {
|
case mdb.TYPE:
|
||||||
_wiki_save(m, m.CommandKey(), arg[0], arg[1])
|
m.Push(arg[0], "折线图", "比例图")
|
||||||
|
}
|
||||||
}},
|
}},
|
||||||
}, Hand: func(m *ice.Message, arg ...string) {
|
mdb.CREATE: {Name: "create path fields value", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmd("", nfs.SAVE, m.Option(nfs.PATH), kit.Join(kit.Split(m.Option("fields")), ice.FS)+ice.NL+kit.Join(kit.Split(m.Option("value")))+ice.NL)
|
||||||
|
}},
|
||||||
|
nfs.PUSH: {Name: "push path record", Help: "添加", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmd(nfs.PUSH, path.Join(m.Config(nfs.PATH), arg[0]), kit.Join(arg[1:], ice.FS)+ice.NL)
|
||||||
|
}},
|
||||||
|
}, FileAction(nfs.PATH, ice.USR_LOCAL_EXPORT, lex.REGEXP, ".*\\.csv")), Hand: func(m *ice.Message, arg ...string) {
|
||||||
if !_wiki_list(m, m.CommandKey(), kit.Select(nfs.PWD, arg, 0)) {
|
if !_wiki_list(m, m.CommandKey(), kit.Select(nfs.PWD, arg, 0)) {
|
||||||
CSV(m, m.Cmd(nfs.CAT, arg[0]).Result())
|
CSV(m, m.Cmd(nfs.CAT, arg[0]).Result()).StatusTimeCount()
|
||||||
m.StatusTimeCount()
|
ctx.DisplayLocal(m, "")
|
||||||
}
|
}
|
||||||
}},
|
}},
|
||||||
}})
|
})
|
||||||
|
}
|
||||||
|
func FileAction(arg ...ice.Any) ice.Actions {
|
||||||
|
return ice.Actions{ice.CTX_INIT: mdb.AutoConfig(arg...),
|
||||||
|
nfs.TRASH: {Hand: func(m *ice.Message, arg ...string) { m.Cmd(nfs.TRASH, path.Join(m.Config(nfs.PATH), m.Option(nfs.PATH))) }},
|
||||||
|
nfs.SAVE: {Name: "save path text", Help: "保存", Hand: func(m *ice.Message, arg ...string) {
|
||||||
|
m.Cmd(nfs.SAVE, arg[0], arg[1], kit.Dict(nfs.DIR_ROOT, m.Config(nfs.PATH)))
|
||||||
|
}},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func CSV(m *ice.Message, text string, head ...string) *ice.Message {
|
func CSV(m *ice.Message, text string, head ...string) *ice.Message {
|
||||||
bio := bytes.NewBufferString(text)
|
bio := bytes.NewBufferString(text)
|
||||||
r := csv.NewReader(bio)
|
r := csv.NewReader(bio)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user