mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
get-zones output should work as input into preview (#688)
* Add tests for get-zones * fix CAA, SSHFP, TLSA and other bugs * New format for get-zones: "djs" which is js but uses "disco commas" * Print diffs using github.com/andreyvit/diff Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
This commit is contained in:
19
vendor/github.com/andreyvit/diff/trim.go
generated
vendored
Normal file
19
vendor/github.com/andreyvit/diff/trim.go
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
package diff
|
||||
|
||||
import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// TrimLines applies TrimSpace to each string in the given array.
|
||||
func TrimLines(input []string) []string {
|
||||
result := make([]string, 0, len(input))
|
||||
for _, el := range input {
|
||||
result = append(result, strings.TrimSpace(el))
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// TrimLinesInString applies TrimSpace to each line in the given string, and returns the new trimmed string. Empty lines are not removed.
|
||||
func TrimLinesInString(input string) string {
|
||||
return strings.Join(TrimLines(strings.Split(strings.TrimSpace(input), "\n")), "\n")
|
||||
}
|
||||
Reference in New Issue
Block a user