Merge pull request #5527 from albers/completion-container-rm

Improve completion of containers for `docker rm`
This commit is contained in:
Sebastiaan van Stijn 2024-10-11 22:35:25 +02:00 committed by GitHub
commit 21eea1e003
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -38,7 +38,9 @@ func NewRmCommand(dockerCli command.Cli) *cobra.Command {
Annotations: map[string]string{
"aliases": "docker container rm, docker container remove, docker rm",
},
ValidArgsFunction: completion.ContainerNames(dockerCli, true),
ValidArgsFunction: completion.ContainerNames(dockerCli, true, func(ctr container.Summary) bool {
return opts.force || ctr.State == "exited" || ctr.State == "created"
}),
}
flags := cmd.Flags()