Fix the compose detection
This commit is contained in:
16
main.go
16
main.go
@@ -19,15 +19,14 @@ var AppName = "MyApp"
|
||||
var Version = "master" // set at build time to the git version/tag
|
||||
var ChartsDir = "chart"
|
||||
|
||||
func findComposeFile() {
|
||||
func findComposeFile() bool {
|
||||
for _, file := range composeFiles {
|
||||
if _, err := os.Stat(file); err == nil {
|
||||
ComposeFile = file
|
||||
return
|
||||
return true
|
||||
}
|
||||
}
|
||||
fmt.Printf("No compose file found in %s\n", composeFiles)
|
||||
os.Exit(1)
|
||||
return false
|
||||
}
|
||||
|
||||
func detectGitVersion() (string, error) {
|
||||
@@ -81,7 +80,8 @@ func main() {
|
||||
}
|
||||
|
||||
// flags
|
||||
findComposeFile()
|
||||
composeFound := findComposeFile()
|
||||
|
||||
flag.StringVar(&ChartsDir, "chart-dir", ChartsDir, "set the chart directory")
|
||||
flag.StringVar(&ComposeFile, "compose", ComposeFile, "set the compose file to parse")
|
||||
flag.StringVar(&AppName, "appname", helm.GetProjectName(), "set the helm chart app name")
|
||||
@@ -96,6 +96,12 @@ func main() {
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
_, err := os.Stat(ComposeFile)
|
||||
if !composeFound && err != nil {
|
||||
fmt.Println("No compose file found")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
dirname := filepath.Join(ChartsDir, AppName)
|
||||
if _, err := os.Stat(dirname); err == nil && !*force {
|
||||
response := ""
|
||||
|
Reference in New Issue
Block a user