chore(tests): enhance output
All checks were successful
Go-Tests / tests (push) Successful in 2m18s
Go-Tests / sonar (push) Successful in 55s

- use a better logger separation
- use tags not not overload the CI output
- removed lot of log.Println/Fatal/Error
This commit is contained in:
2025-09-15 13:02:54 +02:00
parent 9472952d65
commit debe43ce34
14 changed files with 106 additions and 77 deletions

View File

@@ -1,31 +0,0 @@
package utils
import "fmt"
// Icon is a unicode icon
type Icon string
// Icons used in katenary.
const (
IconSuccess Icon = "✅"
IconFailure Icon = "❌"
IconWarning Icon = "❕"
IconNote Icon = "📝"
IconWorld Icon = "🌐"
IconPlug Icon = "🔌"
IconPackage Icon = "📦"
IconCabinet Icon = "🗄️"
IconInfo Icon = "🔵"
IconSecret Icon = "🔒"
IconConfig Icon = "🔧"
IconDependency Icon = "🔗"
)
// Warn prints a warning message
func Warn(msg ...any) {
orange := "\033[38;5;214m"
reset := "\033[0m"
fmt.Print(IconWarning, orange, " ")
fmt.Print(msg...)
fmt.Println(reset)
}

View File

@@ -12,6 +12,7 @@ import (
"github.com/thediveo/netdb"
"gopkg.in/yaml.v3"
corev1 "k8s.io/api/core/v1"
"katenary.io/internal/logger"
)
// DirectoryPermission is the default values for permissions apply to created directories.
@@ -64,7 +65,7 @@ func GetKind(path string) (kind string) {
} else {
kind = strings.Split(path, ".")[1]
}
return
return kind
}
// Wrap wraps a string with a string above and below. It will respect the indentation of the src string.
@@ -161,7 +162,7 @@ func WordWrap(text string, lineWidth int) string {
}
// Confirm asks a question and returns true if the answer is y.
func Confirm(question string, icon ...Icon) bool {
func Confirm(question string, icon ...logger.Icon) bool {
if len(icon) > 0 {
fmt.Printf("%s %s [y/N] ", icon[0], question)
} else {