MCPcopy Create free account
hub / github.com/compose-spec/compose-go / GetWorkingDir

Method GetWorkingDir

cli/options.go:410–430  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

408var DefaultOverrideFileNames = []string{"compose.override.yml", "compose.override.yaml", "docker-compose.override.yml", "docker-compose.override.yaml"}
409
410func (o *ProjectOptions) GetWorkingDir() (string, error) {
411 if o.WorkingDir != "" {
412 return filepath.Abs(o.WorkingDir)
413 }
414PATH:
415 for _, path := range o.ConfigPaths {
416 if path != "-" {
417 for _, l := range o.ResourceLoaders {
418 if l.Accept(path) {
419 break PATH
420 }
421 }
422 absPath, err := filepath.Abs(path)
423 if err != nil {
424 return "", err
425 }
426 return filepath.Dir(absPath), nil
427 }
428 }
429 return os.Getwd()
430}
431
432// ReadConfigFiles reads ConfigFiles and populates the content field
433func (o *ProjectOptions) ReadConfigFiles(ctx context.Context, workingDir string, options *ProjectOptions) (*types.ConfigDetails, error) {

Callers 3

prepareMethod · 0.95
WithDefaultConfigPathFunction · 0.80
WithEnvFilesFunction · 0.80

Calls 2

AcceptMethod · 0.65
DirMethod · 0.65

Tested by

no test coverage detected