2020-12-06 10:44:17 +00:00
|
|
|
use std::env;
|
2020-12-06 15:34:46 +00:00
|
|
|
use std::process;
|
|
|
|
|
|
|
|
use minigrep::Config;
|
2020-12-06 10:44:17 +00:00
|
|
|
|
|
|
|
fn main() {
|
2020-12-06 20:55:06 +00:00
|
|
|
let config = Config::new(env::args()).unwrap_or_else(|err| {
|
2020-12-06 15:34:46 +00:00
|
|
|
eprintln!("Problem parsing arguments: {}", err);
|
|
|
|
process::exit(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
if let Err(e) = minigrep::run(config) {
|
|
|
|
eprintln!("Application error: {}", e);
|
|
|
|
process::exit(1);
|
|
|
|
}
|
2020-12-06 10:44:17 +00:00
|
|
|
}
|