Skip to content

Add a new 'lines' text format#35

Merged
jobarr-amzn merged 1 commit intomasterfrom
lines-format
Oct 17, 2022
Merged

Add a new 'lines' text format#35
jobarr-amzn merged 1 commit intomasterfrom
lines-format

Conversation

@jobarr-amzn
Copy link
Copy Markdown
Contributor

Also adopt ion-rs 0.14.0

Description of changes:
This adds support for the new lines() formatter in ion-rs: https://github.com/amzn/ion-rust/blob/main/src/text/raw_text_writer.rs#L34-L52

This is helpful for working with line-delimited text-oriented tooling (sort, grep, uniq etc.).

Testing:
Comparing the various text formats.

❯ cat c.json | cargo -q run dump --format text
[1, 2, 3] [4, 5, 6]
❯ cat c.json | cargo -q run dump --format lines
[1, 2, 3]
[4, 5, 6]
❯ cat c.json | cargo -q run dump --format pretty
[
    1,
    2,
    3
]
[
    4,
    5,
    6
]

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Copy link
Copy Markdown
Contributor

@zslayton zslayton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Side question: do we have a unit test somewhere that guarantees that text values written by the lines writer always escape their return lines?

@jobarr-amzn
Copy link
Copy Markdown
Contributor Author

Thanks! Side question: do we have a unit test somewhere that guarantees that text values written by the lines writer always escape their return lines?

No... I didn't think of this, so I have not looked into it.

@zslayton
Copy link
Copy Markdown
Contributor

Thanks! Side question: do we have a unit test somewhere that guarantees that text values written by the lines writer always escape their return lines?

No... I didn't think of this, so I have not looked into it.

Offhand, I don't think any of the text writers emit multiline strings yet, so we're probably ok for now.

Also adopt ion-rs 0.14.0
@jobarr-amzn jobarr-amzn merged commit 8774947 into master Oct 17, 2022
@jobarr-amzn jobarr-amzn deleted the lines-format branch October 17, 2022 18:29
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