[#1570] cli: Use array type for attributes parameters
Some checks failed
DCO action / DCO (pull_request) Successful in 32s
Vulncheck / Vulncheck (pull_request) Failing after 59s
Pre-commit hooks / Pre-commit (pull_request) Successful in 1m25s
Build / Build Components (pull_request) Successful in 1m37s
Tests and linters / Run gofumpt (pull_request) Successful in 2m14s
Tests and linters / gopls check (pull_request) Successful in 2m19s
Tests and linters / Staticcheck (pull_request) Successful in 2m39s
Tests and linters / Tests (pull_request) Successful in 3m0s
Tests and linters / Lint (pull_request) Successful in 3m22s
Tests and linters / Tests with -race (pull_request) Successful in 3m51s
Tests and linters / Run gofumpt (push) Successful in 24s
Vulncheck / Vulncheck (push) Failing after 1m8s
Pre-commit hooks / Pre-commit (push) Successful in 1m20s
Build / Build Components (push) Successful in 2m13s
Tests and linters / Staticcheck (push) Successful in 2m26s
Tests and linters / Tests (push) Successful in 3m6s
Tests and linters / Lint (push) Successful in 3m13s
Tests and linters / Tests with -race (push) Successful in 3m23s
Tests and linters / gopls check (push) Successful in 3m47s
OCI image / Build container images (push) Successful in 4m28s

Signed-off-by: Ekaterina Lebedeva <ekaterina.lebedeva@yadro.com>
This commit is contained in:
Ekaterina Lebedeva 2025-01-24 16:54:27 +03:00
parent 603015d029
commit a788d44773
2 changed files with 8 additions and 12 deletions

View file

@ -50,7 +50,7 @@ func initObjectPutCmd() {
flags.String(commonflags.CIDFlag, "", commonflags.CIDFlagUsage)
flags.String("attributes", "", "User attributes in form of Key1=Value1,Key2=Value2")
flags.StringSlice("attributes", nil, "User attributes in form of Key1=Value1,Key2=Value2")
flags.Bool("disable-filename", false, "Do not set well-known filename attribute")
flags.Bool("disable-timestamp", false, "Do not set well-known timestamp attribute")
flags.Uint64VarP(&putExpiredOn, commonflags.ExpireAt, "e", 0, "The last active epoch in the life of the object")
@ -214,11 +214,9 @@ func getAllObjectAttributes(cmd *cobra.Command) []objectSDK.Attribute {
}
func parseObjectAttrs(cmd *cobra.Command) ([]objectSDK.Attribute, error) {
var rawAttrs []string
raw := cmd.Flag("attributes").Value.String()
if len(raw) != 0 {
rawAttrs = strings.Split(raw, ",")
rawAttrs, err := cmd.Flags().GetStringSlice("attributes")
if err != nil {
return nil, err
}
attrs := make([]objectSDK.Attribute, len(rawAttrs), len(rawAttrs)+2) // name + timestamp attributes