1
0
Fork 0
mirror of https://github.com/archtechx/todo-system.git synced 2025-12-12 09:04:03 +00:00

add todos_path and readme_path to excludes to avoid double counting priority todos

This commit is contained in:
Samuel Štancl 2023-11-23 17:05:51 +01:00
parent b5bbe710ff
commit 887199995a
2 changed files with 27 additions and 18 deletions

View file

@ -39,11 +39,14 @@ struct Args {
fn main() {
let args = Args::parse();
let root_dir: PathBuf = std::env::current_dir().unwrap();
let mut paths: Vec<PathBuf> = vec![];
let mut excludes: Vec<PathBuf> = vec![];
let mut entries: Vec<Entry> = vec![];
let mut stats = Stats::new();
for p in args.paths {
let mut path = root_dir.clone();
@ -53,7 +56,9 @@ fn main() {
path.push(p);
}
paths.push(path);
if path.exists() {
paths.push(path);
}
}
for exclude in args.exclude {
@ -63,27 +68,28 @@ fn main() {
excludes.push(path);
}
let mut entries: Vec<Entry> = vec![];
let mut stats = Stats::new();
for p in &paths {
scan_dir(p.as_path(), &mut entries, &excludes, &mut stats).unwrap();
}
let mut todos_path = root_dir.clone();
todos_path.push(&args.todos);
if todos_path.exists() {
scan_todo_file(&todos_path, &mut entries).unwrap();
}
let mut readme_path = root_dir.clone();
readme_path.push(&args.readme);
if todos_path.exists() {
excludes.push(todos_path.clone());
scan_todo_file(&todos_path, &mut entries).unwrap();
}
if readme_path.exists() {
excludes.push(readme_path.clone());
scan_readme_file(&readme_path, &mut entries).unwrap();
}
for p in &paths {
scan_dir(p.as_path(), &mut entries, &excludes, &mut stats).unwrap();
}
render_entries(entries);
if args.verbose {
@ -91,5 +97,7 @@ fn main() {
stats.print();
eprintln!("Paths: {:?}", &paths);
eprintln!("Excludes: {:?}", &excludes);
eprintln!("todo.md: {:?}", &todos_path);
eprintln!("readme.md: {:?}", &readme_path);
}
}