Support command line parameters
This commit is contained in:
@@ -100,13 +100,13 @@ impl<T: ErrorString> std::convert::From<T> for Error {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn open_output_file(output_path: PathBuf) -> Result<BufWriter<std::fs::File>, Error> {
|
||||
pub fn open_output_file(output_path: &PathBuf) -> Result<BufWriter<std::fs::File>, Error> {
|
||||
Ok(std::io::BufWriter::new(std::fs::File::create(output_path)?))
|
||||
}
|
||||
|
||||
pub fn open_output(output_file: Option<PathBuf>) -> Result<Output, Error> {
|
||||
match output_file {
|
||||
Some(output_path) => Ok(Box::new(open_output_file(output_path)?)),
|
||||
Some(output_path) => Ok(Box::new(open_output_file(&output_path)?)),
|
||||
None => Ok(Box::new(BufWriter::new(std::io::stdout()))),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user