diff --git a/project/interface.go b/project/interface.go index 3356407c2..7fb2b6187 100644 --- a/project/interface.go +++ b/project/interface.go @@ -41,6 +41,7 @@ type APIProject interface { Containers(ctx context.Context, filter Filter, services ...string) ([]string, error) GetServiceConfig(service string) (*config.ServiceConfig, bool) + GetServiceNames() []string } // Filter holds filter element to filter containers diff --git a/project/project.go b/project/project.go index ef783120a..4c28a1366 100644 --- a/project/project.go +++ b/project/project.go @@ -546,6 +546,11 @@ func (p *Project) GetServiceConfig(name string) (*config.ServiceConfig, bool) { return p.ServiceConfigs.Get(name) } +// GetServiceNames returnes all service names in the project. +func (p *Project) GetServiceNames() []string { + return p.ServiceConfigs.Keys() +} + // IsNamedVolume returns whether the specified volume (string) is a named volume or not. func IsNamedVolume(volume string) bool { return !strings.HasPrefix(volume, ".") && !strings.HasPrefix(volume, "/") && !strings.HasPrefix(volume, "~")