Skip to content

Commit

Permalink
search a bit smarter for readmes, the previous implementation showed …
Browse files Browse the repository at this point in the history
…readmes from submodules of the program
  • Loading branch information
Frederik Delaere committed Jul 5, 2018
1 parent 4dc12b2 commit d525f5a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/rsmodules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -321,9 +322,12 @@ fn get_readme(selected_module: &str, shell: &str) -> Vec<String> {

// 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()));
Expand Down

0 comments on commit d525f5a

Please sign in to comment.