add completion for docker image pull

With this patch, completion is provided for images already present
in the local image cache to help pulling the latest version of the
same tag;

    docker pull go<tab>
    golang:1.12    golang:1.18.0  golang:1.21    golang:1.24    gopher:latest
    golang:1.13    golang:1.20    golang:1.23    golang:latest

    docker pull golang:<tab>
    1.12    1.13    1.18.0  1.20    1.21    1.23    1.24    latest

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit 5bf3c6793d)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn
2025-09-03 15:42:07 +02:00
parent b89b069082
commit b3df92053d
+3 -1
View File
@@ -46,7 +46,9 @@ func newPullCommand(dockerCLI command.Cli) *cobra.Command {
"category-top": "5",
"aliases": "docker image pull, docker pull",
},
ValidArgsFunction: cobra.NoFileCompletions,
// Complete with local images to help pulling the latest version
// of images that are in the image cache.
ValidArgsFunction: completion.ImageNames(dockerCLI, 1),
}
flags := cmd.Flags()