Skip to content
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

podman search: truncate by default #14047

Merged
merged 1 commit into from
Apr 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/podman/images/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion docs/source/markdown/podman-search.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand Down