Fix names + color activation
This commit is contained in:
14
main.go
14
main.go
@@ -9,6 +9,7 @@ import (
|
||||
"katenary/helm"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
@@ -20,6 +21,8 @@ var AppVersion = "0.0.1"
|
||||
var Version = "master"
|
||||
var ChartsDir = "chart"
|
||||
|
||||
var PrefixRE = regexp.MustCompile(`\{\{.*\}\}-?`)
|
||||
|
||||
func main() {
|
||||
flag.StringVar(&ChartsDir, "chart-dir", ChartsDir, "set the chart directory")
|
||||
flag.StringVar(&ComposeFile, "compose", ComposeFile, "set the compose file to parse")
|
||||
@@ -163,6 +166,17 @@ func main() {
|
||||
}
|
||||
fp.Close()
|
||||
|
||||
case *helm.ConfigMap, *helm.Secret:
|
||||
// there could be several files, so let's force the filename
|
||||
name := c.(helm.Named).Name()
|
||||
name = PrefixRE.ReplaceAllString(name, "")
|
||||
fname := filepath.Join(templatesDir, n+"."+name+"."+kind+".yaml")
|
||||
fp, _ := os.Create(fname)
|
||||
enc := yaml.NewEncoder(fp)
|
||||
enc.SetIndent(2)
|
||||
enc.Encode(c)
|
||||
fp.Close()
|
||||
|
||||
default:
|
||||
fname := filepath.Join(templatesDir, n+"."+kind+".yaml")
|
||||
fp, _ := os.Create(fname)
|
||||
|
Reference in New Issue
Block a user