-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add support for -d
#16
Conversation
Hi @sighol, please review this and let me know how it is. I'll write code for |
It looks like this PR broke the tests. This used to be the output of
And now it returns
And thank you for making this PR! I am motivated to refactor the tests now, and maybe add some github actions. |
My bad. Yes, I didn't run the tests, at all! Lemme go back and see what's up with this. And yes, they do need refactoring. In fact the whole project. Personally, I think we should open an issue to track the roadmap around the following tasks (not in the same order). Please feel free to add or remove some.
What do you think? |
Since we talked about doing some refactorings, I pushed some changes that I think improved the structure somewhat. It unfortunately broke your PR, but that should hopefully be easy to resolve. |
Found the error. This patch should fix it up. diff --git a/src/pathiterator.rs b/src/pathiterator.rs
index 40f1059..72bb7f4 100644
--- a/src/pathiterator.rs
+++ b/src/pathiterator.rs
@@ -102,16 +100,12 @@ impl FileIterator {
)
});
- for entry in entries {
- let item = IteratorItem::new(&entry.path(), item.level + 1, false);
+ for (index, entry) in entries.iter().enumerate() {
+ let item = IteratorItem::new(&entry.path(), item.level + 1, index == 0);
if self.is_included(&item.file_name, item.is_dir()) {
self.queue.push_back(item);
}
}
-
- if let Some(item) = self.queue.back_mut() {
- item.is_last = true;
- }
}
} The |
- only list directories by using `-d` flag
Hi @sighol, got a little occupied during the weekend and couldn't work on this one. But hey, thanks a ton for the carry with the patch. I've made the change and pushed it here. See if it looks good to you. |
Closes #8
-d
flag