From 14bfee31f728c383f02be98a22e3528278d2feec Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Fri, 8 Oct 2021 11:07:31 +0200 Subject: podman search: display only name and description by default Change the default format of `podman search` to only display the name and the description of each image. The index is redundant to the name and consumes a lot of space, and other descriptors (i.e., stars, official, automated) are specific to Docker Hub and also consume a lot space. Users can still use `--format` for displaying the descriptors they want to. Add a `--compatible` flag to offer an easy way to get them back. Also update the man page to account for the behavior and get some fresh data in the examples. Motivated by a recent conversation in libimage: https://github.com/containers/common/pull/802#issuecomment-937108734 Signed-off-by: Valentin Rothberg --- cmd/podman/images/search.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'cmd') diff --git a/cmd/podman/images/search.go b/cmd/podman/images/search.go index 42a998461..c9a4793aa 100644 --- a/cmd/podman/images/search.go +++ b/cmd/podman/images/search.go @@ -20,6 +20,7 @@ import ( type searchOptionsWrapper struct { entities.ImageSearchOptions // CLI only flags + Compatible bool // Docker compat TLSVerifyCLI bool // Used to convert to an optional bool later Format string // For go templating } @@ -92,6 +93,7 @@ func searchFlags(cmd *cobra.Command) { _ = cmd.RegisterFlagCompletionFunc(limitFlagName, completion.AutocompleteNone) flags.Bool("no-trunc", true, "Do not truncate the output. Default: true") + flags.BoolVar(&searchOptions.Compatible, "compatible", false, "List stars, official and automated columns (Docker compatibility)") authfileFlagName := "authfile" flags.StringVar(&searchOptions.Authfile, authfileFlagName, auth.GetDefaultAuthFile(), "Path of the authentication file. Use REGISTRY_AUTH_FILE environment variable to override") @@ -166,7 +168,11 @@ func imageSearch(cmd *cobra.Command, args []string) error { renderHeaders = report.HasTable(searchOptions.Format) row = report.NormalizeFormat(searchOptions.Format) default: - row = "{{.Index}}\t{{.Name}}\t{{.Description}}\t{{.Stars}}\t{{.Official}}\t{{.Automated}}\n" + row = "{{.Name}}\t{{.Description}}" + if searchOptions.Compatible { + row += "\t{{.Stars}}\t{{.Official}}\t{{.Automated}}" + } + row += "\n" } format := report.EnforceRange(row) -- cgit v1.2.3-54-g00ecf