From 6d813c8ddf625fc8557ae6c2bcd7ba8d6365fcbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20Trma=C4=8D?= Date: Mon, 27 May 2024 16:28:30 +0200 Subject: [PATCH] Don't offer the tarball: transport in completions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... per #2338 . Signed-off-by: Miloslav Trmač --- cmd/skopeo/completions.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmd/skopeo/completions.go b/cmd/skopeo/completions.go index fc323a19..a50fadbc 100644 --- a/cmd/skopeo/completions.go +++ b/cmd/skopeo/completions.go @@ -1,6 +1,7 @@ package main import ( + "github.com/containers/image/v5/tarball" "github.com/containers/image/v5/transports" "github.com/spf13/cobra" ) @@ -10,7 +11,12 @@ func autocompleteSupportedTransports(cmd *cobra.Command, args []string, toComple tps := transports.ListNames() suggestions := make([]string, 0, len(tps)) for _, tp := range tps { - suggestions = append(suggestions, tp+":") + // ListNames is generally expected to filter out deprecated transports. + // tarball: is not deprecated, but it is only usable from a Go caller (using tarball.ConfigUpdater), + // so don’t offer it on the CLI. + if tp != tarball.Transport.Name() { + suggestions = append(suggestions, tp+":") + } } return suggestions, cobra.ShellCompDirectiveNoFileComp }