Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cvs: Add more from/to options #546

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

cvs: Add more from/to options #546

wants to merge 1 commit into from

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.

1 participant