Merge pull request #525 from docker/workingdir

workdir default value is defined by compose file
This commit is contained in:
Guillaume Tardif 2020-08-21 10:22:31 +02:00 committed by GitHub
commit bff1fa1872
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 7 deletions

View File

@ -21,8 +21,9 @@ import (
"fmt" "fmt"
"github.com/compose-spec/compose-go/cli" "github.com/compose-spec/compose-go/cli"
"github.com/docker/api/client"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/docker/api/client"
) )
func convertCommand() *cobra.Command { func convertCommand() *cobra.Command {
@ -39,7 +40,7 @@ func convertCommand() *cobra.Command {
}, },
} }
convertCmd.Flags().StringVarP(&opts.Name, "project-name", "p", "", "Project name") convertCmd.Flags().StringVarP(&opts.Name, "project-name", "p", "", "Project name")
convertCmd.Flags().StringVar(&opts.WorkingDir, "workdir", ".", "Work dir") convertCmd.Flags().StringVar(&opts.WorkingDir, "workdir", "", "Work dir")
convertCmd.Flags().StringArrayVarP(&opts.ConfigPaths, "file", "f", []string{}, "Compose configuration files") convertCmd.Flags().StringArrayVarP(&opts.ConfigPaths, "file", "f", []string{}, "Compose configuration files")
return convertCmd return convertCmd

View File

@ -34,7 +34,7 @@ func downCommand() *cobra.Command {
}, },
} }
downCmd.Flags().StringVarP(&opts.Name, "project-name", "p", "", "Project name") downCmd.Flags().StringVarP(&opts.Name, "project-name", "p", "", "Project name")
downCmd.Flags().StringVar(&opts.WorkingDir, "workdir", ".", "Work dir") downCmd.Flags().StringVar(&opts.WorkingDir, "workdir", "", "Work dir")
downCmd.Flags().StringArrayVarP(&opts.ConfigPaths, "file", "f", []string{}, "Compose configuration files") downCmd.Flags().StringArrayVarP(&opts.ConfigPaths, "file", "f", []string{}, "Compose configuration files")
return downCmd return downCmd

View File

@ -34,7 +34,7 @@ func logsCommand() *cobra.Command {
}, },
} }
logsCmd.Flags().StringVarP(&opts.Name, "project-name", "p", "", "Project name") logsCmd.Flags().StringVarP(&opts.Name, "project-name", "p", "", "Project name")
logsCmd.Flags().StringVar(&opts.WorkingDir, "workdir", ".", "Work dir") logsCmd.Flags().StringVar(&opts.WorkingDir, "workdir", "", "Work dir")
logsCmd.Flags().StringArrayVarP(&opts.ConfigPaths, "file", "f", []string{}, "Compose configuration files") logsCmd.Flags().StringArrayVarP(&opts.ConfigPaths, "file", "f", []string{}, "Compose configuration files")
return logsCmd return logsCmd

View File

@ -38,7 +38,7 @@ func psCommand() *cobra.Command {
}, },
} }
psCmd.Flags().StringVarP(&opts.Name, "project-name", "p", "", "Project name") psCmd.Flags().StringVarP(&opts.Name, "project-name", "p", "", "Project name")
psCmd.Flags().StringVar(&opts.WorkingDir, "workdir", ".", "Work dir") psCmd.Flags().StringVar(&opts.WorkingDir, "workdir", "", "Work dir")
psCmd.Flags().StringArrayVarP(&opts.ConfigPaths, "file", "f", []string{}, "Compose configuration files") psCmd.Flags().StringArrayVarP(&opts.ConfigPaths, "file", "f", []string{}, "Compose configuration files")
return psCmd return psCmd

View File

@ -34,7 +34,7 @@ func upCommand() *cobra.Command {
}, },
} }
upCmd.Flags().StringVarP(&opts.Name, "project-name", "p", "", "Project name") upCmd.Flags().StringVarP(&opts.Name, "project-name", "p", "", "Project name")
upCmd.Flags().StringVar(&opts.WorkingDir, "workdir", ".", "Work dir") upCmd.Flags().StringVar(&opts.WorkingDir, "workdir", "", "Work dir")
upCmd.Flags().StringArrayVarP(&opts.ConfigPaths, "file", "f", []string{}, "Compose configuration files") upCmd.Flags().StringArrayVarP(&opts.ConfigPaths, "file", "f", []string{}, "Compose configuration files")
upCmd.Flags().StringArrayVarP(&opts.Environment, "environment", "e", []string{}, "Environment variables") upCmd.Flags().StringArrayVarP(&opts.Environment, "environment", "e", []string{}, "Environment variables")
upCmd.Flags().BoolP("detach", "d", true, " Detached mode: Run containers in the background") upCmd.Flags().BoolP("detach", "d", true, " Detached mode: Run containers in the background")

View File

@ -408,7 +408,7 @@ func TestCompose(t *testing.T) {
const ( const (
composeFile = "../composefiles/aci-demo/aci_demo_port.yaml" composeFile = "../composefiles/aci-demo/aci_demo_port.yaml"
composeFileMultiplePorts = "../composefiles/aci-demo/aci_demo_multi_port.yaml" composeFileMultiplePorts = "../composefiles/aci-demo/aci_demo_multi_port.yaml"
composeProjectName = "acie2e" composeProjectName = "acidemo"
serverContainer = composeProjectName + "_web" serverContainer = composeProjectName + "_web"
wordsContainer = composeProjectName + "_words" wordsContainer = composeProjectName + "_words"
) )