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"); } }