[#1384] neofs-cli: move storagegroup
command to a separate package
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
a219e3a667
commit
fd48b96082
8 changed files with 381 additions and 343 deletions
28
cmd/neofs-cli/modules/storagegroup/util.go
Normal file
28
cmd/neofs-cli/modules/storagegroup/util.go
Normal file
|
@ -0,0 +1,28 @@
|
|||
package storagegroup
|
||||
|
||||
import (
|
||||
"github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/common"
|
||||
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
|
||||
oid "github.com/nspcc-dev/neofs-sdk-go/object/id"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func readObjectAddress(cmd *cobra.Command, cnr *cid.ID, obj *oid.ID) oid.Address {
|
||||
readCID(cmd, cnr)
|
||||
readSGID(cmd, obj)
|
||||
|
||||
var addr oid.Address
|
||||
addr.SetContainer(*cnr)
|
||||
addr.SetObject(*obj)
|
||||
return addr
|
||||
}
|
||||
|
||||
func readCID(cmd *cobra.Command, id *cid.ID) {
|
||||
err := id.DecodeString(cmd.Flag("cid").Value.String())
|
||||
common.ExitOnErr(cmd, "decode container ID string: %w", err)
|
||||
}
|
||||
|
||||
func readSGID(cmd *cobra.Command, id *oid.ID) {
|
||||
err := id.DecodeString(cmd.Flag("oid").Value.String())
|
||||
common.ExitOnErr(cmd, "decode storage group ID string: %w", err)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue