From 268d363a57aff6f47599a5d403e7c6b0cf1e367f Mon Sep 17 00:00:00 2001 From: harveyshao Date: Tue, 9 Aug 2022 15:14:53 +0800 Subject: [PATCH] opt some --- base/nfs/dir.go | 8 +++++++- core/code/binpack.go | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/base/nfs/dir.go b/base/nfs/dir.go index 7b7964ca..aaf07f0e 100644 --- a/base/nfs/dir.go +++ b/base/nfs/dir.go @@ -173,13 +173,19 @@ const DIR = "dir" func init() { Index.MergeCommands(ice.Commands{ - DIR: {Name: "dir path field auto upload", Help: "目录", Actions: ice.Actions{ + DIR: {Name: "dir path field auto upload what", Help: "目录", Actions: ice.Actions{ mdb.UPLOAD: {Name: "upload", Help: "上传", Hand: func(m *ice.Message, arg ...string) { m.Cmdy("web.cache", "upload_watch", m.Option(PATH)) }}, TRASH: {Name: "trash", Help: "删除", Hand: func(m *ice.Message, arg ...string) { m.Cmdy(TRASH, mdb.CREATE, m.Option(PATH)) }}, + "what": {Name: "trash", Help: "what", Hand: func(m *ice.Message, arg ...string) { + m.Option(DIR_ROOT, "usr/volcanos/plugin/local/code/inner/") + m.Option(DIR_DEEP, "true") + m.Cmdy(DIR, PWD) + m.Sort("path") + }}, }, Hand: func(m *ice.Message, arg ...string) { if m.Option(DIR_ROOT) != "" { m.Logs(mdb.SELECT, DIR_ROOT, m.Option(DIR_ROOT)) diff --git a/core/code/binpack.go b/core/code/binpack.go index 8e1a7b77..b38acb3a 100644 --- a/core/code/binpack.go +++ b/core/code/binpack.go @@ -17,7 +17,7 @@ import ( func _binpack_file(m *ice.Message, w io.Writer, arg ...string) { // file name if f, e := nfs.OpenFile(m, arg[0]); e == nil { defer f.Close() - if b, e := ioutil.ReadAll(f); e == nil && len(b) > 0 { + if b, _ := ioutil.ReadAll(f); len(b) > 0 { fmt.Fprintf(w, " \"%s\": \"%s\",\n", kit.Select(arg[0], arg, 1), base64.StdEncoding.EncodeToString(b)) return }