Skip to content

Commit

Permalink
Allow for escaped commas in CLI input (#330)
Browse files Browse the repository at this point in the history
Fixes #329

Co-authored-by: Zakir Durumeric <[email protected]>
  • Loading branch information
dadrian and zakird committed Sep 10, 2023
1 parent 5647600 commit fa7d67d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/zdns/lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package zdns

import (
"encoding/csv"
"encoding/json"
"os"
"strconv"
Expand Down Expand Up @@ -68,7 +69,11 @@ func parseMetadataInputLine(line string) (string, string) {
}

func parseNormalInputLine(line string) (string, string) {
s := strings.SplitN(line, ",", 2)
r := csv.NewReader(strings.NewReader(line))
s, err := r.Read()
if err != nil || len(s) == 0 {
return line, ""
}
if len(s) == 1 {
return s[0], ""
} else {
Expand Down

0 comments on commit fa7d67d

Please sign in to comment.