mirror of
https://github.com/cheat/cheat.git
synced 2024-11-16 08:58:28 +01:00
aa16f68620
- Add `indent`, `faint`, and `underline` methods to `display` - Add tests for the above
16 lines
273 B
Go
16 lines
273 B
Go
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")
|
|
}
|