summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-04-28 06:46:58 -0400
committerGitHub <noreply@github.com>2022-04-28 06:46:58 -0400
commit2b8cafc0671fbbd155770f044b8216f050877192 (patch)
treecaede87e2dec18007f95d14a4f396fd6946da573
parent78c66fb005b75afc4f69564dd40ba16af92cfa6a (diff)
parentea1fcd7bc71f391faef0cd2ca7547a17a597e9e2 (diff)
downloadpodman-2b8cafc0671fbbd155770f044b8216f050877192.tar.gz
podman-2b8cafc0671fbbd155770f044b8216f050877192.tar.bz2
podman-2b8cafc0671fbbd155770f044b8216f050877192.zip
Merge pull request #14047 from vrothberg/fix-14044
podman search: truncate by default
-rw-r--r--cmd/podman/images/search.go6
-rw-r--r--docs/source/markdown/podman-search.1.md2
2 files changed, 4 insertions, 4 deletions
diff --git a/cmd/podman/images/search.go b/cmd/podman/images/search.go
index aa11cf254..7f202cb6a 100644
--- a/cmd/podman/images/search.go
+++ b/cmd/podman/images/search.go
@@ -23,6 +23,7 @@ type searchOptionsWrapper struct {
Compatible bool // Docker compat
TLSVerifyCLI bool // Used to convert to an optional bool later
Format string // For go templating
+ NoTrunc bool
}
// listEntryTag is a utility structure used for json serialization.
@@ -92,7 +93,7 @@ func searchFlags(cmd *cobra.Command) {
flags.IntVar(&searchOptions.Limit, limitFlagName, 0, "Limit the number of results")
_ = cmd.RegisterFlagCompletionFunc(limitFlagName, completion.AutocompleteNone)
- flags.Bool("no-trunc", true, "Do not truncate the output. Default: true")
+ flags.BoolVar(&searchOptions.NoTrunc, "no-trunc", false, "Do not truncate the output")
flags.BoolVar(&searchOptions.Compatible, "compatible", false, "List stars, official and automated columns (Docker compatibility)")
authfileFlagName := "authfile"
@@ -139,11 +140,10 @@ func imageSearch(cmd *cobra.Command, args []string) error {
return nil
}
- noTrunc, _ := cmd.Flags().GetBool("no-trunc")
isJSON := report.IsJSON(searchOptions.Format)
for i, element := range searchReport {
d := strings.ReplaceAll(element.Description, "\n", " ")
- if len(d) > 44 && !(noTrunc || isJSON) {
+ if len(d) > 44 && !(searchOptions.NoTrunc || isJSON) {
d = strings.TrimSpace(d[:44]) + "..."
}
searchReport[i].Description = d
diff --git a/docs/source/markdown/podman-search.1.md b/docs/source/markdown/podman-search.1.md
index 81a67d762..5b49d7f8e 100644
--- a/docs/source/markdown/podman-search.1.md
+++ b/docs/source/markdown/podman-search.1.md
@@ -90,7 +90,7 @@ The result contains the Image name and its tag, one line for every tag associate
#### **--no-trunc**
-Do not truncate the output (default *true*).
+Do not truncate the output (default *false*).
#### **--tls-verify**