1use super::Config;
2use super::USAGE;
3
4pub struct Runtime {
7 config: Config,
8}
9
10impl Runtime {
11 pub fn new(config: Config) -> Self { Self { config } }
13
14 pub fn try_run(&self) -> Result<(), std::io::Error> {
17 let text = std::fs::read_to_string(&self.config.file_path)?;
18 crate::core::show_found(&self.config, text.lines());
19 Ok(())
20 }
21 pub fn run(&self) {
25 self.try_run().unwrap_or_else(|err| {
26 eprintln!("{USAGE}\n\nRunning program failed: {err}");
27 std::process::exit(2);
28 })
29 }
30}