aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2022-03-19 21:07:41 +0100
committerTeddy Wing2022-03-19 21:07:41 +0100
commit2a0182af66a64756eaa88d64e44a18ee5fb94bce (patch)
treebd042489a5f81766bf07166736bf357855bf518a
parentd5c62cac01103881b8c8f8d629bc2eb0d12723c7 (diff)
downloadyaqlite-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.lock8
-rw-r--r--Cargo.toml2
-rw-r--r--src/main.rs1
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.