scanit 0.1.7

A fast file scanner utility that uses regex patterns to find files in your filesystem, BLAZINGLY FAST PERHAPS??????????????????????????????????????????
Documentation

use scandir::{Walk, Toc};
use std::error::Error;
use regex::Regex;
use clap::Parser;

#[derive(Parser)]
#[command(author, version, about = "Search files using regex patterns")]
struct Args {
    #[arg(help = "Regex pattern to match files (e.g. \\.rs$),eg run by scanit csv$")]
    pattern: String,
}



fn main() -> Result<(), Box<dyn Error>> {
    let args = Args::parse();

    let toc: Toc = Walk::new("/", Some(true))?.collect()?;
    let re: Regex = Regex::new(&args.pattern)?;

    let files: Vec<String> = toc.files()
        .iter()
        .map(|p: &String| format!("/{}", p.to_string()))
        .filter(|path: &String| re.is_match(path))
        .collect();

    println!("{:#?}", files);
    Ok(())
}