use super::*;
pub fn find_file(opt: &ListOption) -> Result<Vec<PathBuf>> {
let files = find_folders(opt.clone()).unwrap();
let mut paths = Vec::new();
files.iter().for_each(|file| {
if let crate::FilterKind::File = file.kind {
let file_path = file.workspace.join(&opt.filter.name);
paths.push(file_path);
}
});
Ok(paths)
}
#[test]
fn search_git() {
use crate::*;
use clap::Parser;
let cli = RepoCli::parse_from([
"git-explore",
"list",
"-d",
KEY_BASEPATH,
"-n",
"Cargo.toml",
]);
let ret = if let Some(Command::List(opt)) = cli.command {
find_file(&opt)
} else {
todo!()
};
insta::assert_debug_snapshot!(ret)
}