* add docsmg tool * moved to the correct scripts directory * removed test files * added install script and readme draft to docsmg * fix install script * fixed issues * Revert "fixed issues" This reverts commita51192025f. * Revert "Revert "fixed issues"" This reverts commitab68918fea. * added dotenv and updated readme * fixed install script
32 lines
973 B
Rust
32 lines
973 B
Rust
use std::path::PathBuf;
|
|
|
|
use crate::{migratefile::read_migrate_file_left_side, recurse_directory};
|
|
|
|
pub fn generate(migratefile: Option<PathBuf>, migrate_path: PathBuf) {
|
|
// if there is a migrate file, read it and get the paths from the left side
|
|
let paths: Vec<PathBuf> = match migratefile {
|
|
Some(i) => {
|
|
let contents = read_migrate_file_left_side(i);
|
|
if let Ok(contents) = contents {
|
|
contents
|
|
} else {
|
|
vec![]
|
|
}
|
|
}
|
|
None => {
|
|
vec![]
|
|
}
|
|
};
|
|
// get rid of paths already in the specified migrate file
|
|
let paths: Vec<PathBuf> = recurse_directory(migrate_path.clone())
|
|
.iter()
|
|
.filter_map(|x| x.strip_prefix(migrate_path.clone()).ok())
|
|
.filter(|x| !paths.contains(&x.to_path_buf()))
|
|
.map(|x| x.to_path_buf())
|
|
.collect();
|
|
|
|
for path in paths {
|
|
println!("{} ->", path.display());
|
|
}
|
|
}
|