diff --git a/index.js b/index.js index 0fb07e0f..cf9b254d 100644 --- a/index.js +++ b/index.js @@ -140,7 +140,14 @@ async function fetchLegitifyReleaseUrl(baseVersion) { function breakStringToParams(str) { const pattern = /(-{1,2}\S+)(?:\s+((?!\s*-).+?)(?=\s+-{1,2}|\s*$))?/g; - return str.match(pattern) + const matches = str.matchAll(pattern) + let args = [] + + for (const m of matches) { + args.push(m[1], m[2]) + } + + return args } function generateAnalyzeArgs(repo, owner) { diff --git a/internal/common/namespace/namespace.go b/internal/common/namespace/namespace.go index 3947169d..584892d6 100644 --- a/internal/common/namespace/namespace.go +++ b/internal/common/namespace/namespace.go @@ -1,6 +1,9 @@ package namespace -import "fmt" +import ( + "fmt" + "strings" +) type Namespace = string @@ -25,15 +28,16 @@ var All = []Namespace{ func ValidateNamespaces(namespace []Namespace) error { for _, ns := range namespace { found := false + trimmed := strings.Trim(ns, " ") for _, e := range All { - if e == ns { + if e == trimmed { found = true break } } if !found { - return fmt.Errorf("invalid namespace %s", ns) + return fmt.Errorf("invalid namespace %s", trimmed) } }