From d525f5a1f4515a30dfce8eaf3a28d3c1f2923cd6 Mon Sep 17 00:00:00 2001 From: Frederik Delaere Date: Thu, 5 Jul 2018 13:06:11 +0200 Subject: [PATCH] search a bit smarter for readmes, the previous implementation showed readmes from submodules of the program --- src/rsmodules.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/rsmodules.rs b/src/rsmodules.rs index 69d6265..5a76027 100644 --- a/src/rsmodules.rs +++ b/src/rsmodules.rs @@ -228,7 +228,8 @@ fn find_root(path: &str, previous_path: &str, selected_module: &str) -> String { let mut counter: usize = 0; - for part in parts.iter() { + //for part in parts.iter() { + for part in &parts { if path.find(part) != None { counter += 1; } @@ -321,9 +322,12 @@ fn get_readme(selected_module: &str, shell: &str) -> Vec { // search filesystem with a glob readmes.extend_from_slice(&glob_path("*read*me*", &readme_paths)); - readmes.extend_from_slice(&glob_path("*/*read*me*", &readme_paths)); readmes.extend_from_slice(&glob_path("doc*/*read*me*", &readme_paths)); readmes.extend_from_slice(&glob_path("*/doc*/*read*me*", &readme_paths)); + readmes.extend_from_slice(&glob_path("*/src*/*read*me*", &readme_paths)); + readmes.extend_from_slice(&glob_path("src*/*read*me*", &readme_paths)); + readmes.extend_from_slice(&glob_path("*/source*/*read*me*", &readme_paths)); + readmes.extend_from_slice(&glob_path("source*/*read*me*", &readme_paths)); //readmes.sort(); readmes.sort_by(|a, b| a.len().cmp(&b.len()));