Restore --tsvlite (#984)

* Restore --tsvlite flag

* todo

* doc-build artifacts

* doc note on --tsv vs --tsvlite and backslashed data
This commit is contained in:
John Kerl 2022-03-15 09:01:20 -04:00 committed by GitHub
parent 47ef5de0bb
commit 8f04d7671d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 51 additions and 22 deletions

View file

@ -126,6 +126,7 @@ Here are the differences between CSV and CSV-lite:
* CSV does not allow heterogeneous data; CSV-lite does (see also [Record Heterogeneity](record-heterogeneity.md)).
* TSV-lite is simply CSV-lite with field separator set to tab instead of comma.
In particular, no encode/decode of `\r`, `\n`, `\t`, or `\\` is done.
* CSV-lite allows changing FS and/or RS to any values, perhaps multi-character.

View file

@ -38,6 +38,7 @@ Here are the differences between CSV and CSV-lite:
* CSV does not allow heterogeneous data; CSV-lite does (see also [Record Heterogeneity](record-heterogeneity.md)).
* TSV-lite is simply CSV-lite with field separator set to tab instead of comma.
In particular, no encode/decode of `\r`, `\n`, `\t`, or `\\` is done.
* CSV-lite allows changing FS and/or RS to any values, perhaps multi-character.

View file

@ -389,8 +389,8 @@ FILE-FORMAT FLAGS
--ousv or --ousvlite Use USV format for output data.
--oxtab Use XTAB format for output data.
--pprint Use PPRINT format for input and output data.
--tsv Use TSV format for input and output data.
--tsv or -t Use TSV-lite format for input and output data.
--tsv or -t Use TSV format for input and output data.
--tsvlite Use TSV-lite format for input and output data.
--usv or --usvlite Use USV format for input and output data.
--xtab Use XTAB format for input and output data.
-i {format name} Use format name for input data. For example: `-i csv`
@ -3190,5 +3190,5 @@ SEE ALSO
2022-03-08 MILLER(1)
2022-03-15 MILLER(1)
</pre>

View file

@ -368,8 +368,8 @@ FILE-FORMAT FLAGS
--ousv or --ousvlite Use USV format for output data.
--oxtab Use XTAB format for output data.
--pprint Use PPRINT format for input and output data.
--tsv Use TSV format for input and output data.
--tsv or -t Use TSV-lite format for input and output data.
--tsv or -t Use TSV format for input and output data.
--tsvlite Use TSV-lite format for input and output data.
--usv or --usvlite Use USV format for input and output data.
--xtab Use XTAB format for input and output data.
-i {format name} Use format name for input data. For example: `-i csv`
@ -3169,4 +3169,4 @@ SEE ALSO
2022-03-08 MILLER(1)
2022-03-15 MILLER(1)

View file

@ -177,8 +177,8 @@ are overridden in all cases by setting output format to `format2`.
* `--ousv or --ousvlite`: Use USV format for output data.
* `--oxtab`: Use XTAB format for output data.
* `--pprint`: Use PPRINT format for input and output data.
* `--tsv`: Use TSV format for input and output data.
* `--tsv`: Use TSV format for input and output data.
* `--tsv or -t`: Use TSV format for input and output data.
* `--tsvlite`: Use TSV-lite format for input and output data.
* `--usv or --usvlite`: Use USV format for input and output data.
* `--xtab`: Use XTAB format for input and output data.
* `-i {format name}`: Use format name for input data. For example: `-i csv` is the same as `--icsv`.

View file

@ -975,8 +975,9 @@ var FileFormatFlagSection = FlagSection{
},
{
name: "--tsv",
help: "Use TSV format for input and output data.",
name: "--tsv",
help: "Use TSV format for input and output data.",
altNames: []string{"-t"},
parser: func(args []string, argc int, pargi *int, options *TOptions) {
options.ReaderOptions.InputFileFormat = "tsv"
options.WriterOptions.OutputFileFormat = "tsv"
@ -985,12 +986,15 @@ var FileFormatFlagSection = FlagSection{
},
{
name: "--tsv",
help: "Use TSV-lite format for input and output data.",
altNames: []string{"-t"},
name: "--tsvlite",
help: "Use TSV-lite format for input and output data.",
parser: func(args []string, argc int, pargi *int, options *TOptions) {
options.ReaderOptions.InputFileFormat = "tsv"
options.WriterOptions.OutputFileFormat = "tsv"
options.ReaderOptions.InputFileFormat = "csvlite"
options.WriterOptions.OutputFileFormat = "csvlite"
options.ReaderOptions.IFS = "\t"
options.WriterOptions.OFS = "\t"
options.ReaderOptions.ifsWasSpecified = true
options.WriterOptions.ofsWasSpecified = true
*pargi += 1
},
},
@ -1008,6 +1012,7 @@ var FileFormatFlagSection = FlagSection{
options.WriterOptions.ORS = ASV_RS
options.ReaderOptions.ifsWasSpecified = true
options.ReaderOptions.ifsWasSpecified = true
options.ReaderOptions.irsWasSpecified = true
options.WriterOptions.ofsWasSpecified = true
options.WriterOptions.orsWasSpecified = true

View file

@ -368,8 +368,8 @@ FILE-FORMAT FLAGS
--ousv or --ousvlite Use USV format for output data.
--oxtab Use XTAB format for output data.
--pprint Use PPRINT format for input and output data.
--tsv Use TSV format for input and output data.
--tsv or -t Use TSV-lite format for input and output data.
--tsv or -t Use TSV format for input and output data.
--tsvlite Use TSV-lite format for input and output data.
--usv or --usvlite Use USV format for input and output data.
--xtab Use XTAB format for input and output data.
-i {format name} Use format name for input data. For example: `-i csv`
@ -3169,4 +3169,4 @@ SEE ALSO
2022-03-08 MILLER(1)
2022-03-15 MILLER(1)

View file

@ -2,12 +2,12 @@
.\" Title: mlr
.\" Author: [see the "AUTHOR" section]
.\" Generator: ./mkman.rb
.\" Date: 2022-03-08
.\" Date: 2022-03-15
.\" Manual: \ \&
.\" Source: \ \&
.\" Language: English
.\"
.TH "MILLER" "1" "2022-03-08" "\ \&" "\ \&"
.TH "MILLER" "1" "2022-03-15" "\ \&" "\ \&"
.\" -----------------------------------------------------------------
.\" * Portability definitions
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@ -447,8 +447,8 @@ are overridden in all cases by setting output format to `format2`.
--ousv or --ousvlite Use USV format for output data.
--oxtab Use XTAB format for output data.
--pprint Use PPRINT format for input and output data.
--tsv Use TSV format for input and output data.
--tsv or -t Use TSV-lite format for input and output data.
--tsv or -t Use TSV format for input and output data.
--tsvlite Use TSV-lite format for input and output data.
--usv or --usvlite Use USV format for input and output data.
--xtab Use XTAB format for input and output data.
-i {format name} Use format name for input data. For example: `-i csv`

View file

@ -0,0 +1 @@
mlr --itsvlite --odkvp cat ${CASEDIR}/input.tsv

View file

@ -0,0 +1 @@
a=1\t2,b=c:\foo\bar,c=xyz

View file

@ -0,0 +1,2 @@
a b c
1\t2 c:\foo\bar xyz
1 a b c
2 1\t2 c:\foo\bar xyz

View file

@ -0,0 +1 @@
mlr --itsv --odkvp cat ${CASEDIR}/input.tsv

View file

@ -0,0 +1 @@
a=1 2,b=c:\foo\bar,c=xyz

View file

@ -0,0 +1,2 @@
a b c
1\t2 c:\foo\bar xyz
1 a b c
2 1\t2 c:\foo\bar xyz

View file

@ -0,0 +1 @@
mlr --tsvlite cat ${CASEDIR}/input.tsv

View file

@ -0,0 +1,2 @@
a b c
1\t2 c:\foo\bar xyz

View file

@ -0,0 +1,2 @@
a b c
1\t2 c:\foo\bar xyz
1 a b c
2 1\t2 c:\foo\bar xyz

View file

@ -0,0 +1 @@
mlr --tsv cat ${CASEDIR}/input.tsv

View file

@ -0,0 +1,2 @@
a b c
1\t2 c:\\foo\\bar xyz

View file

@ -0,0 +1,2 @@
a b c
1\t2 c:\foo\bar xyz
1 a b c
2 1\t2 c:\foo\bar xyz

View file

@ -2,9 +2,11 @@
* 404 -- what broke?
https://github.com/johnkerl/miller/pull/757/files
* https://github.com/johnkerl/miller/issues?q=is%3Aissue+is%3Aopen+label%3Aneeds-documentation
* https://squidfunk.github.io/mkdocs-material/setup/setting-up-versioning/
RELEASES
* 6.2.0 plan:
! #982 ., etc
! extended field accessors for #763 and #948 (positional & json.nested)
! strict mode
! awk-like exit
@ -18,6 +20,8 @@ RELEASES
? #908 inferencing options
? gogll
k --tsvlite
================================================================
FEATURES