Skip to main content

write_output

Function write_output 

Source
pub fn write_output(path: Option<&Path>, content: &str) -> Result<()>
Expand description

Writes content to a file or stdout.

If path is None, writes to stdout. Otherwise writes to the specified file.

ยงExamples

use rh_foundation::cli::write_output;

use std::path::Path;

// Write to file
write_output(Some(Path::new("output.txt")), "Hello, world!")?;

// Write to stdout
write_output(None, "Hello, world!")?;