workmn 0.0.5

Manages the lifecycle of projects on the local machine
Documentation
use globwalk::{GlobWalkerBuilder, WalkError};
use std::path::{Path, PathBuf};

pub fn glob_err<P, S, E>(base: P, pattern: S, on_error: E) -> Vec<PathBuf>
where
    P: AsRef<Path>,
    S: AsRef<str>,
    E: Fn(WalkError) -> (),
{
    let walker = GlobWalkerBuilder::new(base, pattern)
        .case_insensitive(true)
        .sort_by(|a, b| a.path().cmp(b.path()))
        .build()
        .expect("Unable to build glob walker");

    walker
        .filter_map(|res| match res {
            Ok(entry) => Some(entry.into_path()),
            Err(e) => {
                on_error(e);
                None
            }
        })
        .collect()
}