makogrep 0.1.0

mako 的 minigrep 示例 cli
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::{env, process};
use makogrep::{run, Config};
fn main() {
    // 获取命令行参数
    let args = env::args();
    // 提取需要的参数
    let config = Config::build(args).unwrap_or_else(|error| {
        eprintln!("Problem parsing arguments: {error}");
        process::exit(1);
    });
    // 执行
    if let Err(e) = run(config) {
        eprintln!("Application error:{e}");
        process::exit(1);
    }
}