From 01ed3b6e6d08bfc69e67caeb9b4dc4dec2626d6d Mon Sep 17 00:00:00 2001 From: dusdjhyeon Date: Thu, 27 Jun 2024 15:01:40 +0900 Subject: [PATCH 1/2] Set DisplayName Signed-off-by: dusdjhyeon --- utils/catalog/package.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/utils/catalog/package.go b/utils/catalog/package.go index f94123d7..a28df884 100644 --- a/utils/catalog/package.go +++ b/utils/catalog/package.go @@ -8,7 +8,8 @@ import ( func BuildArtifactHubPkg(name, downloadURL, user, version, createdAt string, catalogData *v1alpha1.CatalogData) *ArtifactHubMetadata { artifacthubPkg := &ArtifactHubMetadata{ - Name: name, + Name: toKebabCase(name), + DisplayName: name, Description: catalogData.PatternInfo, Provider: Provider{ Name: user, @@ -53,3 +54,12 @@ func BuildArtifactHubPkg(name, downloadURL, user, version, createdAt string, cat return artifacthubPkg } + +func toKebabCase(s string) string { + s = strings.ToLower(s) + re := regexp.MustCompile(`\s+`) + s = re.ReplaceAllString(s, " ") + s = strings.ReplaceAll(s, " ", "-") + + return s +} From e147e0d73702977265b024c49da655d9e653b8e3 Mon Sep 17 00:00:00 2001 From: dusdjhyeon Date: Thu, 27 Jun 2024 15:13:28 +0900 Subject: [PATCH 2/2] chore: add import Signed-off-by: dusdjhyeon --- utils/catalog/package.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/catalog/package.go b/utils/catalog/package.go index a28df884..c0860fc4 100644 --- a/utils/catalog/package.go +++ b/utils/catalog/package.go @@ -2,7 +2,8 @@ package catalog import ( "fmt" - + "regexp" + "strings" "github.com/layer5io/meshkit/models/catalog/v1alpha1" )