From a73089be20bdaed589dce1a38eb68a77eaa0339c Mon Sep 17 00:00:00 2001 From: John Kerl Date: Wed, 17 Nov 2021 23:39:16 -0500 Subject: [PATCH] mlr --csv --irs/--ors crlf is OK, sine autodetected per platform --- docs/src/manpage.txt | 2 +- internal/pkg/input/record_reader_csv.go | 4 ++-- internal/pkg/output/record_writer_csv.go | 2 +- man/manpage.txt | 2 +- man/mlr.1 | 4 ++-- todo.txt | 2 -- 6 files changed, 7 insertions(+), 9 deletions(-) diff --git a/docs/src/manpage.txt b/docs/src/manpage.txt index 56201690b..ad75a47b7 100644 --- a/docs/src/manpage.txt +++ b/docs/src/manpage.txt @@ -2959,4 +2959,4 @@ SEE ALSO - 2021-11-15 MILLER(1) + 2021-11-18 MILLER(1) diff --git a/internal/pkg/input/record_reader_csv.go b/internal/pkg/input/record_reader_csv.go index d963c8c74..5d6e812d0 100644 --- a/internal/pkg/input/record_reader_csv.go +++ b/internal/pkg/input/record_reader_csv.go @@ -22,8 +22,8 @@ type RecordReaderCSV struct { // ---------------------------------------------------------------- func NewRecordReaderCSV(readerOptions *cli.TReaderOptions) (*RecordReaderCSV, error) { - if readerOptions.IRS != "\n" { - return nil, errors.New("CSV IRS cannot be altered; LF vs CR/LF is autodetected.") + if readerOptions.IRS != "\n" && readerOptions.IRS != "\r\n" { + return nil, errors.New("CSV IRS cannot be altered; LF vs CR/LF is autodetected") } if len(readerOptions.IFS) != 1 { return nil, errors.New("CSV IFS can only be a single character") diff --git a/internal/pkg/output/record_writer_csv.go b/internal/pkg/output/record_writer_csv.go index 9d2c1ab5c..c1ddee1ba 100644 --- a/internal/pkg/output/record_writer_csv.go +++ b/internal/pkg/output/record_writer_csv.go @@ -25,7 +25,7 @@ func NewRecordWriterCSV(writerOptions *cli.TWriterOptions) (*RecordWriterCSV, er if len(writerOptions.OFS) != 1 { return nil, errors.New("CSV OFS can only be a single character") } - if writerOptions.ORS != "\n" { + if writerOptions.ORS != "\n" && writerOptions.ORS != "\r\n" { return nil, errors.New("CSV ORS cannot be altered") } return &RecordWriterCSV{ diff --git a/man/manpage.txt b/man/manpage.txt index 56201690b..ad75a47b7 100644 --- a/man/manpage.txt +++ b/man/manpage.txt @@ -2959,4 +2959,4 @@ SEE ALSO - 2021-11-15 MILLER(1) + 2021-11-18 MILLER(1) diff --git a/man/mlr.1 b/man/mlr.1 index ca61710c5..f66864097 100644 --- a/man/mlr.1 +++ b/man/mlr.1 @@ -2,12 +2,12 @@ .\" Title: mlr .\" Author: [see the "AUTHOR" section] .\" Generator: ./mkman.rb -.\" Date: 2021-11-15 +.\" Date: 2021-11-18 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "MILLER" "1" "2021-11-15" "\ \&" "\ \&" +.TH "MILLER" "1" "2021-11-18" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Portability definitions .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/todo.txt b/todo.txt index f6031e43f..f756a7154 100644 --- a/todo.txt +++ b/todo.txt @@ -9,10 +9,8 @@ PUNCHDOWN LIST - cmp-matrices - all-contribs: twi dm - license triple-checks - - csv irs lf/crlf ignores -- ? already is so? - `mlr put` -> coverart - 0b1011 olh/webdoc - - help approx-match even if exact exists (e.g. 'map') * release ordering? conda brew macports chocolatey