use recently introduced `withSelectedServicesOnly` to reduce code duplication

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2022-12-15 11:44:26 +01:00 committed by Guillaume Lours
parent 1b1f783e99
commit 8566daa96e
1 changed files with 1 additions and 7 deletions

View File

@ -55,16 +55,10 @@ type upOptions struct {
func (opts upOptions) apply(project *types.Project, services []string) error { func (opts upOptions) apply(project *types.Project, services []string) error {
if opts.noDeps { if opts.noDeps {
enabled, err := project.GetServices(services...) err := withSelectedServicesOnly(project, services)
if err != nil { if err != nil {
return err return err
} }
for _, s := range project.Services {
if !utils.StringContains(services, s.Name) {
project.DisabledServices = append(project.DisabledServices, s)
}
}
project.Services = enabled
} }
if opts.exitCodeFrom != "" { if opts.exitCodeFrom != "" {