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