Make "-c" (compose-file) argument repeated
This commit is contained in:
@@ -61,9 +61,9 @@ func main() {
|
|||||||
"- if it's not defined, so the 0.0.1 version is used",
|
"- if it's not defined, so the 0.0.1 version is used",
|
||||||
Run: func(c *cobra.Command, args []string) {
|
Run: func(c *cobra.Command, args []string) {
|
||||||
force := c.Flag("force").Changed
|
force := c.Flag("force").Changed
|
||||||
|
composeFile := c.Flags().StringArrayP("compose-file", "c", []string{}, "compose file to convert, can be use several times to override previous file (default: docker-compose.yml)")
|
||||||
// TODO: is there a way to get typed values from cobra?
|
// TODO: is there a way to get typed values from cobra?
|
||||||
appversion := c.Flag("app-version").Value.String()
|
appversion := c.Flag("app-version").Value.String()
|
||||||
composeFile := c.Flag("compose-file").Value.String()
|
|
||||||
appName := c.Flag("app-name").Value.String()
|
appName := c.Flag("app-name").Value.String()
|
||||||
chartVersion := c.Flag("chart-version").Value.String()
|
chartVersion := c.Flag("chart-version").Value.String()
|
||||||
chartDir := c.Flag("output-dir").Value.String()
|
chartDir := c.Flag("output-dir").Value.String()
|
||||||
@@ -71,7 +71,7 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
writers.IndentSize = indentation
|
writers.IndentSize = indentation
|
||||||
}
|
}
|
||||||
Convert(composeFile, appversion, appName, chartDir, chartVersion, force)
|
Convert(*composeFile, appversion, appName, chartDir, chartVersion, force)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
convertCmd.Flags().BoolP(
|
convertCmd.Flags().BoolP(
|
||||||
|
@@ -93,15 +93,14 @@ func detectGitVersion() (string, error) {
|
|||||||
return defaulVersion, errors.New("git log failed")
|
return defaulVersion, errors.New("git log failed")
|
||||||
}
|
}
|
||||||
|
|
||||||
func Convert(composeFile, appVersion, appName, chartDir, chartVersion string, force bool) {
|
func Convert(composeFile []string, appVersion, appName, chartDir, chartVersion string, force bool) {
|
||||||
if len(composeFile) == 0 {
|
if len(composeFile) == 0 {
|
||||||
fmt.Println("No compose file given")
|
fmt.Println("No compose file given")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
composeFiles := strings.Split(composeFile, ",")
|
for i, c := range composeFile {
|
||||||
for i, c := range composeFiles {
|
composeFile[i] = strings.TrimSpace(c)
|
||||||
composeFiles[i] = strings.TrimSpace(c)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, composeFile := range composeFiles {
|
for _, composeFile := range composeFiles {
|
||||||
|
@@ -127,7 +127,7 @@ func setUp(t *testing.T) (string, *compose.Parser) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
composefile := filepath.Join(tmpwork, "docker-compose.yaml")
|
composefile := filepath.Join(tmpwork, "docker-compose.yaml")
|
||||||
p := compose.NewParser(composefile, DOCKER_COMPOSE_YML)
|
p := compose.NewParser([]string{composefile}, DOCKER_COMPOSE_YML)
|
||||||
|
|
||||||
// create envfile for "useenvfile" service
|
// create envfile for "useenvfile" service
|
||||||
err = os.Mkdir(filepath.Join(tmpwork, "config"), 0777)
|
err = os.Mkdir(filepath.Join(tmpwork, "config"), 0777)
|
||||||
|
Reference in New Issue
Block a user