Skip to content

Commit 5bf3c67

Browse files
committed
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 <[email protected]>
1 parent 5bce5e1 commit 5bf3c67

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

cli/command/image/pull.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ func newPullCommand(dockerCLI command.Cli) *cobra.Command {
3838
"category-top": "5",
3939
"aliases": "docker image pull, docker pull",
4040
},
41-
ValidArgsFunction: cobra.NoFileCompletions,
41+
// Complete with local images to help pulling the latest version
42+
// of images that are in the image cache.
43+
ValidArgsFunction: completion.ImageNames(dockerCLI, 1),
4244
DisableFlagsInUseLine: true,
4345
}
4446

0 commit comments

Comments
 (0)