write_output

Function write_output 

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

Write output to stdout (if path is None or “-”) or to a file

§Examples

use std::path::PathBuf;
use oxur_cli::common::io::write_output;

// Write to file
write_output("content", Some(&PathBuf::from("output.txt")))?;

// Write to stdout
write_output("content", None)?;

// Write to stdout (if user passes "-")
write_output("content", Some(&PathBuf::from("-")))?;