Skip to content

Commit 892add7

Browse files
feat(cli): improve search result view for large version lists (#2435)
Make `devbox search --show-all` more readable with lots of versions.
1 parent a1b8bd8 commit 892add7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/boxcli/search.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ func printSearchResults(
104104
versionString := ""
105105
if len(nonEmptyVersions) > 0 {
106106
ellipses := lo.Ternary(resultsAreTrimmed && pkg.NumVersions > trimmedVersionsLength, " ...", "")
107-
versionString = fmt.Sprintf(" (%s%s)", strings.Join(nonEmptyVersions, ", "), ellipses)
107+
if showAll {
108+
versionString = fmt.Sprintf("\n > %s \n", strings.Join(nonEmptyVersions, "\n > "))
109+
} else {
110+
versionString = fmt.Sprintf(" (%s%s)", strings.Join(nonEmptyVersions, ", "), ellipses)
111+
}
108112
}
109113
fmt.Fprintf(w, "* %s %s\n", pkg.Name, versionString)
110114
}

0 commit comments

Comments
 (0)