summaryrefslogblamecommitdiff
path: root/minigrep/src/main.rs
blob: fc5ae9a9ccb76fd1163a1ffcccd6ac5d4a2b58d2 (plain) (tree)
1
2
3
4
5
6
7

                 


                     
 
           




                                                          




                                                 
     
 
 
use std::process;
use std::env;

use minigrep;
use minigrep::Config;

fn main() {
    let args: Vec<String> = env::args().collect();
    let config = Config::new(&args).unwrap_or_else(|err| {
        println!("Problem parsing arguments: {}", err);
        process::exit(1);
    });
    println!("\nSearching for {}", config.query);
    println!("    in file {}", config.filename);
    if let Err(e) = minigrep::run(config) {
        println!("Application error: {}", e);
        process::exit(1);
    }
}