From 2a0182af66a64756eaa88d64e44a18ee5fb94bce Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 19 Mar 2022 21:07:41 +0100 Subject: 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. --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- src/main.rs | 1 + 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 18a86c9..30c6453 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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", ] diff --git a/Cargo.toml b/Cargo.toml index b8dea01..7b6e6b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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. -- cgit v1.2.3