Skip to content

Conversation

@wader
Copy link
Owner

@wader wader commented Jan 3, 2023

Add header option, on by default
Disable comments by default
Rename comma to delimiter
Add quote_char option
Add skip initial space option

Uses a forked version of std csv to support custom quote character

See top of csv.go for TODOs

@wader
Copy link
Owner Author

wader commented Jan 3, 2023

Related to #528

@wader
Copy link
Owner Author

wader commented Jan 3, 2023

See TODOs in csv.go, there are some questions how to handle header ordering, comments error conditions etc

With this one can do:

$ go run . -rn '[{a:"aaa",b:"hello"}, {a: "aaa", b: "world"}] | . as $v | to_csv | ., (from_csv | ., . == $v)'
a,b
aaa,hello
aaa,world

[
  {
    "a": "aaa",
    "b": "hello"
  },
  {
    "a": "aaa",
    "b": "world"
  }
]
true
$ go run . -rn '[["aaa","hello"], ["aaa","world"]] | . as $v | to_csv | ., (from_csv({header: false}) | ., . == $v)'
aaa,hello
aaa,world

[
  [
    "aaa",
    "hello"
  ],
  [
    "aaa",
    "world"
  ]
]
true

Add header option, on by default
Disable comments by default
Rename comma to delimiter
Add quote_char option
Add skip initial space option

Uses a forked version of std csv to support custom quote character

See top of csv.go for TODOs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants