Skip to content

Commit

Permalink
Fix max-depth and depth interpretation
Browse files Browse the repository at this point in the history
  • Loading branch information
yaa110 committed Apr 27, 2021
1 parent 1b0bddb commit f08db6c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0"
name = "nomino"
readme = "README.md"
repository = "https://github.com/yaa110/nomino"
version = "1.0.0"
version = "1.0.1"

[dependencies]
atty = "0.2"
Expand Down
14 changes: 3 additions & 11 deletions src/input/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,14 @@ impl InputIterator {
}

if let Source::Regex(re, depth, max_depth) = source {
let depth = if let Some(max_depth) = max_depth {
if max_depth < depth {
max_depth
} else {
depth
}
} else {
depth
};
let max_depth = max_depth.unwrap_or(depth);
return Ok(Self::DirectoryIterator {
formatter,
re,
preserve_extension,
iter: WalkDir::new(".")
.min_depth(depth)
.max_depth(depth)
.min_depth(if depth > max_depth { max_depth } else { depth })
.max_depth(max_depth)
.into_iter(),
});
}
Expand Down

0 comments on commit f08db6c

Please sign in to comment.