From a4012f5337619774a452adc9712604d5a41805bb Mon Sep 17 00:00:00 2001 From: noamd Date: Sun, 14 Apr 2024 17:57:49 +0300 Subject: [PATCH 1/4] fix extra args --- index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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) { From 030b10a072fc6ec531799fded4006b8b31c83b4d Mon Sep 17 00:00:00 2001 From: noamd Date: Sun, 14 Apr 2024 18:09:18 +0300 Subject: [PATCH 2/4] trim white spaces --- internal/common/namespace/namespace.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/common/namespace/namespace.go b/internal/common/namespace/namespace.go index 3947169d..07d6b93b 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,6 +28,7 @@ var All = []Namespace{ func ValidateNamespaces(namespace []Namespace) error { for _, ns := range namespace { found := false + ns = strings.TrimSpace(ns) for _, e := range All { if e == ns { found = true From 384cef29715b0297253222b3532ebb94af8aa045 Mon Sep 17 00:00:00 2001 From: noamd Date: Sun, 14 Apr 2024 18:14:37 +0300 Subject: [PATCH 3/4] trim --- internal/common/namespace/namespace.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/common/namespace/namespace.go b/internal/common/namespace/namespace.go index 07d6b93b..661d3ae5 100644 --- a/internal/common/namespace/namespace.go +++ b/internal/common/namespace/namespace.go @@ -28,16 +28,16 @@ var All = []Namespace{ func ValidateNamespaces(namespace []Namespace) error { for _, ns := range namespace { found := false - ns = strings.TrimSpace(ns) + trimmed := strings.TrimSpace(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) } } From 89fc156bdb70ca4fab9553605cb8e5a2737a805b Mon Sep 17 00:00:00 2001 From: noamd Date: Sun, 14 Apr 2024 18:18:44 +0300 Subject: [PATCH 4/4] trim again --- internal/common/namespace/namespace.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/common/namespace/namespace.go b/internal/common/namespace/namespace.go index 661d3ae5..584892d6 100644 --- a/internal/common/namespace/namespace.go +++ b/internal/common/namespace/namespace.go @@ -28,7 +28,7 @@ var All = []Namespace{ func ValidateNamespaces(namespace []Namespace) error { for _, ns := range namespace { found := false - trimmed := strings.TrimSpace(ns) + trimmed := strings.Trim(ns, " ") for _, e := range All { if e == trimmed { found = true