Skip to content

Commit

Permalink
bug: allows comma separated scopes #458 (#517)
Browse files Browse the repository at this point in the history
  • Loading branch information
srinandan authored Jul 29, 2024
1 parent db9e77a commit ad4b048
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/cmd/products/crtprod.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package products

import (
"internal/apiclient"
"strings"

"internal/client/products"

Expand All @@ -36,6 +37,11 @@ var CreateCmd = &cobra.Command{

p := products.APIProduct{}

// if the user provides scope as comma separated values then handle it
if len(scopes) != 0 && strings.Contains(scopes[0], ",") {
scopes = append(scopes[1:], strings.Split(scopes[0], ",")...)
}

p.Name = name
p.DisplayName = displayName
p.ApprovalType = approval
Expand Down
6 changes: 6 additions & 0 deletions internal/cmd/products/updprod.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package products

import (
"internal/apiclient"
"strings"

"internal/client/products"

Expand All @@ -36,6 +37,11 @@ var UpdateCmd = &cobra.Command{

p := products.APIProduct{}

// if the user provides scope as comma separated values then handle it
if len(scopes) != 0 && strings.Contains(scopes[0], ",") {
scopes = append(scopes[1:], strings.Split(scopes[0], ",")...)
}

p.Name = name
p.DisplayName = displayName
p.ApprovalType = approval
Expand Down

0 comments on commit ad4b048

Please sign in to comment.