[#1181] CLI: Simplify object type output

There is no need to switch between object types since `Type` implements
`fmt.Stringer`.

Replace swich-case in `printHeader` with `%s` format notation function.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2022-02-15 08:54:42 +03:00 committed by LeL
parent 2181e033b8
commit 637077a883

View file

@ -861,16 +861,7 @@ func printHeader(cmd *cobra.Command, obj *object.Object) error {
cmd.Printf("Size: %d\n", obj.PayloadSize())
cmd.Printf("HomoHash: %s\n", hex.EncodeToString(obj.PayloadHomomorphicHash().Sum()))
cmd.Printf("Checksum: %s\n", hex.EncodeToString(obj.PayloadChecksum().Sum()))
switch obj.Type() {
case object.TypeRegular:
cmd.Println("Type: regular")
case object.TypeTombstone:
cmd.Println("Type: tombstone")
case object.TypeStorageGroup:
cmd.Println("Type: storage group")
default:
cmd.Println("Type: unknown")
}
cmd.Printf("Type: %s\n", obj.Type())
cmd.Println("Attributes:")
for _, attr := range obj.Attributes() {