jzelinskie / faq

Format Agnostic jQ -- process various formats with libjq
Apache License 2.0
440 stars 14 forks source link

Refactor encoding/decoding to default to accepting streams and writing streams #57

Closed chancez closed 5 years ago

chancez commented 5 years ago

This allows (and enables for yaml/json) writing out multiple resources in a streaming fashion, using --- between multiple documents when output-format is yaml, and using \n for other formats.

Supersedes #56

Here's what the yaml stream output looks like:

~/g/s/g/j/faq chance@reverse ❯❯❯ ./faq-darwin-amd64 . -o yaml <(echo '--- {}\n--- {}') <(echo '--- {}\n--- {}')
{}

---
{}

---
{}

---
{}

And JSON remains the same:

~/g/s/g/j/faq chance@reverse ❯❯❯ ./faq-darwin-amd64 . -o json <(echo '--- {}\n--- {}') <(echo '--- {}\n--- {}')
{}
{}
{}
{}