diff --git a/doc/docs/packages/internal/generator.md b/doc/docs/packages/internal/generator.md
index 2633692..0fe06c1 100644
--- a/doc/docs/packages/internal/generator.md
+++ b/doc/docs/packages/internal/generator.md
@@ -35,7 +35,7 @@ var Version = "master" // changed at compile time
```
-## func [Convert]()
+## func [Convert]()
```go
func Convert(config ConvertOptions, dockerComposeFile ...string) error
@@ -107,7 +107,7 @@ func UnWrapTPL(in []byte) []byte
UnWrapTPL removes the line wrapping from a template.
-## type [ChartTemplate]()
+## type [ChartTemplate]()
ChartTemplate is a template of a chart. It contains the content of the template and the name of the service. This is used internally to generate the templates.
@@ -119,7 +119,7 @@ type ChartTemplate struct {
```
-## type [ConfigMap]()
+## type [ConfigMap]()
ConfigMap is a kubernetes ConfigMap. Implements the DataMap interface.
@@ -131,7 +131,7 @@ type ConfigMap struct {
```
-### func [NewConfigMap]()
+### func [NewConfigMap]()
```go
func NewConfigMap(service types.ServiceConfig, appName string, forFile bool) *ConfigMap
@@ -140,7 +140,7 @@ func NewConfigMap(service types.ServiceConfig, appName string, forFile bool) *Co
NewConfigMap creates a new ConfigMap from a compose service. The appName is the name of the application taken from the project name. The ConfigMap is filled by environment variables and labels "map\-env".
-### func [NewConfigMapFromDirectory]()
+### func [NewConfigMapFromDirectory]()
```go
func NewConfigMapFromDirectory(service types.ServiceConfig, appName, path string) *ConfigMap
@@ -149,7 +149,7 @@ func NewConfigMapFromDirectory(service types.ServiceConfig, appName, path string
NewConfigMapFromDirectory creates a new ConfigMap from a compose service. This path is the path to the file or directory. If the path is a directory, all files in the directory are added to the ConfigMap. Each subdirectory are ignored. Note that the Generate\(\) function will create the subdirectories ConfigMaps.
-### func \(\*ConfigMap\) [AddBinaryData]()
+### func \(\*ConfigMap\) [AddBinaryData]()
```go
func (c *ConfigMap) AddBinaryData(key string, value []byte)
@@ -158,7 +158,7 @@ func (c *ConfigMap) AddBinaryData(key string, value []byte)
AddBinaryData adds binary data to the configmap. Append or overwrite the value if the key already exists.
-### func \(\*ConfigMap\) [AddData]()
+### func \(\*ConfigMap\) [AddData]()
```go
func (c *ConfigMap) AddData(key, value string)
@@ -167,7 +167,7 @@ func (c *ConfigMap) AddData(key, value string)
AddData adds a key value pair to the configmap. Append or overwrite the value if the key already exists.
-### func \(\*ConfigMap\) [AppendDir]()
+### func \(\*ConfigMap\) [AppendDir]()
```go
func (c *ConfigMap) AppendDir(path string) error
@@ -176,7 +176,7 @@ func (c *ConfigMap) AppendDir(path string) error
AppendDir adds files from given path to the configmap. It is not recursive, to add all files in a directory, you need to call this function for each subdirectory.
-### func \(\*ConfigMap\) [AppendFile]()
+### func \(\*ConfigMap\) [AppendFile]()
```go
func (c *ConfigMap) AppendFile(path string) error
@@ -185,7 +185,7 @@ func (c *ConfigMap) AppendFile(path string) error
-### func \(\*ConfigMap\) [Filename]()
+### func \(\*ConfigMap\) [Filename]()
```go
func (c *ConfigMap) Filename() string
@@ -194,7 +194,7 @@ func (c *ConfigMap) Filename() string
Filename returns the filename of the configmap. If the configmap is used for files, the filename contains the path.
-### func \(\*ConfigMap\) [SetData]()
+### func \(\*ConfigMap\) [SetData]()
```go
func (c *ConfigMap) SetData(data map[string]string)
@@ -203,7 +203,7 @@ func (c *ConfigMap) SetData(data map[string]string)
SetData sets the data of the configmap. It replaces the entire data.
-### func \(\*ConfigMap\) [Yaml]()
+### func \(\*ConfigMap\) [Yaml]()
```go
func (c *ConfigMap) Yaml() ([]byte, error)
@@ -212,7 +212,7 @@ func (c *ConfigMap) Yaml() ([]byte, error)
Yaml returns the yaml representation of the configmap
-## type [ConfigMapMount]()
+## type [ConfigMapMount]()
@@ -223,7 +223,7 @@ type ConfigMapMount struct {
```
-## type [ConvertOptions]()
+## type [ConvertOptions]()
ConvertOptions are the options to convert a compose project to a helm chart.
@@ -301,7 +301,7 @@ type DataMap interface {
```
-## type [Deployment]()
+## type [Deployment]()
Deployment is a kubernetes Deployment.
@@ -313,7 +313,7 @@ type Deployment struct {
```
-### func [NewDeployment]()
+### func [NewDeployment]()
```go
func NewDeployment(service types.ServiceConfig, chart *HelmChart) *Deployment
@@ -322,7 +322,7 @@ func NewDeployment(service types.ServiceConfig, chart *HelmChart) *Deployment
NewDeployment creates a new Deployment from a compose service. The appName is the name of the application taken from the project name. It also creates the Values map that will be used to create the values.yaml file.
-### func \(\*Deployment\) [AddContainer]()
+### func \(\*Deployment\) [AddContainer]()
```go
func (d *Deployment) AddContainer(service types.ServiceConfig)
@@ -331,7 +331,7 @@ func (d *Deployment) AddContainer(service types.ServiceConfig)
AddContainer adds a container to the deployment.
-### func \(\*Deployment\) [AddHealthCheck]()
+### func \(\*Deployment\) [AddHealthCheck]()
```go
func (d *Deployment) AddHealthCheck(service types.ServiceConfig, container *corev1.Container)
@@ -340,7 +340,7 @@ func (d *Deployment) AddHealthCheck(service types.ServiceConfig, container *core
-### func \(\*Deployment\) [AddIngress]()
+### func \(\*Deployment\) [AddIngress]()
```go
func (d *Deployment) AddIngress(service types.ServiceConfig, appName string) *Ingress
@@ -349,7 +349,7 @@ func (d *Deployment) AddIngress(service types.ServiceConfig, appName string) *In
AddIngress adds an ingress to the deployment. It creates the ingress object.
-### func \(\*Deployment\) [AddLegacyVolume]()
+### func \(\*Deployment\) [AddLegacyVolume]()
```go
func (d *Deployment) AddLegacyVolume(name, kind string)
@@ -358,7 +358,7 @@ func (d *Deployment) AddLegacyVolume(name, kind string)
-### func \(\*Deployment\) [AddVolumes]()
+### func \(\*Deployment\) [AddVolumes]()
```go
func (d *Deployment) AddVolumes(service types.ServiceConfig, appName string)
@@ -367,7 +367,7 @@ func (d *Deployment) AddVolumes(service types.ServiceConfig, appName string)
AddVolumes adds a volume to the deployment. It does not create the PVC, it only adds the volumes to the deployment. If the volume is a bind volume it will warn the user that it is not supported yet.
-### func \(\*Deployment\) [BindFrom]()
+### func \(\*Deployment\) [BindFrom]()
```go
func (d *Deployment) BindFrom(service types.ServiceConfig, binded *Deployment)
@@ -376,7 +376,7 @@ func (d *Deployment) BindFrom(service types.ServiceConfig, binded *Deployment)
-### func \(\*Deployment\) [BindMapFilesToContainer]()
+### func \(\*Deployment\) [BindMapFilesToContainer]()
```go
func (d *Deployment) BindMapFilesToContainer(service types.ServiceConfig, secrets []string, appName string) (*corev1.Container, int)
@@ -385,7 +385,7 @@ func (d *Deployment) BindMapFilesToContainer(service types.ServiceConfig, secret
-### func \(\*Deployment\) [DependsOn]()
+### func \(\*Deployment\) [DependsOn]()
```go
func (d *Deployment) DependsOn(to *Deployment, servicename string) error
@@ -394,7 +394,7 @@ func (d *Deployment) DependsOn(to *Deployment, servicename string) error
DependsOn adds a initContainer to the deployment that will wait for the service to be up.
-### func \(\*Deployment\) [Filename]()
+### func \(\*Deployment\) [Filename]()
```go
func (d *Deployment) Filename() string
@@ -403,7 +403,7 @@ func (d *Deployment) Filename() string
Filename returns the filename of the deployment.
-### func \(\*Deployment\) [MountExchangeVolumes]()
+### func \(\*Deployment\) [MountExchangeVolumes]()
```go
func (d *Deployment) MountExchangeVolumes()
@@ -412,7 +412,7 @@ func (d *Deployment) MountExchangeVolumes()
-### func \(\*Deployment\) [SetEnvFrom]()
+### func \(\*Deployment\) [SetEnvFrom]()
```go
func (d *Deployment) SetEnvFrom(service types.ServiceConfig, appName string, samePod ...bool)
@@ -421,7 +421,7 @@ func (d *Deployment) SetEnvFrom(service types.ServiceConfig, appName string, sam
SetEnvFrom sets the environment variables to a configmap. The configmap is created.
-### func \(\*Deployment\) [Yaml]()
+### func \(\*Deployment\) [Yaml]()
```go
func (d *Deployment) Yaml() ([]byte, error)
@@ -430,7 +430,7 @@ func (d *Deployment) Yaml() ([]byte, error)
Yaml returns the yaml representation of the deployment.
-## type [FileMapUsage]()
+## type [FileMapUsage]()
FileMapUsage is the usage of the filemap.
@@ -448,7 +448,7 @@ const (
```
-## type [HelmChart]()
+## type [HelmChart]()
HelmChart is a Helm Chart representation. It contains all the templates, values, versions, helpers...
@@ -491,7 +491,7 @@ The Generate function will create the HelmChart object this way:
- Merge the same\-pod services.
-### func [NewChart]()
+### func [NewChart]()
```go
func NewChart(name string) *HelmChart
@@ -500,7 +500,7 @@ func NewChart(name string) *HelmChart
NewChart creates a new empty chart with the given name.
-### func \(\*HelmChart\) [SaveTemplates]()
+### func \(\*HelmChart\) [SaveTemplates]()
```go
func (chart *HelmChart) SaveTemplates(templateDir string)
diff --git a/doc/docs/packages/internal/generator/katenaryfile.md b/doc/docs/packages/internal/generator/katenaryfile.md
index f6fb81c..214133a 100644
--- a/doc/docs/packages/internal/generator/katenaryfile.md
+++ b/doc/docs/packages/internal/generator/katenaryfile.md
@@ -12,7 +12,7 @@ A katenary file, named "katenary.yml" or "katenary.yaml", is a file where you ca
Formely, the file describe the same structure as in labels, and so that can be validated and completed by LSP. It also ease the use of katenary.
-## func [GenerateSchema]()
+## func [GenerateSchema]()
```go
func GenerateSchema() string
@@ -21,7 +21,7 @@ func GenerateSchema() string
GenerateSchema generates the schema for the katenary.yaml file.
-## func [OverrideWithConfig]()
+## func [OverrideWithConfig]()
```go
func OverrideWithConfig(project *types.Project)
@@ -30,7 +30,7 @@ func OverrideWithConfig(project *types.Project)
OverrideWithConfig overrides the project with the katenary.yaml file. It will set the labels of the services with the values from the katenary.yaml file. It work in memory, so it will not modify the original project.
-## type [Service]()
+## type [Service]()
Service is a struct that contains the service configuration for katenary
@@ -56,7 +56,7 @@ type Service struct {
```
-## type [StringOrMap]()
+## type [StringOrMap]()
StringOrMap is a struct that can be either a string or a map of strings. It's a helper struct to unmarshal the katenary.yaml file and produce the schema
diff --git a/doc/docs/packages/internal/logger.md b/doc/docs/packages/internal/logger.md
new file mode 100644
index 0000000..c1151ab
--- /dev/null
+++ b/doc/docs/packages/internal/logger.md
@@ -0,0 +1,83 @@
+
+
+# logger
+
+```go
+import "katenary.io/internal/logger"
+```
+
+Package logger provides simple logging functions with icons and colors.
+
+## func [Failure]()
+
+```go
+func Failure(msg ...any)
+```
+
+Failure prints a failure message.
+
+
+## func [Info]()
+
+```go
+func Info(msg ...any)
+```
+
+Info prints an informational message.
+
+
+## func [Log]()
+
+```go
+func Log(icon Icon, msg ...any)
+```
+
+Log prints a message with a custom icon.
+
+
+## func [Success]()
+
+```go
+func Success(msg ...any)
+```
+
+Success prints a success message.
+
+
+## func [Warn]()
+
+```go
+func Warn(msg ...any)
+```
+
+Warn prints a warning message.
+
+
+## type [Icon]()
+
+Icon is a unicode icon
+
+```go
+type Icon string
+```
+
+Icons used in katenary.
+
+```go
+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 = "🔗"
+)
+```
+
+Generated by [gomarkdoc]()
diff --git a/doc/docs/packages/internal/utils.md b/doc/docs/packages/internal/utils.md
index c24a866..a2f27bd 100644
--- a/doc/docs/packages/internal/utils.md
+++ b/doc/docs/packages/internal/utils.md
@@ -17,7 +17,7 @@ const DirectoryPermission = 0o755
```
-## func [AsResourceName]()
+## func [AsResourceName]()
```go
func AsResourceName(name string) string
@@ -26,16 +26,16 @@ func AsResourceName(name string) string
AsResourceName returns a resource name with underscores to respect the kubernetes naming convention. It's the opposite of FixedResourceName.
-## func [Confirm]()
+## func [Confirm]()
```go
-func Confirm(question string, icon ...Icon) bool
+func Confirm(question string, icon ...logger.Icon) bool
```
Confirm asks a question and returns true if the answer is y.
-## func [CountStartingSpaces]()
+## func [CountStartingSpaces]()
```go
func CountStartingSpaces(line string) int
@@ -44,7 +44,7 @@ func CountStartingSpaces(line string) int
CountStartingSpaces counts the number of spaces at the beginning of a string.
-## func [EncodeBasicYaml]()
+## func [EncodeBasicYaml]()
```go
func EncodeBasicYaml(data any) ([]byte, error)
@@ -53,7 +53,7 @@ func EncodeBasicYaml(data any) ([]byte, error)
EncodeBasicYaml encodes a basic yaml from an interface.
-## func [FixedResourceName]()
+## func [FixedResourceName]()
```go
func FixedResourceName(name string) string
@@ -62,7 +62,7 @@ func FixedResourceName(name string) string
FixedResourceName returns a resource name without underscores to respect the kubernetes naming convention.
-## func [GetContainerByName]()
+## func [GetContainerByName]()
```go
func GetContainerByName(name string, containers []corev1.Container) (*corev1.Container, int)
@@ -71,7 +71,7 @@ func GetContainerByName(name string, containers []corev1.Container) (*corev1.Con
GetContainerByName returns a container by name and its index in the array. It returns nil, \-1 if not found.
-## func [GetKind]()
+## func [GetKind]()
```go
func GetKind(path string) (kind string)
@@ -80,7 +80,7 @@ func GetKind(path string) (kind string)
GetKind returns the kind of the resource from the file path.
-## func [GetServiceNameByPort]()
+## func [GetServiceNameByPort]()
```go
func GetServiceNameByPort(port int) string
@@ -89,7 +89,7 @@ func GetServiceNameByPort(port int) string
GetServiceNameByPort returns the service name for a port. It the service name is not found, it returns an empty string.
-## func [GetValuesFromLabel]()
+## func [GetValuesFromLabel]()
```go
func GetValuesFromLabel(service types.ServiceConfig, LabelValues string) map[string]*EnvConfig
@@ -107,7 +107,7 @@ func HashComposefiles(files []string) (string, error)
HashComposefiles returns a hash of the compose files.
-## func [Int32Ptr]()
+## func [Int32Ptr]()
```go
func Int32Ptr(i int32) *int32
@@ -116,7 +116,7 @@ func Int32Ptr(i int32) *int32
Int32Ptr returns a pointer to an int32.
-## func [PathToName]()
+## func [PathToName]()
```go
func PathToName(path string) string
@@ -125,7 +125,7 @@ func PathToName(path string) string
PathToName converts a path to a kubernetes complient name.
-## func [StrPtr]()
+## func [StrPtr]()
```go
func StrPtr(s string) *string
@@ -134,7 +134,7 @@ func StrPtr(s string) *string
StrPtr returns a pointer to a string.
-## func [TplName]()
+## func [TplName]()
```go
func TplName(serviceName, appname string, suffix ...string) string
@@ -143,7 +143,7 @@ func TplName(serviceName, appname string, suffix ...string) string
TplName returns the name of the kubernetes resource as a template string. It is used in the templates and defined in \_helper.tpl file.
-## func [TplValue]()
+## func [TplValue]()
```go
func TplValue(serviceName, variable string, pipes ...string) string
@@ -151,17 +151,8 @@ func TplValue(serviceName, variable string, pipes ...string) string
TplValue returns a string that can be used in a template to access a value from the values file.
-
-## func [Warn]()
-
-```go
-func Warn(msg ...any)
-```
-
-Warn prints a warning message
-
-## func [WordWrap]()
+## func [WordWrap]()
```go
func WordWrap(text string, lineWidth int) string
@@ -170,7 +161,7 @@ func WordWrap(text string, lineWidth int) string
WordWrap wraps a string to a given line width. Warning: it may break the string. You need to check the result.
-## func [Wrap]()
+## func [Wrap]()
```go
func Wrap(src, above, below string) string
@@ -179,7 +170,7 @@ func Wrap(src, above, below string) string
Wrap wraps a string with a string above and below. It will respect the indentation of the src string.
-## type [EnvConfig]()
+## type [EnvConfig]()
EnvConfig is a struct to hold the description of an environment variable.
@@ -190,32 +181,4 @@ type EnvConfig struct {
}
```
-
-## type [Icon]()
-
-Icon is a unicode icon
-
-```go
-type Icon string
-```
-
-Icons used in katenary.
-
-```go
-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 = "🔗"
-)
-```
-
Generated by [gomarkdoc]()
diff --git a/internal/logger/logger.go b/internal/logger/logger.go
index 0cc0993..45c9f91 100644
--- a/internal/logger/logger.go
+++ b/internal/logger/logger.go
@@ -22,26 +22,30 @@ const (
const reset = "\033[0m"
+// Info prints an informational message.
func Info(msg ...any) {
message("", IconInfo, msg...)
}
-// Warn prints a warning message
+// Warn prints a warning message.
func Warn(msg ...any) {
orange := "\033[38;5;214m"
message(orange, IconWarning, msg...)
}
+// Success prints a success message.
func Success(msg ...any) {
green := "\033[38;5;34m"
message(green, IconSuccess, msg...)
}
+// Failure prints a failure message.
func Failure(msg ...any) {
red := "\033[38;5;196m"
message(red, IconFailure, msg...)
}
+// Log prints a message with a custom icon.
func Log(icon Icon, msg ...any) {
message("", icon, msg...)
}