use std::io::Read;
use std::path::PathBuf;
pub type CliResult = Result<(), String>;
pub fn read_stdin() -> Result<String, String> {
let mut buffer = String::new();
std::io::stdin()
.read_to_string(&mut buffer)
.map_err(|e| format!("error reading stdin: {}", e))?;
Ok(buffer)
}
pub fn read_input(path: &str) -> Result<String, String> {
if path == "-" {
read_stdin()
} else {
std::fs::read_to_string(path).map_err(|e| format!("error reading {}: {}", path, e))
}
}
#[derive(Debug, Default)]
pub struct CommonOpts {
pub include_dirs: Vec<PathBuf>,
pub prepend_include_dirs: Vec<PathBuf>,
pub warnings: Vec<String>,
pub force: bool,
pub debug: bool,
pub verbose: bool,
pub output_file: Option<PathBuf>,
}