diff --git a/cmd/frostfs-cli/internal/commonflags/flags.go b/cmd/frostfs-cli/internal/commonflags/flags.go index 5049dc3b1..6915ef42b 100644 --- a/cmd/frostfs-cli/internal/commonflags/flags.go +++ b/cmd/frostfs-cli/internal/commonflags/flags.go @@ -11,9 +11,9 @@ import ( // values and their usage descriptions. const ( GenerateKey = "generate-key" - generateKeyShorthand = "g" - generateKeyDefault = false - generateKeyUsage = "Generate new private key" + GenerateKeyShorthand = "g" + GenerateKeyDefault = false + GenerateKeyUsage = "Generate new private key" WalletPath = "wallet" WalletPathShorthand = "w" @@ -72,7 +72,7 @@ func Init(cmd *cobra.Command) { func InitWithoutRPC(cmd *cobra.Command) { ff := cmd.Flags() - ff.BoolP(GenerateKey, generateKeyShorthand, generateKeyDefault, generateKeyUsage) + ff.BoolP(GenerateKey, GenerateKeyShorthand, GenerateKeyDefault, GenerateKeyUsage) ff.StringP(WalletPath, WalletPathShorthand, WalletPathDefault, WalletPathUsage) ff.StringP(Account, AccountShorthand, AccountDefault, AccountUsage) } diff --git a/cmd/frostfs-cli/modules/container/list.go b/cmd/frostfs-cli/modules/container/list.go index 8f5db49df..a1410d7a0 100644 --- a/cmd/frostfs-cli/modules/container/list.go +++ b/cmd/frostfs-cli/modules/container/list.go @@ -18,6 +18,8 @@ const ( flagListPrintAttr = "with-attr" flagListContainerOwner = "owner" flagListName = "name" + + generateKeyContainerUsage = commonflags.GenerateKeyUsage + ", should be used with --owner flag" ) // flag vars of list command. @@ -34,6 +36,11 @@ var listContainersCmd = &cobra.Command{ Run: func(cmd *cobra.Command, _ []string) { var idUser user.ID + generateKey, _ := cmd.Flags().GetBool(commonflags.GenerateKey) + if flagVarListContainerOwner == "" && generateKey { + cmd.PrintErrln("WARN: using -g without --owner - output will be empty") + } + key := key.GetOrGenerate(cmd) if flagVarListContainerOwner == "" { @@ -104,4 +111,5 @@ func initContainerListContainersCmd() { flags.BoolVar(&flagVarListPrintAttr, flagListPrintAttr, false, "Request and print attributes of each container", ) + flags.Lookup(commonflags.GenerateKey).Usage = generateKeyContainerUsage }