forked from TrueCloudLab/frostfs-node
[#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:
parent
cff4184cd3
commit
8ee590794f
24 changed files with 116 additions and 134 deletions
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue