MCPcopy Create free account
hub / github.com/chainloop-dev/chainloop / truncateText

Function truncateText

app/controlplane/plugins/sdk/v1/helpers.go:208–222  ·  view source on GitHub ↗

Truncate returns the first n runes of s.

(s string, n int)

Source from the content-addressed store, hash-verified

206
207// Truncate returns the first n runes of s.
208func truncateText(s string, n int) string {
209 truncatedPrefix := "... (truncated)"
210 n -= len(truncatedPrefix)
211
212 if len(s) <= n {
213 return s
214 }
215 for i := range s {
216 if n == 0 {
217 return s[:i] + truncatedPrefix
218 }
219 n--
220 }
221 return s
222}
223
224func SummaryTable(req *ExecutionRequest, opts ...RenderOpt) (string, error) {
225 renderer, err := newRenderer(opts...)

Callers 1

summaryTableMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected