(input: &str)
| 89 | } |
| 90 | |
| 91 | fn read_input_bytes(input: &str) -> Result<Vec<u8>> { |
| 92 | if input == "-" { |
| 93 | let mut bytes = Vec::new(); |
| 94 | std::io::stdin().read_to_end(&mut bytes).context("failed to read stdin")?; |
| 95 | return Ok(bytes); |
| 96 | } |
| 97 | |
| 98 | std::fs::read(input).with_context(|| format!("failed to read input `{input}`")) |
| 99 | } |
| 100 | |
| 101 | fn has_extension(path: &str, extension: &str) -> bool { |
| 102 | Path::new(path).extension().and_then(OsStr::to_str) == Some(extension) |