From 1dd8fef4b350e4ebfc737d69183130db4e3ed2a3 Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Fri, 1 Apr 2022 07:59:53 +0200 Subject: [PATCH] Fix compose file argument fix #7 --- cmd/main.go | 2 ++ cmd/utils.go | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/cmd/main.go b/cmd/main.go index 1b0df68..fd79e07 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -5,6 +5,7 @@ import ( "katenary/generator/writers" "katenary/helm" "katenary/update" + "log" "strconv" "github.com/spf13/cobra" @@ -70,6 +71,7 @@ func main() { if err != nil { writers.IndentSize = indentation } + log.Println("ComposeFile:", composeFile) Convert(composeFile, appversion, appName, chartDir, force) }, } diff --git a/cmd/utils.go b/cmd/utils.go index 3b68e7d..60e790a 100644 --- a/cmd/utils.go +++ b/cmd/utils.go @@ -93,9 +93,12 @@ func detectGitVersion() (string, error) { } func Convert(composeFile, appVersion, appName, chartDir string, force bool) { - composeFound := FindComposeFile() + if len(composeFile) == 0 { + fmt.Println("No compose file given") + return + } _, err := os.Stat(ComposeFile) - if !composeFound && err != nil { + if err != nil { fmt.Println("No compose file found") os.Exit(1) } @@ -131,7 +134,7 @@ func Convert(composeFile, appVersion, appName, chartDir string, force bool) { } // Parse the compose file now - p := compose.NewParser(ComposeFile) + p := compose.NewParser(composeFile) p.Parse(appName) // start generator