Skip to content

Commit

Permalink
Merge pull request #21 from rsteube/write-buf
Browse files Browse the repository at this point in the history
actually write to the given buffer
  • Loading branch information
rsteube authored Oct 24, 2022
2 parents 9e2ba42 + cb60828 commit ee2d577
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/carapace_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
}

Expand Down

0 comments on commit ee2d577

Please sign in to comment.