diff options
| author | Teddy Wing | 2022-03-19 21:07:41 +0100 | 
|---|---|---|
| committer | Teddy Wing | 2022-03-19 21:07:41 +0100 | 
| commit | 2a0182af66a64756eaa88d64e44a18ee5fb94bce (patch) | |
| tree | bd042489a5f81766bf07166736bf357855bf518a | |
| parent | d5c62cac01103881b8c8f8d629bc2eb0d12723c7 (diff) | |
| download | yaqlite-2a0182af66a64756eaa88d64e44a18ee5fb94bce.tar.bz2 | |
main: Emit multiline YAML output
Only works with `|` YAML instead of `>` flowed output.
Use a forked `yaml-rust` crate published by
https://github.com/davvid/yaml-rust that includes a patch to support
multiline output.
| -rw-r--r-- | Cargo.lock | 8 | ||||
| -rw-r--r-- | Cargo.toml | 2 | ||||
| -rw-r--r-- | src/main.rs | 1 | 
3 files changed, 6 insertions, 5 deletions
| @@ -302,10 +302,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index"  checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"  [[package]] -name = "yaml-rust" -version = "0.4.5" +name = "yaml-rust-davvid" +version = "0.5.1"  source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c1936c4cc7a1c9ab21a1ebb602eb942ba868cbd44a99cb7cdc5892335e1c85" +checksum = "ff0648c4e5c02911a6acf9e60fae9becf2bab890c682cd3126c9318a4619ce2b"  dependencies = [   "linked-hash-map",  ] @@ -317,5 +317,5 @@ dependencies = [   "clap",   "rusqlite",   "thiserror", - "yaml-rust", + "yaml-rust-davvid",  ] @@ -6,7 +6,7 @@ edition = "2021"  [dependencies]  rusqlite = { version = "0.27.0", features = ["modern_sqlite"] }  thiserror = "1.0.30" -yaml-rust = "0.4.5" +yaml-rust = { package = "yaml-rust-davvid", version = "0.5.1" }  [dependencies.clap]  version = "3.1.6" diff --git a/src/main.rs b/src/main.rs index 8b4cb5b..c21dee4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -98,6 +98,7 @@ fn main() {              let mut stdout_handle = stdout.lock();              let mut buffer = yaqlite::yaml::IoAdapter::new(&mut stdout_handle);              let mut emitter = yaml_rust::YamlEmitter::new(&mut buffer); +            emitter.multiline_strings(true);              emitter.dump(&yaml_data).unwrap();              // YamlEmitter doesn't output a trailing newline. | 
