-
Notifications
You must be signed in to change notification settings - Fork 2k
Enable completion for docker images
#6452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
7672399
to
0fdbc75
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
0fdbc75
to
f3f88ae
Compare
cli/command/completion/functions.go
Outdated
names = append(names, baseName) | ||
} | ||
} | ||
return names, cobra.ShellCompDirectiveNoSpace |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still needs the ShellCompDirectiveNoFileComp
to avoid completing files when there's no images
return names, cobra.ShellCompDirectiveNoSpace | |
return names, cobra.ShellCompDirectiveNoSpace | ShellCompDirectiveNoFileComp |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, wondering if the NoSpace
is even needed if we have both the base name (like alpine
) and the individual tags (alpine:latest
, alpine:3.20
, ...).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But if there are no images, then NoSpace
alone would still show files. (at least that's what I'm seeing with fish
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, OK, TIL! Updated. Thank you!
Signed-off-by: Dorin Geman <[email protected]>
f3f88ae
to
74d0210
Compare
for _, img := range list { | ||
names = append(names, img.RepoTags...) | ||
for _, tag := range img.RepoTags { | ||
if baseName, _, ok := strings.Cut(tag, ":"); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could use the reference.Parse*
function... Otherwise it will produce truncated image names for images on repos using non-standard port like localhost:5000/myimage:latest
- What I did
Enabled completion for
docker images
.- How I did it
By adding a new
ImageNamesWithBase
completion function which offers completion for images present within the local store, including both full image names with tags and base image names (repository names only) when multiple tags exist for the same base name.- How to verify it
- Human readable description for the release notes
- A picture of a cute animal (not mandatory but encouraged)

Source: https://earth.org/world-lemur-day/.