MCPcopy Index your code
hub / github.com/cheat/cheat / Indent

Function Indent

internal/display/indent.go:9–21  ·  view source on GitHub ↗

Indent prepends each line of a string with a tab

(str string)

Source from the content-addressed store, hash-verified

7
8// Indent prepends each line of a string with a tab
9func Indent(str string) string {
10
11 // trim superfluous whitespace
12 str = strings.TrimSpace(str)
13
14 // prepend each line with a tab character
15 out := ""
16 for _, line := range strings.Split(str, "\n") {
17 out += fmt.Sprintf("\t%s\n", line)
18 }
19
20 return out
21}

Callers 4

cmdViewFunction · 0.92
cmdSearchFunction · 0.92
TestIndentFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestIndentFunction · 0.68