From 6d664454222885c8bcf64e7935fcf8da7c3d9a11 Mon Sep 17 00:00:00 2001 From: Jordan Gong Date: Sat, 5 Sep 2020 18:22:25 +0800 Subject: Build minigrep --- minigrep/src/main.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 minigrep/src/main.rs (limited to 'minigrep/src/main.rs') diff --git a/minigrep/src/main.rs b/minigrep/src/main.rs new file mode 100644 index 0000000..ccdd326 --- /dev/null +++ b/minigrep/src/main.rs @@ -0,0 +1,18 @@ +use std::env; +use std::process; +use minigrep::Config; + +fn main() { + let args: Vec = env::args().collect(); + + let config = Config::new(&args).unwrap_or_else(|err| { + eprintln!("Problem parsing arguments: {}", err); + process::exit(1); + }); + + if let Err(e) = minigrep::run(config) { + eprintln!("Application error: {}", e); + + process::exit(1); + } +} -- cgit v1.2.3