[#1383] neofs-cli: move object command to a separate package

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-06-01 15:42:28 +03:00 committed by fyrchik
parent 12bc5607f7
commit a219e3a667
15 changed files with 1237 additions and 1190 deletions

View file

@ -1,11 +1,14 @@
package common
import (
"encoding/hex"
"fmt"
"strconv"
"time"
"github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/commonflags"
"github.com/nspcc-dev/neofs-sdk-go/checksum"
"github.com/spf13/cobra"
"github.com/spf13/viper"
)
@ -28,3 +31,17 @@ func PrettyPrintUnixTime(s string) string {
return timestamp.String()
}
// PrintChecksum prints checksum.
func PrintChecksum(cmd *cobra.Command, name string, recv func() (checksum.Checksum, bool)) {
var strVal string
cs, csSet := recv()
if csSet {
strVal = hex.EncodeToString(cs.Value())
} else {
strVal = "<empty>"
}
cmd.Printf("%s: %s\n", name, strVal)
}