[#1962] cli: common.PrintVerbose prints via cobra.Command.Printf

Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
Anton Nikiforov 2022-12-27 12:36:30 +03:00 committed by fyrchik
parent cff4184cd3
commit 8ee590794f
24 changed files with 116 additions and 134 deletions

View file

@ -1,8 +1,6 @@
package util
import (
"bytes"
"encoding/json"
"os"
"github.com/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/common"
@ -45,7 +43,7 @@ func convertEACLTable(cmd *cobra.Command, _ []string) {
}
if len(to) == 0 {
prettyPrintJSON(cmd, data)
common.PrettyPrintJSON(cmd, table, "eACL")
return
}
@ -54,12 +52,3 @@ func convertEACLTable(cmd *cobra.Command, _ []string) {
cmd.Printf("extended ACL table was successfully dumped to %s\n", to)
}
func prettyPrintJSON(cmd *cobra.Command, data []byte) {
buf := new(bytes.Buffer)
if err := json.Indent(buf, data, "", " "); err != nil {
common.PrintVerbose("Can't pretty print json: %w", err)
}
cmd.Println(buf)
}