mirror of
https://github.com/mikefarah/yq.git
synced 2025-01-28 17:35:36 +00:00
Adding CSV decoder
This commit is contained in:
parent
183a42c249
commit
cb0bae128f
3
examples/sample_objects.csv
Normal file
3
examples/sample_objects.csv
Normal file
@ -0,0 +1,3 @@
|
||||
name,numberOfCats,likesApples,height
|
||||
Gary,1,true,168.8
|
||||
Samantha's Rabbit,2,false,-188.8
|
|
@ -34,9 +34,9 @@ func InputFormatFromString(format string) (InputFormat, error) {
|
||||
return PropertiesInputFormat, nil
|
||||
case "json", "ndjson", "j":
|
||||
return JsonInputFormat, nil
|
||||
case "csv":
|
||||
case "csv", "c":
|
||||
return CSVObjectInputFormat, nil
|
||||
case "tsv":
|
||||
case "tsv", "t":
|
||||
return TSVObjectInputFormat, nil
|
||||
default:
|
||||
return 0, fmt.Errorf("unknown format '%v' please use [yaml|xml|props]", format)
|
||||
|
@ -1,3 +1,6 @@
|
||||
# CSV
|
||||
Encode (arrays of arrays) data structures to CSV or TSV, Decode CSV, TSV into an array of objects.
|
||||
|
||||
|
||||
{% hint style="warning" %}
|
||||
Note that versions prior to 4.18 require the 'eval/e' command to be specified. 
|
||||
|
3
pkg/yqlib/doc/usage/headers/csv-tsv.md
Normal file
3
pkg/yqlib/doc/usage/headers/csv-tsv.md
Normal file
@ -0,0 +1,3 @@
|
||||
# CSV
|
||||
Encode (arrays of arrays) data structures to CSV or TSV, Decode CSV, TSV into an array of objects.
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Properties
|
||||
|
||||
Encode to a property file (decode not yet supported). Line comments on value nodes will be copied across.
|
||||
Encode/Decode to/from a property file. Line comments on value nodes will be copied across.
|
||||
|
||||
By default, empty maps and arrays are not encoded - see below for an example on how to encode a value for these.
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Properties
|
||||
|
||||
Encode to a property file (decode not yet supported). Line comments on value nodes will be copied across.
|
||||
Encode/Decode to/from a property file. Line comments on value nodes will be copied across.
|
||||
|
||||
By default, empty maps and arrays are not encoded - see below for an example on how to encode a value for these.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user