From 0287d91378f146a0d2f59310d5c7f4cd78f37991 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Tue, 1 Aug 2023 13:03:34 +0300 Subject: [PATCH] [#550] cli: make get-op-log meta pretty formatted Close #550 Signed-off-by: Airat Arifullin a.arifullin@yadro.com --- cmd/frostfs-cli/modules/tree/get_op_log.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cmd/frostfs-cli/modules/tree/get_op_log.go b/cmd/frostfs-cli/modules/tree/get_op_log.go index 6efa76133..b1b307f62 100644 --- a/cmd/frostfs-cli/modules/tree/get_op_log.go +++ b/cmd/frostfs-cli/modules/tree/get_op_log.go @@ -8,6 +8,7 @@ import ( "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags" "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/key" commonCmd "git.frostfs.info/TrueCloudLab/frostfs-node/cmd/internal/common" + "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/local_object_storage/pilorama" "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/services/tree" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" "github.com/spf13/cobra" @@ -75,7 +76,15 @@ func getOpLog(cmd *cobra.Command, _ []string) { cmd.Println("Parent ID: ", o.GetParentId()) cmd.Println("\tChild ID: ", o.GetChildId()) - cmd.Printf("\tMeta: %s\n", o.GetMeta()) + + m := &pilorama.Meta{} + err = m.FromBytes(o.GetMeta()) + commonCmd.ExitOnErr(cmd, "could not unmarshal meta: %w", err) + cmd.Printf("\tMeta:\n") + cmd.Printf("\t\tTime: %d\n", m.Time) + for _, item := range m.Items { + cmd.Printf("\t\t%s: %s\n", item.Key, item.Value) + } } if !errors.Is(err, io.EOF) { commonCmd.ExitOnErr(cmd, "get op log response stream: %w", err)