[#1384] neofs-cli: move storagegroup command to a separate package

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2022-06-02 15:07:30 +03:00 committed by fyrchik
parent a219e3a667
commit fd48b96082
8 changed files with 381 additions and 343 deletions

View file

@ -0,0 +1,41 @@
package storagegroup
import (
"github.com/nspcc-dev/neofs-node/cmd/neofs-cli/internal/commonflags"
objectCli "github.com/nspcc-dev/neofs-node/cmd/neofs-cli/modules/object"
"github.com/spf13/cobra"
)
// Cmd represents the storagegroup command
var Cmd = &cobra.Command{
Use: "storagegroup",
Short: "Operations with Storage Groups",
Long: `Operations with Storage Groups`,
PersistentPreRun: func(cmd *cobra.Command, args []string) {
// bind exactly that cmd's flags to
// the viper before execution
commonflags.Bind(cmd)
commonflags.BindAPI(cmd)
},
}
func init() {
storageGroupChildCommands := []*cobra.Command{
sgPutCmd,
sgGetCmd,
sgListCmd,
sgDelCmd,
}
Cmd.AddCommand(storageGroupChildCommands...)
for _, sgCommand := range storageGroupChildCommands {
objectCli.InitBearer(sgCommand)
commonflags.InitAPI(sgCommand)
}
initSGPutCmd()
initSGGetCmd()
initSGListCmd()
initSGDeleteCmd()
}