(input: &Option<PathBuf>)
| 13 | } |
| 14 | |
| 15 | pub fn get_input_reader(input: &Option<PathBuf>) -> eyre::Result<BufReader<Box<dyn Read>>> { |
| 16 | match input { |
| 17 | Some(path) => { |
| 18 | let file = File::open(path)?; |
| 19 | Ok(BufReader::new(Box::new(file))) |
| 20 | } |
| 21 | None => Ok(BufReader::new(Box::new(std::io::stdin()))), |
| 22 | } |
| 23 | } |