sort all non-md files at the end in nav
This commit is contained in:
parent
7f0ad4c71b
commit
c452dc8535
1 changed files with 13 additions and 0 deletions
13
src/main.rs
13
src/main.rs
|
@ -283,6 +283,19 @@ fn update_garden<P: AsRef<Path>>(
|
|||
})
|
||||
.collect();
|
||||
files.sort();
|
||||
files.sort_by_key(|p| {
|
||||
println!("{:?}", p);
|
||||
match p.extension() {
|
||||
None => -1,
|
||||
Some(ext) => {
|
||||
if ext == "md" {
|
||||
0
|
||||
} else {
|
||||
1
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if files.is_empty() {
|
||||
return Err(anyhow!("Garden is empty."));
|
||||
|
|
Loading…
Reference in a new issue