mirror of
https://github.com/cheat/cheat.git
synced 2024-11-16 00:48:29 +01:00
4f2a57fce8
- Fix bug whereby `--all` flag would conflict with pager - Fix whitespace inconsistencies among view and search outputs
21 lines
354 B
Go
21 lines
354 B
Go
package display
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
// Indent prepends each line of a string with a tab
|
|
func Indent(str string) string {
|
|
|
|
// trim superfluous whitespace
|
|
str = strings.TrimSpace(str)
|
|
|
|
// prepend each line with a tab character
|
|
out := ""
|
|
for _, line := range strings.Split(str, "\n") {
|
|
out += fmt.Sprintf("\t%s\n", line)
|
|
}
|
|
|
|
return out
|
|
}
|