Better override list and documentation

This commit is contained in:
2024-04-19 22:26:45 +02:00
parent 58d19cce52
commit ec62a79d82
2 changed files with 16 additions and 3 deletions

View File

@@ -152,7 +152,7 @@ func generateConvertCommand() *cobra.Command {
convertCmd.Flags().BoolVarP(&helmdepUpdate, "helm-update", "u", helmdepUpdate, "Update helm dependencies if helm is installed")
convertCmd.Flags().StringSliceVarP(&profiles, "profile", "p", profiles, "Specify the profiles to use")
convertCmd.Flags().StringVarP(&outputDir, "output-dir", "o", outputDir, "Specify the output directory")
convertCmd.Flags().StringSliceVarP(&dockerComposeFile, "compose-file", "c", cli.DefaultFileNames, "Specify an alternate compose files - can be specified multiple times or use coma to separate them")
convertCmd.Flags().StringSliceVarP(&dockerComposeFile, "compose-file", "c", cli.DefaultFileNames, "Specify an alternate compose files - can be specified multiple times or use coma to separate them.\nNote that overides files are also used whatever the files you specify here.\nThe overides files are:\n"+strings.Join(cli.DefaultOverrideFileNames, ", \n")+"\n")
convertCmd.Flags().StringVarP(&givenAppVersion, "app-version", "a", "", "Specify the app version (in Chart.yaml)")
convertCmd.Flags().StringVarP(&chartVersion, "chart-version", "v", chartVersion, "Specify the chart version (in Chart.yaml)")
return convertCmd

View File

@@ -6,10 +6,23 @@ import (
"github.com/compose-spec/compose-go/types"
)
func init() {
// prepend compose.katenary.yaml to the list of default override file names
cli.DefaultOverrideFileNames = append([]string{
"compose.katenary.yml",
"compose.katenary.yaml",
}, cli.DefaultOverrideFileNames...)
cli.DefaultOverrideFileNames = append(cli.DefaultOverrideFileNames,
[]string{
"podman-compose.katenary.yml",
"podman-compose.katenary.yaml",
"podman-compose.yml",
"podman-compose.yaml",
}...)
}
// Parse compose files and return a project. The project is parsed with dotenv, osenv and profiles.
func Parse(profiles []string, dockerComposeFile ...string) (*types.Project, error) {
cli.DefaultOverrideFileNames = append(cli.DefaultOverrideFileNames, "compose.katenary.yaml")
if len(dockerComposeFile) == 0 {
cli.DefaultOverrideFileNames = append(cli.DefaultOverrideFileNames, dockerComposeFile...)
}