mirror of
https://github.com/cheat/cheat.git
synced 2026-03-07 11:13:33 +01:00
feat(display): add methods to display
- Add `indent`, `faint`, and `underline` methods to `display` - Add tests for the above
This commit is contained in:
16
internal/display/indent.go
Normal file
16
internal/display/indent.go
Normal file
@@ -0,0 +1,16 @@
|
||||
package display
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Indent prepends each line of a string with a tab
|
||||
func Indent(str string) string {
|
||||
out := ""
|
||||
for _, line := range strings.Split(str, "\n") {
|
||||
out += fmt.Sprintf("\t%s\n", line)
|
||||
}
|
||||
|
||||
return strings.TrimSuffix(out, "\n")
|
||||
}
|
||||
Reference in New Issue
Block a user