forked from x/icebergs
add some
This commit is contained in:
parent
25ac2e3a1b
commit
7de837851e
@ -36,10 +36,10 @@ func _config_save(m *ice.Message, name string, arg ...string) {
|
|||||||
data, msg := ice.Map{}, m.Spawn(m.Source())
|
data, msg := ice.Map{}, m.Spawn(m.Source())
|
||||||
for _, k := range arg {
|
for _, k := range arg {
|
||||||
if v := mdb.Confv(msg, k); _config_only(v, mdb.META) && _config_only(kit.Value(v, mdb.META),
|
if v := mdb.Confv(msg, k); _config_only(v, mdb.META) && _config_only(kit.Value(v, mdb.META),
|
||||||
mdb.IMPORTANT, mdb.EXPIRE, mdb.SHORT, mdb.FIELD, mdb.FIELDS, mdb.ACTION, mdb.SORT, mdb.TOOLS,
|
mdb.IMPORTANT, mdb.EXPIRE, mdb.VENDOR, nfs.SOURCE, nfs.SCRIPT, nfs.PATH, lex.REGEXP,
|
||||||
nfs.SOURCE, nfs.SCRIPT,
|
mdb.SHORT, mdb.FIELD, mdb.SHORTS, mdb.FIELDS,
|
||||||
lex.REGEXP, nfs.PATH, "link",
|
mdb.ACTION, mdb.SORT, mdb.TOOLS,
|
||||||
"linux", "darwin", "windows",
|
"link", "linux", "darwin", "windows",
|
||||||
) {
|
) {
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -103,19 +102,14 @@ func _hash_prunes(m *ice.Message, prefix, chain string, arg ...string) {
|
|||||||
}
|
}
|
||||||
func _hash_export(m *ice.Message, prefix, chain, file string) {
|
func _hash_export(m *ice.Message, prefix, chain, file string) {
|
||||||
defer Lock(m, prefix)()
|
defer Lock(m, prefix)()
|
||||||
p := kit.Keys(file, JSON)
|
if len(Confm(m, prefix, kit.Keys(chain, HASH))) == 0 {
|
||||||
count := len(Confm(m, prefix, kit.Keys(chain, HASH)))
|
|
||||||
if count == 0 {
|
|
||||||
if s, e := os.Stat(p); e == nil && !s.IsDir() {
|
|
||||||
os.Remove(p)
|
|
||||||
}
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
f, p, e := miss.CreateFile(p)
|
f, p, e := miss.CreateFile(kit.Keys(file, JSON))
|
||||||
m.Assert(e)
|
m.Assert(e)
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
defer m.Echo(p)
|
defer m.Echo(p)
|
||||||
m.Logs(EXPORT, KEY, path.Join(prefix, chain), FILE, p, COUNT, count)
|
m.Logs(EXPORT, KEY, path.Join(prefix, chain), FILE, p)
|
||||||
en := json.NewEncoder(f)
|
en := json.NewEncoder(f)
|
||||||
if en.SetIndent("", " "); !m.WarnNotValid(en.Encode(m.Confv(prefix, kit.Keys(chain, HASH))), EXPORT, prefix) {
|
if en.SetIndent("", " "); !m.WarnNotValid(en.Encode(m.Confv(prefix, kit.Keys(chain, HASH))), EXPORT, prefix) {
|
||||||
m.Conf(prefix, kit.Keys(chain, HASH), "")
|
m.Conf(prefix, kit.Keys(chain, HASH), "")
|
||||||
|
@ -60,6 +60,9 @@ func _zone_select(m *ice.Message, prefix, chain, zone string, id string) {
|
|||||||
}
|
}
|
||||||
func _zone_export(m *ice.Message, prefix, chain, file string) {
|
func _zone_export(m *ice.Message, prefix, chain, file string) {
|
||||||
defer Lock(m, prefix)()
|
defer Lock(m, prefix)()
|
||||||
|
if len(Confm(m, prefix, kit.Keys(chain, HASH))) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
f, p, e := miss.CreateFile(kit.Keys(file, CSV))
|
f, p, e := miss.CreateFile(kit.Keys(file, CSV))
|
||||||
m.Assert(e)
|
m.Assert(e)
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
@ -15,7 +15,7 @@ const EPIC = "epic"
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
Index.MergeCommands(ice.Commands{
|
Index.MergeCommands(ice.Commands{
|
||||||
EPIC: {Help: "史记", Actions: ice.MergeActions(ice.Actions{
|
EPIC: {Help: "史记", Icon: "Photo Booth.png", 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.ExportHashAction(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) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user