snapshot of https://github.com/ThreeDotsLabs/watermill.git (master, 2026-09-15; blobs > 131072B omitted)
Some checks failed
master / ci (push) Failing after 0s
Some checks failed
master / ci (push) Failing after 0s
This commit is contained in:
19
tools/mill/cmd/internal/indent.go
Normal file
19
tools/mill/cmd/internal/indent.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package internal
|
||||
|
||||
import "strings"
|
||||
|
||||
// Indent indents all lines in the given string with a given prefix.
|
||||
func Indent(s, prefix string) string {
|
||||
endsWithNewline := strings.HasSuffix(s, "\n")
|
||||
split := strings.Split(s, "\n")
|
||||
|
||||
for i, ss := range split {
|
||||
split[i] = prefix + ss
|
||||
}
|
||||
joined := strings.Join(split, "\n")
|
||||
if endsWithNewline {
|
||||
joined += "\n"
|
||||
}
|
||||
|
||||
return joined
|
||||
}
|
||||
Reference in New Issue
Block a user