From cb6082805133945ae72ea3a1d3d90bdc99f0a932 Mon Sep 17 00:00:00 2001 From: rsteube Date: Mon, 24 Oct 2022 23:19:50 +0200 Subject: [PATCH] actually write to the given buffer --- src/carapace_spec.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/carapace_spec.rs b/src/carapace_spec.rs index b43e10f..79aa4fe 100644 --- a/src/carapace_spec.rs +++ b/src/carapace_spec.rs @@ -53,10 +53,11 @@ impl Generator for Spec { format!("{}.yaml", name) } - fn generate(&self, cmd: &clap::Command, _: &mut dyn std::io::Write) { + fn generate(&self, cmd: &clap::Command, buf: &mut dyn std::io::Write) { let command = command_for(cmd); let serialized = serde_yaml::to_string(&command).unwrap(); - println!("{}", serialized); + buf.write_all(serialized.as_bytes()) + .expect("Failed to write to generated file"); } }