services shell completion bugfix

Signed-off-by: Andrew Onyshchuk <andryk.rv@gmail.com>
This commit is contained in:
Andrew Onyshchuk 2024-02-28 12:36:13 -08:00 committed by Nicolas De loof
parent b2d4c1b865
commit f46ca459d2
1 changed files with 3 additions and 2 deletions

View File

@ -41,13 +41,14 @@ func completeServiceNames(dockerCli command.Cli, p *ProjectOptions) validArgsFn
if err != nil {
return nil, cobra.ShellCompDirectiveNoFileComp
}
var values []string
serviceNames := append(project.ServiceNames(), project.DisabledServiceNames()...)
for _, s := range serviceNames {
if toComplete == "" || strings.HasPrefix(s, toComplete) {
serviceNames = append(serviceNames, s)
values = append(values, s)
}
}
return serviceNames, cobra.ShellCompDirectiveNoFileComp
return values, cobra.ShellCompDirectiveNoFileComp
}
}