[#808] cli: Use MarkFlagsOneRequired after cobra update
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
9b2758baf1
commit
4b12239809
1 changed files with 1 additions and 6 deletions
|
@ -1,8 +1,6 @@
|
||||||
package control
|
package control
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
|
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs"
|
||||||
rawclient "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client"
|
rawclient "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client"
|
||||||
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags"
|
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-cli/internal/commonflags"
|
||||||
|
@ -35,6 +33,7 @@ func initControlIRRemoveContainerCmd() {
|
||||||
flags.String(commonflags.CIDFlag, "", commonflags.CIDFlagUsage)
|
flags.String(commonflags.CIDFlag, "", commonflags.CIDFlagUsage)
|
||||||
flags.String(ownerFlag, "", "Container owner's wallet address.")
|
flags.String(ownerFlag, "", "Container owner's wallet address.")
|
||||||
removeContainerCmd.MarkFlagsMutuallyExclusive(commonflags.CIDFlag, ownerFlag)
|
removeContainerCmd.MarkFlagsMutuallyExclusive(commonflags.CIDFlag, ownerFlag)
|
||||||
|
removeContainerCmd.MarkFlagsOneRequired(commonflags.CIDFlag, ownerFlag)
|
||||||
}
|
}
|
||||||
|
|
||||||
func removeContainer(cmd *cobra.Command, _ []string) {
|
func removeContainer(cmd *cobra.Command, _ []string) {
|
||||||
|
@ -74,10 +73,6 @@ func prepareRemoveContainerRequest(cmd *cobra.Command) *ircontrol.RemoveContaine
|
||||||
ownerStr, err := cmd.Flags().GetString(ownerFlag)
|
ownerStr, err := cmd.Flags().GetString(ownerFlag)
|
||||||
commonCmd.ExitOnErr(cmd, "failed to get owner: ", err)
|
commonCmd.ExitOnErr(cmd, "failed to get owner: ", err)
|
||||||
|
|
||||||
if len(ownerStr) == 0 && len(cidStr) == 0 {
|
|
||||||
commonCmd.ExitOnErr(cmd, "invalid usage: %w", errors.New("neither owner's wallet address nor container ID are specified"))
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(ownerStr) > 0 {
|
if len(ownerStr) > 0 {
|
||||||
var owner user.ID
|
var owner user.ID
|
||||||
commonCmd.ExitOnErr(cmd, "invalid owner ID: %w", owner.DecodeString(ownerStr))
|
commonCmd.ExitOnErr(cmd, "invalid owner ID: %w", owner.DecodeString(ownerStr))
|
||||||
|
|
Loading…
Reference in a new issue