Skip to content

Commit

Permalink
Merge branch 'main' into typescript-only-release
Browse files Browse the repository at this point in the history
  • Loading branch information
Zemnmez committed Jul 14, 2022
2 parents 4836209 + 1c7e8a0 commit 55db51a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion go/cmd/csvpretty/csvpretty.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ var output string
var overwrite bool
var debug bool
var validate bool
var comma string

func init() {
flag.StringVar(&input, "input", "", "input file")
flag.StringVar(&output, "output", "", "output file")
flag.StringVar(&comma, "comma", ",", "CSV separator (sometimes ';')")
flag.BoolVar(&overwrite, "w", false, "overwrite input with output")
flag.BoolVar(&debug, "debug", false, "print debug info")
flag.BoolVar(&validate, "validate", false, "Validate the number of fields is the same on every row.")
Expand Down Expand Up @@ -157,7 +159,7 @@ func (p PrettyCSV) WriteTo(w io.Writer) (n int64, err error) {
tabReplacer := byteReplacer{
out: tabWriter,
from: holder,
to: ",\t",
to: comma + "\t",
}

lineReplacer := byteReplacer{
Expand All @@ -170,6 +172,7 @@ func (p PrettyCSV) WriteTo(w io.Writer) (n int64, err error) {
csvWriter.Comma = holder

csvRd := csv.NewReader(p.rd)
csvRd.Comma = []rune(comma)[0]

for {
var row []string
Expand Down

0 comments on commit 55db51a

Please sign in to comment.