From 5ec051f97aca4d4476d5580ef6584070071226e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B4=94=E7=AB=9E=E5=AE=81?= Date: Fri, 9 Sep 2022 17:53:15 +0800 Subject: [PATCH] feat: add tape drive --- cmd/acp/main.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/cmd/acp/main.go b/cmd/acp/main.go index 6672221..0755e49 100644 --- a/cmd/acp/main.go +++ b/cmd/acp/main.go @@ -16,8 +16,9 @@ var ( notOverwrite = flag.Bool("n", false, "not overwrite exist file") noTarget = flag.Bool("notarget", false, "do not have target, use as dir index tool") reportPath = flag.String("report", "", "json report storage path") - fromLinear = flag.Bool("from-linear", false, "json report storage path") - toLinear = flag.Bool("to-linear", false, "json report storage path") + reportIndent = flag.Bool("report-indent", false, "json report with indent") + fromLinear = flag.Bool("from-linear", false, "copy from linear device, such like tape drive") + toLinear = flag.Bool("to-linear", false, "copy to linear device, such like tape drive") targetPaths []string ) @@ -89,7 +90,12 @@ func main() { } defer r.Close() - if err := json.NewEncoder(r).Encode(report); err != nil { - logrus.Fatalf("export report fail, err= %s", err) + var buf []byte + if *reportIndent { + buf, _ = json.MarshalIndent(report, "", "\t") + } else { + buf, _ = json.Marshal(report) } + + r.Write(buf) }