summaryrefslogtreecommitdiff
path: root/cmd/podman/common
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2021-09-23 15:15:35 +0200
committerPaul Holzinger <pholzing@redhat.com>2021-09-23 15:15:35 +0200
commitb6e5a4909a5070f3092f91a592e6d04c5d358e85 (patch)
treeae0070c07b82a6aed9ec96514a04647816d7e92f /cmd/podman/common
parent3d34d3a186a782e48bdbd1245a7e067db850d9b0 (diff)
downloadpodman-b6e5a4909a5070f3092f91a592e6d04c5d358e85.tar.gz
podman-b6e5a4909a5070f3092f91a592e6d04c5d358e85.tar.bz2
podman-b6e5a4909a5070f3092f91a592e6d04c5d358e85.zip
shell completion: do not show images without tag
The shell completion should only suggest arguments that work. Using a image without tag does not work in many cases. Having both the version with and without tag also forces users to press one key more because tab completion will always stop at the colon. Fixes #11673 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'cmd/podman/common')
-rw-r--r--cmd/podman/common/completion.go7
1 files changed, 0 insertions, 7 deletions
diff --git a/cmd/podman/common/completion.go b/cmd/podman/common/completion.go
index 2ea5fa10f..90522438d 100644
--- a/cmd/podman/common/completion.go
+++ b/cmd/podman/common/completion.go
@@ -194,21 +194,14 @@ func getImages(cmd *cobra.Command, toComplete string) ([]string, cobra.ShellComp
} else {
// suggested "registry.fedoraproject.org/f29/httpd:latest" as
// - "registry.fedoraproject.org/f29/httpd:latest"
- // - "registry.fedoraproject.org/f29/httpd"
// - "f29/httpd:latest"
- // - "f29/httpd"
// - "httpd:latest"
- // - "httpd"
paths := strings.Split(repo, "/")
for i := range paths {
suggestionWithTag := strings.Join(paths[i:], "/")
if strings.HasPrefix(suggestionWithTag, toComplete) {
suggestions = append(suggestions, suggestionWithTag)
}
- suggestionWithoutTag := strings.SplitN(strings.SplitN(suggestionWithTag, ":", 2)[0], "@", 2)[0]
- if strings.HasPrefix(suggestionWithoutTag, toComplete) {
- suggestions = append(suggestions, suggestionWithoutTag)
- }
}
}
}